From Documentation
Revision as of 14:15, 4 April 2012 by Isaac (Talk | contribs)

Jump to: navigation, search
MATLAB PCT
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


1. SHARCNET License

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].

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.

3. The University of Western Ontario Site License

Users in UWO with access to UWO 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

matlab

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 UWO users only. Users must have the same username as their UWO username in order to use the UWO MATLAB site license. For details, please refer to the UWO MATLAB site license page[5] at UWO ITS's web site.

If you see a license error, contact bge@sharcnet.ca for immediate attention or submit a ticket though SHARCNET web portal.

4. 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 hahn@sharcnet.ca to get it fixed (or open a ticket on the SHARCNET website.)

5. 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 run_myprog.sh. 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 ./run_myprog.sh [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/R2011a/bin:$PATH
export LD_LIBRARY_PATH=/opt/sharcnet/gcc/4.2.4/lib64:/opt/sharcnet/local/matlab/R2011a/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 ./run_myprog.sh /opt/sharcnet/local/matlab/R2011a [arguments]

6. 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[6]. 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