Skip to main content
Print

MATLAB – INTRO

MATLAB is a software for doing numerical computation, especially linear algebra. It began as a “MATrix LABoratory” program, intended to provide interactive access to the libraries Linpack and Eispack. It has since grown well beyond these libraries to become a powerful tool for visualization, programming, research, engineering, and communication. 

Make sure you have a valid MATLAB license to use the software on ARC. Here is some info from MATLAB regarding license

https://www.mathworks.com/matlabcentral/answers/102520-how-do-i-change-the-license-search-location-for-matlab 

In short, you can use the -c flag to specify a license file or server.  

First load the module: 

module load matlab/2019a 

Then start matlab – add the rest of your command for matlab after the -c flag.  

For example, 

matlab -c 2700@licenseserver.edu mymfiles.m 

Or  

matlab -c path_to_license_file mymfiles.m  

Similarly, MATLAB can be run using interactive mode by requesting a compute node and then following the steps mentioned above. 

MATLAB with GPU accelleration

MATLAB can also be used with a GPU device. In order to requisite a GPU, the following command can be used in your batch script 

#SBATCH –gpus-per-node=1 

You can then replace an array with a GPUArray according to the following. 

A = gpuArray(A) 

where A is a regular MATLAB array. This transfers the array data to the GPU memory. Then, you can use the gpuArray variable in GPU-supported built-in functions. You can find the full list of GPUs supported built-in functions from  

https://www.mathworks.com/help/parallel-computing/run-matlab-functions-on-a-gpu.html.

For more information about GPU programming for MATLAB, please read the following article from Mathworks.  

https://www.mathworks.com/help/parallel-computing/gpu-computing.html

Table of Contents