How can I use NARX network on GPU?

12 views (last 30 days)
I want to use GPU to speed up training of NARX. But it stopped at the 'Computing Resources: GPU device #1, GeForce GTX 750 Ti' i waited 3 hours but it say nothing.
My network is composed with 3 layers(Input layer,Intermediate layer,Output layer). it has 15 inputs and 1 output. so i decided to divide these inputs and output but i don't understand how to do it. Please tell me the way to divide training data.
Reference ver:matlab2017b
Program X = con2seq(input);% input is matfile which has size of 15×30001 T = con2seq(output);% input is matfile which has size of 1×30001
net = narxnet(1:2,1:4,5,'open'); [x,xi,ai,t] = preparets(net,X,[],T);
[net,tr] = train(net,x,ai,'useGPU','yes');

Accepted Answer

Etsuo Maeda
Etsuo Maeda on 21 Jun 2018
Your question title might be “How can I use NARX network on GPU” or “How can I train NARX network on GPU”, and “How can I use NARX network with multi-input”. Generally, one question should be related to one title. Wrong title makes the answers confusing. Tips for asking good questions to get accurate answers quickly may help you to write a good question.
1. GPU memory size: NVIDIA GeForce GTX 750 Ti has 2GB GPU memory. Have you checked the volume of your data? Is it lower than 2GB? In case of GPU calculation, you need to pay attention to the amount of your GPU memory.
2. GPU vs CPU: In case of small calculation, CPU is much much much faster than GPU. This is because GPU calculation needs a transfer sequence from RAM to GPU memory. See and check the following code.
[X,T] = simpleseries_dataset;
Xnew = X(81:100);
X = X(1:80);
T = T(1:80);
net = narxnet(1:2,1:2,10);
[Xs,Xi,Ai,Ts] = preparets(net,X,{},T);
net1 = train(net,Xs,Ts,Xi,Ai,'useGPU','no');
net2 = train(net,Xs,Ts,Xi,Ai,'useGPU','yes');
3. NARXnet with multi-input: The following Q&A might help you.
Walter Roberson
Walter Roberson on 21 Jun 2018
I think "multiple sequences" would be if you passed it a cell array of data.

Sign in to comment.

More Answers (0)


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!