How to parallel 4 works with PARFOR with a Core i3 in Matlab

조회 수: 8 (최근 30일)
Manuel Ignacio
Manuel Ignacio 2013년 2월 20일
답변: Franck Dernoncourt 2014년 6월 12일
I have Matlab R2012b for Ubuntu 64 bits. I have a Intel Core i3 CPU M 330 @ 2.13GHz × 4.
I want to use parfor to parallelize 4 loops at same time. Because Intel Core i3 has 2 Cores and 4 Threads I use this code:
if matlabpool('size') == 0 % checking to see if my pool is already open
matlabpool(4)
else
matlabpool close
matlabpool(4)
end
And I obtain the following error:
Error:
You requested a minimum of 4 workers, but the cluster "local" has the NumWorkers property set to allow a maximum of 2 workers. To run a communicating job on more workers than this (up to a maximum of 12 for the Local cluster), increase the value of the NumWorkers property for the cluster. The default value of NumWorkers for a Local cluster is the number of cores on the local machine.
Why? The default value of NumWorkers in my machine is 2 but if I can do 4 loops at the same time, how do I get it?

답변 (2개)

Franck Dernoncourt
Franck Dernoncourt 2014년 6월 12일
To change the value of NumWorkers from 2 to 4 of the local cluster profile programmatically, you can use :
myCluster = parcluster('local');
myCluster.NumWorkers = 4; % 'Modified' property now TRUE
saveProfile(myCluster); % 'local' profile now updated,
% 'Modified' property now FALSE

Jason Ross
Jason Ross 2013년 2월 20일
Go to the Parallel menu, then select Manage Cluster Profiles. Select the "local" profile, and change NumWorkers to 4.
Keep in mind that it's highly likely that doing this isn't going to have any change in the speed of your application, as they will be bottlenecked by the number of compute cores.

카테고리

Help CenterFile Exchange에서 MATLAB Parallel Server에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by