User Tools

Site Tools


matlab

**This is an old revision of the document!**

Matlab

Matlab is a matrix-oriented computing language. UA/Fayetteville has a campus-wide license. We have permission from Mathworks to serve this program to in-state users but not to users outside of Arkansas who are not affiliated with UAF.

The GUI version of Matlab is best accessed via interactive batch job on OpenOnDemand (pinnacle-portal). The text version may be accessed via batch job or interactive batch job with terminal.

Usually the latest installed version is the best, though multiple older versions are installed.

module load matlab/r2022a
GPU computing

Matlab in recent years has recently added a number of modern features such as GPU support, big data analysis and machine learning. A simple benchmark follows for CPU vs GPU code.

$ cat eigcpu.m
a=rand(32768,32768);
b=zeros(size(a));
tic;
b = eig(a);
toc;
quit()
$ matlab -nodesktop -nosplash < eigcpu.m

This requires about 2700 seconds on 32-core Intel nodes and 5300 seconds on 64-core AMD nodes. Matlab matrix functions make extensive use of Intel MKL and are often more performant on Intel systems. Also Intel AVX512 functions not present on AMD may be significant.

The GPU version is selected in code, commands are the same. Initializing the first array as gpuArray is sufficient to use the available GPU functions, see https://www.mathworks.com/help/parallel-computing/gpu-computing-in-matlab.html GPU and CPU multithreading are more effective on functions such as eig() than in serial Matlab code.

$ cat eiggpu.m
a=gpuArray(rand(32768,32768));
b=zeros(size(a));
tic;
b = eig(a);
toc;
quit()
$ matlab -nodesktop -nosplash < eiggpu.m

This requires about 850 seconds on V100 gpu nodes and 700 seconds on A100 single gpu nodes.

Parallel Computing

Matlab has several forms of parallel computing. Many functions are multithreaded. Many matrix functions are implemented in Intel MKL which is also multithreaded. Explicit parallel computing is available with parallel toolbox/parallel server, see https://www.nrel.gov/hpc/eagle-software-matlab-pct.html for an example on a similarly-configured cluster. The configuration is simpler on a single node (to Matlab, parallel toolbox or the local cluster) as in the NREL example.

See also https://www.cs.usask.ca/~spiteri/CMPT851/notes/parallelMatlab.pdf

https://research.unsw.edu.au/document/UNSW_Parallel%20Computing%20with%20MATLAB.pdf

matlab.1654442922.txt.gz · Last modified: 2022/06/05 15:28 by root