From Documentation
Jump to: navigation, search
Line 19: Line 19:
PCT R2012a, R2012b:        orca
PCT R2012a, R2012b:        orca
R2012b (UW_users):          orca
R2012b (UW_users):          orca
R2012a, R2011a (UWo_users): goblin
R2012a, R2011a (UWO_users): goblin
R2009a (Mac_users):        requin
R2009a (Mac_users):        requin

Revision as of 12:04, 22 November 2012

Description: enables users to write and run MATLAB code for solving data parallel and task parallel applications
SHARCNET Package information: see MATLAB PCT software page in web portal
Full list of SHARCNET supported software

MATLAB has introduced a Parallel Computing Toolbox (PCT) that enables users to write and run MATLAB code for solving data parallel and task parallel applications. The MATLAB PCT uses a client-server architecture. The client provides a front end that resembles the traditional MATLAB environment that users are familiar with. The servers – compute engines at the backend – perform the work in a distributed manner. A set of enhanced MATLAB commands and functions for distributed computing have been introduced, which make the parallel processing transparent to users.

Please note that SHARCNET DOES NOT have standalone MATLAB license – but a server side PCT license. This means users cannot run sequential/traditional MATLAB codes directly on SHARCNET systems at all.

For users at University of Waterloo(UW), Western University(UWO) and McMaster University, special provisions have been made for access to campus license resources for SHARCNET machines located at those respective sites (See details below).

License Information

MATLAB PCT on SHARCNET may only be used by permitted users. Interested users should email to request joining the MATLAB group. Note however that individuals who want to use the SHARCNET MATLAB PCT must still purchase their own Matlab and Toolbox client licenses for their PC.


PCT R2012a, R2012b:         orca
R2012b (UW_users):          orca
R2012a, R2011a (UWO_users): goblin
R2009a (Mac_users):         requin


This MATLAB product is intended for users who want to explore the parallel processing power in running MATLAB applications on supercomputers. Users are expected to start their MATLAB applications on their desktop or workstation and have the computational tasks transferred to and accomplished on SHARCNET's supercomputers remotely.

In order to use the parallel processing enabled by the MATLAB Distributed/Parallel Computing Toolbox (DCT or PCT), users need to use the syntax introduced for distributed processing. The minimum changes one needs to make would involve declaring matrices and vectors as distributed objects. Calculations on these objects are handled through regular operators and functions that are overloaded for distributed processing. A one time configuration for using the parallel processing through the resource scheduler on the supercomputer is required. For details please refer to the MATLAB PCT documentations[1].

Details regarding installation/configuration MATLAB and examples can be found from Using SHARCNET MATLAB PCT [2].

University of Waterloo Site License

Users in UW who have access to UW MATLAB site license[3] can run MATLAB 2011a on orca. Please follow the usage instructions in UW_Matlab[4].
UW users can run serial farming MATLAB jobs using MATLAB compiler, see section 5 below.

Western University Site License

Users from Western with access to Western site license may use MATLAB directly on goblin and kraken's bull nodes.

To use MATLAB, first load the module

module load matlab

To invoke Matlab, type


To run a MATLAB script "my_matlab_code.m" from command line, either of the following commands works

matlab < my_matlab_code.m
matlab -r "my_matlab_code;quit"

To submit a MATLAB job, you must use sqsub command, with option -i matlab_script, e.g.

sqsub -q serial -r 1h -o my_matlab.out -i my_matlab_code.m matlab

To run MATLAB jobs on kraken, use the following command, note the option "-f bul" must be used so that the MATLAB jobs will run on bull nodes where MATLAB is licensed to UWO users

sqsub -q serial -f bul -r 1h -o my_matlab.out -i my_matlab_code.m matlab

The access to MATLAB on goblin and kraken is restricted to Western users only. Users must have the same username as their Western username in order to use the UWO MATLAB site license. For details, please refer to the Western MATLAB site license page on ITS's web site.

If you see a license error, contact the local staff for immediate attention or submit a ticket though SHARCNET web portal.

McMaster University Site Licence

For McMaster users who have contributed to the campus license pool, MATLAB is available on Rainbow and Requin. use "module load matlab" to gain access. PLEASE NOTE that each MATLAB job checks out one or more license (once started - not while queued.) This means that you can easily exhaust the license pool and other licensees will be very upset with you. An excellent alternative to this is to compile your MATLAB code to a standalone executable with "mcc", the MATLAB compiler. Once compiled, an application does not require licenses at all - this is really the only sensible way to run MATLAB on a cluster (outside of PCT).

MATLAB license access on Requin and Rainbow happens via a tunnel (since these machines are on SHARCNET's network, not the campus.) This tunnel can die sometimes - if you see a license error, email to get it fixed (or open a ticket on the SHARCNET website.)

Serial Farming MATLAB Jobs with Compiled Code

If you have access to the site license at your home institution, you may serial farm MATLAB jobs by compiling your MATLAB code into executable binaries using MATLAB to C/C++ compile mcc, and run the compiled code as regular jobs. For example, suppose you have an MATLAB code myprog.m, and you want to compile it to executable, follow the steps below

First, set the paths pertaining to the local MATLAB installation (See sections above regarding the site licenses). Or, if applicable, load the MATLAB module (which sets the appropriate paths for you)

module load matlab

Then, compile your MATLAB code myprog.m with command

mcc -m -R '-nosplash -nodisplay -nodesktop -nojvm' myprog

This will create an executable file myprog and a script file To see what other options mcc has, you may use command mcc -help.

To run the executable, you must load the GCC module 4.2 or newer. To resolve a possible conflict, you will need to unload the intel module as suggested when you attempted to load a GCC module:

module unload intel

and then load the GCC module

module load gcc/4.2.4

You can then run myprog as a serial job using sqsub.

sqsub -r 1.0h -o run_myprog.log ./ [matlabroot] [arguments]

matlabroot is the path to local matlab such as /opt/sharcnet/local/matlab/R2010b

For UW site licensed MATLAB on orca , the procedure would be (not in module)
1. Set up the environments by adding the following two lines to your .bash_profile file

export PATH=/opt/sharcnet/local/matlab/R2012b/bin:$PATH
export LD_LIBRARY_PATH=/opt/sharcnet/gcc/4.3.4/lib64:/opt/sharcnet/local/matlab/R2012b/runtime/glnxa64/:${LD_LIBRARY_PATH}

logout, then login to orca again

2. Compile your MATLAB code myprog.m on orca's development nodes (ssh to one of orc-dev1, orc-dev2, orc-dev3 or orc-dev4, then go to the directory where your *.m file exists), then run 'mcc' command

[j8hu@orc-login1 ~]$ ssh orc-dev1
[j8hu@orc129 ~]$ cd /work/j8hu/matlab/compiler
[j8hu@orc129 compiler]$ mcc -m -R '-nosplash -nodisplay -nodesktop -nojvm' myprog

3. Run myprog as a serial job using sqsub.

sqsub -r 1.0h -o run_myprog.log ./ /opt/sharcnet/local/matlab/R2012b [arguments]

Running MATLAB Code with Octave

If you do not have a MATLAB license and you are not using any MATLAB specific functions or toolboxes, an alternative to run batch MATLAB jobs on SHARCNET is to use Octave[5]. To run a MATLAB code myprog.m, simply type command

octave myprog.m

To submit a job that takes no more than 30 minutes to run, use command

sqsub -q serial -o myprog.out -r 30m octave myprog.m

Octave's syntax is almost 99% compatible with MATLAB. Some minor modifications, however, might be necessary in some cases.

Details regarding installation/configuration MATLAB and examples can be found here [SHARCNET MATLAB PCT