From Documentation
Jump to: navigation, search
(MATLAB Compiler 'mcc')
m (Introduction)
Line 7: Line 7:
 
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.
 
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.
+
Please note that SHARCNET DOES NOT have standalone MATLAB license – only a server side PCT license. This means users cannot run traditional, non-PCT/DCE MATLAB codes on SHARCNET systems unless otherwise licensed.
  
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). 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 <b>mcc</b>, and run the compiled code as regular jobs without further license check (see site specific license session below for details).
+
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). If you have access to the site license at your home institution, you may run MATLAB jobs by compiling your MATLAB code into executable binaries using MATLAB the compiler, <b>mcc</b>, and run the compiled code as regular jobs without further license check (see site specific section below for details).
  
 
==SHARCNET MATLAB PCT License==
 
==SHARCNET MATLAB PCT License==

Revision as of 12:08, 13 November 2013

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


Introduction

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 – only a server side PCT license. This means users cannot run traditional, non-PCT/DCE MATLAB codes on SHARCNET systems unless otherwise licensed.

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). If you have access to the site license at your home institution, you may run MATLAB jobs by compiling your MATLAB code into executable binaries using MATLAB the compiler, mcc, and run the compiled code as regular jobs without further license check (see site specific section below for details).

SHARCNET MATLAB PCT License

General Notes

  • MATLAB PCT is not intended to run regular sequential MATLAB code but 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 clusters remotely.
  • You have to make sure that your code is efficient to run in parallel using PCT, you can do a performance benchmark on your local machine (PC or whatever machine) as the PCT can run easily via 'matlabpool' on a local multicore machine. You can compare the runtimes (walltime) for 1-cpu/worker (the sequential code) and multiple cpus/workers such as 4 cpus (numprocs=4) and provide us the performance results.
  • We only grant access to those who can provide reasonable performance results.
  • Due to license seeds limitation, we advise user to run 4-cpu or up to 8-cpu (if performance allows) PCT jobs and a few jobs at a time on Sharcnet systems. Otherwise, users may suffer from license checkout error if one or two users used most/all license seeds.

Configuration and Examples

A one time client-side configuration for using the remote resource scheduler on the cluster is required. Details regarding installation/configuration MATLAB PCT and examples can be found from

Using SHARCNET MATLAB PCT.

Western University Site License

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

Version Selection

To use MATLAB, first load the module

module load matlab

Job Submission

Interactive job is discouraged. To run 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

General Notes

MATLAB Compiler 'mcc'

If you need to run the same code for a number of jobs, i.e., serial farm jobs, you can compile your MATLAB code using 'mcc'. The command to compile code myprog.m will be

mcc -m -R ' -nosplash -nodisplay -nodesktop -nojvm -singleCompThread' 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.3 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.3.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

Helps

  • 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, please open a ticket on the SHARCNET webpotal submit ticket or contact the local staff for immediate attention.

University of Waterloo Site License

Users in UW who have access to UW MATLAB site license UW_IST can run standard MATLAB on orca.

Version Selection

The version is 2012b available on orca, user side PATH setting is not needed.

Job Submission

  • Prepare a job directory for matlab, i.e., /work/yourid/matlab.
  • Copy the sample executable and test files
cd /work/yourid/matlab 
cp ~jemmyhu/Matlab/uwmatlab .
cp ~jemmyhu/Matlab/matlab_test.m
  • Using 'sqsub' to submit the job into the default serial queue
sqsub –r 1.0d -o matlab_test.log -i matlab_test.m ./uwmatlab

A few simple examples can be found in

/home/jemmyhu/matlab/

General Notes

MATLAB Compiler 'mcc'

The steps to use 'mcc' and run serial farming MATLAB jobs for UW site license on orca are

  • 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

  • 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
ssh orc-dev1
cd /work/yourid/matlab
mcc -m -R ' -nosplash -nodisplay -nodesktop -nojvm -singleCompThread' myprog
#for multiple .m files, use all in mcc
mcc -m -R ' -nosplash -nodisplay -nodesktop -nojvm -singleCompThread' cod21.m code2.m ...
  • Run myprog as a standard serial job using sqsub from login node, using 3GB memory.
sqsub --mpp=3g -r 1.0h -o run_myprog.log ./run_myprog.sh /opt/sharcnet/local/matlab/R2012b [arguments]

Helps

  • If you have any questions/concerns or see a license error, please open a ticket on the SHARCNET webportal submit ticket.

McMaster University Site Licence

For McMaster users who have contributed to the campus license pool, MATLAB is available on Wobbie, Iqaluk and Requin.

Version Selection

To use MATLAB, first load the module

module load matlab

Job Submission

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

General Notes

MATLAB Compiler 'mcc'

After 'module load matlab', you can compile your MATLAB code myprog.m with command

mcc -m -R '-nosplash,-nodisplay,-nodesktop,-nojvm,-singleCompThread' 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. You may wish to omit the "singleCompThread" if your code can effectively use multiple threads.

To run the executable, you must load the GCC module 4.3 or newer. To resolve a possible conflict, you will need to unload the default compiler module as suggested before you attempted to load a GCC module:

module unload pathscale

and then load the GCC module

module load gcc/4.3.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/R2012b

Helps

  • MATLAB license access on Requin 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, open a ticket on the SHARCNET website submit ticket or email hahn@sharcnet.ca to get it fixed.

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

References

o The Mathworks Homepage
http://www.mathworks.com/

o Parallel Computing Toolbox Main
http://www.mathworks.com/products/parallel-computing/

o Submit Matlab Jobs to Sharcnet using Desktop Client
https://www.sharcnet.ca/help/index.php/Using_MATLAB