How to run parallel parfor cycles on separate processor cores?
11 views (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Parallel Computing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!