Parallel Computing Toolbox 

Interactive Environment

matlabpool Command

The matlabpool command reserves a number of MATLAB workers and sets up an interactive environment for executing parallel MATLAB code. Within this environment, parfor and 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).

For more details, see Setting up MATLAB Resources and matlabpool sections in the documentation.

An interactive MATLAB session
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.

Parallel Command Window

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.

For more details see Interactive Parallel Mode and Using the Parallel Profiler sections in the documentation.

pmode session
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.