How to run parallel parfor cycles on separate processor cores?

I'm testing a script (see snippet below) on two different machines, with different versions of Matlab installed on the machines: machine/environment M1: Intel Core i5 with 4 cores, OS X 1.8, Matlab 8.3.0.532 (R2014a); machine M2: 32 cores, linux, 8.1.0604 (R2013a).
M1 works properly; with npro=2, nw=2, I see (hitting enter on 'top' in a terminal window) 4 instances of 'my_parallelized_fortran_code.x' running with 100% CPU use. However, on M2 I do see a number of npro*nw instances of 'my_parallelized_fortran_code.x' running (as long as nw<nc), but the CPU usage is only 100/nw%, and the run is immensely slow -- the run time is much larger than nw*(that on M1). I suppose that the problem is that the parallel cycles run on the same cores, not on separate ones. What and how should be set up on M2 in order to have 100% CPU use on separate cores?
matlabpool('local',nw)
parfor i = 1:nc
cd(['run_directory_' int2str(i)]);
% Assume that in the run directory just entered we had prepared the
% appropriate executable file 'my_parallelized_fortran_code.x'
system(['mpiexec -np ' int2str(npro) './my_parallelized_fortran_code.x']);
end
matlabpool close

답변 (0개)

카테고리

도움말 센터File Exchange에서 Parallel Computing Toolbox에 대해 자세히 알아보기

질문:

2015년 1월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by