wiki:cypress/Matlab

Version 4 (modified by fuji, 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,

Error: Failed to load processor bash
No macro or processor named 'bash' found

Load the module

Error: Failed to load processor bash
No macro or processor named 'bash' found

Run MATLAB on the command-line window,

Error: Failed to load processor bash
No macro or processor named 'bash' found

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.

Error: Failed to load processor bash
No macro or processor named 'bash' found

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,

Error: Failed to load processor matlab
No macro or processor named 'matlab' found

In above code, the line,

Error: Failed to load processor matlab
No macro or processor named 'matlab' found

defines the number of threads. The environmental variable, SLURM_JOB_CPUS_PER_NODE has the value set in SLURM script, for example,

Error: Failed to load processor bash
No macro or processor named 'bash' found

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.

No image "MatlabWorkers.jpg" attached to cypress/Matlab

Error: Failed to load processor bash
No macro or processor named 'bash' found

CreateWorker.m is a Matlab code to create workers.

Error: Failed to load processor matlab
No macro or processor named 'matlab' found

Parfor.m is a sample 'parfor' test code,

Error: Failed to load processor matlab
No macro or processor named 'matlab' found

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.

Error: Failed to load processor bash
No macro or processor named 'bash' found

Note that

Error: Failed to load processor bash
No macro or processor named 'bash' found

enables Intel MKL Automatic Offload (AO).

The sample cose is below:

Error: Failed to load processor matlab
No macro or processor named 'matlab' found

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.