How can I use NARX network on GPU?

6 views (last 30 days)
Hello.
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);
tic
net1 = train(net,Xs,Ts,Xi,Ai,'useGPU','no');
toc
net2 = train(net,Xs,Ts,Xi,Ai,'useGPU','yes');
toc
3. NARXnet with multi-input: The following Q&A might help you.
https://jp.mathworks.com/matlabcentral/answers/302908-narxnet-with-multi-input
HTH
  6 Comments
Riku Koyama
Riku Koyama on 21 Jun 2018
In this sentence,"However, if the data consists of multiple sequences, it can be parallelized across the separate sequences." is mean single series data shoud be divided by cattimesteps command ? I don't understand the data consists of multiple sequences. What is the data shape?
For example,single series data([1,2,3,4,5]) convert to x1([1,2,3]),and x2([4,5]). After that,I use cattimesteps command,
" X = cattimesteps(x1,x2) "
In this time,this data X consists of multiple sequences,doesn't?
thank you.
Japanese
この文章だと複数の時系列データであれば問題ないようですが,具体的にどういった形ですか?
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)

Tags

Community Treasure Hunt

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

Start Hunting!