How to only use 2 of my 4 cores (intel i5) to train neural network?

2 views (last 30 days)
I tried following codes to train NN. But instead of using 2 cores, the train() still uses 4 cores because I can see all of my 4 cores are running high in the Windows 7 task manager. How do I use only two cores to train NN? So that I can use the rest of two cores to do something else?
%%%%%%%%%%%%Code starts
N=2;
myCluster=parcluster('local'); myCluster.NumWorkers=N; parpool(myCluster,N)
net2 = train(net1,x,t,'useParallel','yes','showResources','yes');
y = net2(x,'useParallel','yes','showResources','yes');

Answers (1)

Edric Ellis
Edric Ellis on 28 Jul 2015
I tried the following:
N=2;
myCluster=parcluster('local');
myCluster.NumWorkers=N;
parpool(myCluster,N)
[x,t] = vinyl_dataset;
net = fitnet(140,'trainscg');
net2 = train(net,x,t,'useParallel','yes','showResources','yes');
and did not see any excessive CPU usage - the two MATLAB workers each used a single CPU. (I tried in R2015a on both Windows and Linux)...

Community Treasure Hunt

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

Start Hunting!