MATLAB/Parallel

From ScientificComputing
Revision as of 15:37, 17 January 2017 by Urbanb (talk | contribs) (Local pool size has increased in 9.1.)

Jump to: navigation, search

MATLAB's Parallel Computing Toolbox can be used to run suitably-written programs in parallel—on multiple cores at once. For this the newest version of MATLAB that is available is recommended.

For suitable MATLAB programs (such as those containing parfor loops), using the Parallel Computing Toolbox requires two steps

  1. opening a local matlabpool and
  2. telling Euler's bsub scheduler to request multiple cores.

Use the local matlabpool

Use the local matlabpool in your MATLAB program and specify the number of cores (e.g., 4):

matlabpool('local', 4);

when done, close the pool:

matlabpool close;

Note that the local matlabpool is limited to 12 cores in releases up to R2016a (8.7/9.0). From release R2016b (9.1) on, you can use all the cores of Euler nodes.

Submit a Parallel Job

Pass the number of cores (e.g., 4) to bsub's -n argument:

bsub -n 4 -W "1:00" matlab -nodisplay -singleCompThread -r simulation

Note that you must not use the -nojvm argument but you should include the -singleCompThread argument.