Using Parallel computing in training neural networks

5 views (last 30 days)
I am trying to use parallel computing toolbox for training a neural network in MATLAB on a laptop which has a core-iV cpu and MATLAB 2015a. It keeps giving me an error. I am following exactly the instructions provided by mathworks. Even the sample codes from mathworks are not working and giving me the same error. Here is my code:
pool=parpool ;
t=zeros(1,1000); %optional output (Do not worry about being zero, it is just a sample code for my error)
net.layers{1}.transferFcn = 'tansig';
net.layers{2}.transferFcn = 'purelin';
trainFcn = 'trainbr';
hiddenLayerSize = 30;
net = fitnet(hiddenLayerSize,trainFcn);
net.trainParam.epochs= 40000;
net.divideFcn = 'dividerand'; % Divide data randomly
net.divideMode = 'sample'; % Divide up every sample
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
net.performFcn = 'mse'; % Mean Squared Error
% Train the Network
[net,tr] = train(net,x,t,'useParallel','yes');
And here is the error message.
Error using Composite/subsasgn (line 96)
An invalid indexing request was made.
Error in nncalc.setup1>setupImpl (line 453)
calcData{i} = datai;
Error in nncalc.setup1 (line 17)
[calcMode,calcNet,calcData,calcHints,net,resourceText] = setupImpl(calcMode,net,data);
Error in nncalc.setup (line 7)
[calcMode,calcNet,calcData,calcHints,net,resourceText] = nncalc.setup1(calcMode,net,data);
Error in network/train (line 357)
[calcLib,calcNet,net,resourceText] = nncalc.setup(calcMode,net,data);
Error in worked_with_parallerl_computing (line 27)
[net,tr] = train(net,x,t,'useParallel','yes');
Caused by:
Error using Composite/errorIfRemoteOperationInProgress (line 170)
The Composite value cannot be accessed because
a remote operation is in progress.
Any help would be appreciated. BTW, the code copied above is just a sample code for illustrating the problem (I know I do not need parallel processing for training such a network).

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by