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');

 Réponse acceptée

Etsuo Maeda
Etsuo Maeda le 21 Juin 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 commentaires

Riku Koyama
Riku Koyama le 21 Juin 2018
Thank you for your answer. I'm changing title of question as soon as possible.
Your advices is helphul for me. I'm checking the volume of mydata.
I thought GPU faster than CPU in a field of all machin learning. the misunderstanding has been cleared up.
May I ask you more one thing else ?
Thanks to you,I understand about CPU vs GPU, so I'm going to apply paralell computing on cpu to train NARXnet.
But,I heard it can't Execute when training NARX has closed loop. If NARX don't have closed loop,It can execute.
Do you have any idea to solve this problem?
Thank you very match.
Walter Roberson
Walter Roberson le 21 Juin 2018
Parallel computing on cpu is not always faster that serial computing. Parallel computing is done in separate processes, so it is necessary to transfer data and instructions to each of the processes. If the amount of data and instructions is high compared to the amount of computation to be done, then the overhead of using parallel computing will make it slower.
Also, in general, parallel workers only get one CPU core unless you specially configure them to use multiple cores. MATLAB automatically uses all cores available to a worker to compute "large enough" calculations that happen to match certain patterns, such as large additions or matrix multiplications. That is done with shared memory. A non-parallel worker that has access to a number of cores will finish the large computation faster than a parallel worker that only has one core (but there might be several of those parallel computations happening at the same time.)
It is common to find that parallel computations are slower unless the computations are carefully analyzed.
Riku Koyama
Riku Koyama le 21 Juin 2018
Thank you for answers
I pretty much got it.
The point is it is not necessary to use parallel computing in like time series neural-network which don't apply to Batch processing and can't be analyzed carefull. Actually, those action slow down training network.
If I want to speed up training NARX network,I should use high-performance cpu.
Is it right?
英語が正しくないと思うので日本語でも書いておきます.
御回答いただきありがとうございます.
ある程度ですが理解できました.
つまり,NARXやtime-delay-netなどの時系列ニューラルネットワークの学習には並列コンピューティング処理は意味がなく(そもそもバッチ処理が行われていないから無意味?).むしろ,データのやり取りにより学習時間の低下につながってしまう.効果があるのは正確にデータ形式を分析できるときのみ.
もし,NARXの学習速度を上げたいならば性能の良いCPUでシリアルコンピューティング処理の速度を上げたほうが良い.
と言うことであっているでしょうか?
勉強不足なため,何度も申し訳ありませんが,ご回答いただければ幸いです.
Walter Roberson
Walter Roberson le 21 Juin 2018
"Note that parallelism happens across samples, or in the case of time series across different series. However, if the network has only input delays, with no layer delays, the delayed inputs can be precalculated so that for the purposes of computation, the time steps become different samples and can be parallelized. This is the case for networks such as timedelaynet and open-loop versions of narxnet and narnet. If a network has layer delays, then time cannot be “flattened” for purposes of computation, and so single series data cannot be parallelized. This is the case for networks such as layrecnet and closed-loop versions of narxnet and narnet. However, if the data consists of multiple sequences, it can be parallelized across the separate sequences."
Riku Koyama
Riku Koyama le 21 Juin 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 le 21 Juin 2018
I think "multiple sequences" would be if you passed it a cell array of data.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by