Difference between revisions of "MATLAB/Parallel"

From ScientificComputing
Jump to: navigation, search
(Created page with "Under construction")
 
Line 1: Line 1:
Under construction
+
MATLAB's [http://www.mathworks.com/products/parallel-computing/ 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 <tt>parfor</tt> loops), using the Parallel Computing Toolbox requires two steps
 +
# opening a ''local'' matlabpool and
 +
# 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.
 +
 
 +
=== Submit a Parallel Job ===
 +
Pass the number of cores (e.g., 4) to bsub's <tt>-n</tt> argument:
 +
bsub -n 4 -W "1:00" matlab -nodisplay -singleCompThread -r simulation
 +
Note that you must ''not'' use the <tt>-nojvm</tt> argument but you ''should'' include the <tt>-singleCompThread</tt> argument.

Revision as of 06:43, 24 October 2016

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.

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.