MATLAB Answers

Deep Learning: Training Network with "parallel" option using only CPUs

12 views (last 30 days)
I am trying to train a network using the follow parameters:
miniBatchSize = 10;
clear NewNetIn3D
valFrequency = floor(numel(imdsTrain)/miniBatchSize);
options = trainingOptions('sgdm', ...
'MiniBatchSize',miniBatchSize, ...
'MaxEpochs',6, ...
'Verbose',false, ...
net = trainNetwork(imdsTrain,LabelsTrain,LayersBMC,options);
Since my graphic card is not super, I am trying to run the code using multiple CPUs, but the parallel option always go with multiple GPUs and then crashes. Is there any way to restrict the paralel pool to use only CPUs? If I define the option 'cpu' it works, but with only one core.


Sign in to comment.

Accepted Answer

Joss Knight
Joss Knight on 16 Dec 2019
Even with a weak graphics card you will usually see better performance than on multiple CPUs. However, to try it out, after you start MATLAB, type


Brunno Machado de Campos
Brunno Machado de Campos on 17 Dec 2019
Hi, thank you!
Your line worked perfectly.
I believe my problem with GPU is the dedicated memory. I am running with 800 3D MagRessoImages and when the trainning starts with GPUs it stops imediately with a memory related error.
Joss Knight
Joss Knight on 17 Dec 2019
The correct solution is to reduce the MiniBatchSize training option until you have enough memory.

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!