| Version 4 (modified by , 11 years ago) ( diff ) |
|---|
MATLAB
MATLAB (matrix laboratory) is a proprietary programming language developed by MathWorks, MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, and creation of user interfaces.
You can run your Matlab codes on Cypress clusters but you can't use GUI(Graphical User Interface) on computing nodes.
Running MATLAB interactively
Start an interactive session,
Load the module
Run MATLAB on the command-line window,
You will get to the MATLAB command-line and can run MATLAB code here but no graphics.
Running MATLAB in a batch mode
You can also submit your MATLAB job to the batch nodes (compute nodes) on Cypress. To do so, please first make sure that the MATLAB module has been loaded, and then launch "matlab" with the "-nodesktop -nodisplay -nosplash" option as shown in the sample SLURM job script below.
Running MATLAB in Parallel with Multithreads
MATLAB supports multithreaded computation for a number of functions and expressions that are combinations of element-wise functions. These functions automatically execute on multiple threads if data size is large enough. Note that on Cypress, in default, MATLAB runs with a single threads, and you have to explicitly specify the number of threads in your code. For example,
In above code, the line,
defines the number of threads. The environmental variable, SLURM_JOB_CPUS_PER_NODE has the value set in SLURM script, for example,
The number of cores per process (task) is set by --cpus-per-task=10. This value goes to SLURM_JOB_CPUS_PER_NODE and you can use it to determine the number of threads used in the code.
Explicit parallelism
The parallel computing toolbox is available on Cypress. You can use up to 12 workers for shared parallel operations on a single node in the current MATLAB version. Our license does not include MATLAB Distributed Computing Server. Therefore, multi-node parallel operations are not supported.
Workers are like independent processes. If you want to use 4 workers, you have to request at least 4 tasks within a node.
CreateWorker.m is a Matlab code to create workers.
Parfor.m is a sample 'parfor' test code,
Running MATLAB with Automatic Offload
Internally MATLAB uses Intel MKL Basic Linear Algebra Subroutines (BLAS) and Linear Algebra package (LAPACK) routines to perform the underlying computations when running on Intel processors.
Intel MKL includes Automatic Offload (AO) feature that enables computationally intensive Intel MKL functions to offload partial workload to attached Intel Xeon Phi coprocessors automatically and transparently.
As a result, MATLAB performance can benefit from Intel Xeon Phi coprocessors via the Intel MKL AO feature when problem sizes are large enough to amortize the cost of transferring data to the coprocessors.
In SLURM script, make sure that option --gres=mic:1 is set and intel-psxe module as well as the MATLAB module has been loaded.
Note that
enables Intel MKL Automatic Offload (AO).
The sample cose is below:
Attachments (1)
- MatlabWorkers.jpeg (18.6 KB ) - added by 11 years ago.
Download all attachments as: .zip
