Running Parallel MATLAB Jobs
A Tutorial Guide for Gordon and Trestles
Both Gordon and Trestles support Parallel MATLAB, a development environment from The MathWorks. Here you will find instructions and examples for running jobs with the MATLAB Parallel Computing Toolbox on a desktop and submitting them to the MATLAB Distributed Computing Server (MDCS).
Note: MATLAB configurations are very similar on both Gordon and Trestles. Where this documentation refers to Gordon, you may substitute Trestles without loss of accuracy.
Important: Use of MATLAB on Gordon is limited to users from degree-granting educational institutions which are licensees of The MathWorks' Parallel Computing Toolbox (PCT). To use MATLAB on Gordon or Trestles, request to have your account added to the matlab UNIX group by sending an email, submitting an XSEDE Help Desk ticket or calling the consulting line at 1-866-336-2357.
How to Use MATLAB on Gordon and Trestles
Parallel MATLAB consists of two parts: the PCT and the MDCS.
Features of the Parallel Computing Toolbox
The PCT is a module that runs on the MATLAB client. It contains a number of useful capabilities, including:
- Parallel for-Loops (parfor)
- Distributed Arrays (arrays spread among several worker processes)
- spmd blocks (single program, multiple data) which execute code in a manner similar to mpi runs; MATLAB code placed within an spmd block executes simultaneously on the pool of MATLAB processes that the user has allocated; each process may be identified by a labindex variable
- The ability to define several independent tasks to run simultaneously within a single, embarrassingly parallel MATLAB job
- Parallel integration of many toolboxes, e.g. bioinformatics, genetic algorithms and optimization
- Many general parallel functions
Using the MDCS allows users to run multiprocessor jobs on Gordon via the batch queue system. The MDCS may be accessed from a user desktop with the PCT installed.
The PCT will automatically submit jobs to the MDCS (see below for details of this procedure).
The version of MATLAB currently installed on Gordon is 2013b and is located in:
NOTE: The MATLAB version on the desktop must match the MDCS version.
To use the desktop PCT with Gordon you must have:
- Matlab version 2013b installed
- An ssh private/public key pair generated on the desktop with the public key installed on Gordon to enable passwordless connections
Linux and Mac OS X have built in key generating programs as part of their default system environments, but Windows does not. One option for Windows users is to download PuTTY and use it to generate the key pairs. See the page Configuring Secure Shell on a Desktop for Use with MATLAB Parallel Computing Toolbox, which describes how to generate key pairs on your desktop and install them on Gordon.
See some examples of MATLAB usage to better understand the process.