Note: The documentation as it pertains to SEAS Compute clusters (such as HPC) is not relevant anymore. However, the actual code might still be relevant.

Matlab Parallel Computing Toolbox (PCT) is now available at SEAS as a part of Matlab r2010a.

We currently support only 'local' parallel mode, i.e running within a single server. The recommended best practice is to run on the hpc cluster interactively or using Matlab scripting. Each compute node supports up to 8-way parallelism and has 16GB of RAM available.

#### Using Matlab PCT on the hpc cluster

Once on hpc.seas.harvard.edu, request an interactive session from the SGE scheduler

The above requests 4 'slots' (CPU cores) within a single node.

You can of course also run Matlab .m scripts on the hpc cluster non-interactively. For instructions, please see here.

You can now launch Matlab in non-GUI mode as follows:

Once you get the command prompt, you need to setup the Matlab parallel environment:

The above creates a 4-way SMP (shared memory parallel) environment (basically leveraging thread based or OpenMP parallelism under the hood).

Once the environment is set, we can run the following quick benchmark that tests multiply-add (MAD) performance leveraging single CPU core vs leveraging 4 CPU cores and PCT routines:

On one of the compute nodes on the hpc cluster, the CPU execution time is ~35 seconds vs ~118 seconds using PCT. That is, the parallel execution for MAD (as implemented here) is roughly 3.3 times **slower**. .

Matlab PCT offers a myriad of functions, many of which certainly show larger than 1x speed-ups. For example the following 'for loop demo' runs faster using PCT (keeping in mind that one should avoid 'for loops' like the one below at all cost in Matlab in the first place).:

This simple 'for loop' example takes ~29 seconds on a single CPU core and ~7 seconds using 4-way PCT execution. That is, the speed up is roughly fourfold. Notably if the problem size is small the PCT execution is slower, e.g. if 'istep=1024', the PCT execution is roughly ten times slower due to the overhead from initializing the 4 'Matlab workers' compared to actual compute effort needed.

#### More information

For more information, please see the full PCT documentation here.

If you are interested in Matlab Distributed Computing Toolbox (MPI based distributed memory parallel solution), which is currently not available on the hpc cluster, please contact ircshelp@seas.harvard.edu.