Parallel Computing Toolbox
matlabpool command reserves a number of MATLAB workers and sets up an interactive environment for executing parallel MATLAB code. Within this environment,
spmd constructs can set up data and MATLAB code exchange between a MATLAB client session and MATLAB workers. These operations happen automatically and, therefore, you as a user do not have to construct and submit jobs to the cluster.
The code that is executed in the environment set up using the
matlabpool command can be set up for off-line execution using the
batch command (for MATLAB scripts) or
createMatlabpoolJob function (for MATLAB functions).
An interactive MATLAB session demonstrating pi estimation using parallel numerical quadrature on four workers. Data transfer between the MATLAB session and the workers executing the
spmd-end statements in parallel is managed automatically. Click on image to see enlarged view.
The Parallel Command Window provides an extension to the MATLAB command window for executing data-parallel MATLAB code directly on workers participating in the interactive parallel session. Commands issued at the
pmode prompt are executed immediately on all the labs and results are returned immediately to the client session.
You can use distributed arrays, associated parallel functions, as well as message-passing functions in this mode. In fact, the commands you issue at the
pmode prompt can be wrapped up within an
spmd statement and executed from MATLAB command prompt. The examples shown in the screen shots above and below perform exactly the same computations.
This tool facilitates the debugging process, as it allows you to watch the results and the interaction between labs at each step. In addition, using
mpiprofile you can easily profile your parallel code from the Parallel Command Window.
An interactive parallel mode (pmode) session demonstrating pi estimation using parallel numerical quadrature on four workers. The output from each worker is shown. Click on image to see enlarged view.