Matlab for HPC

BECAUSE OF MATLAB LICENSE REQUIREMENTS; ONLY NTNU EMPLOYEE AND STUDENTS CAN RUN MATLAB ON BETZY, FRAM, SAGA AND IDUN CLUSTERs

Matlab MPI (Betzy/Fram/Saga/Idun)

Distributed Matlab (Using MPI)

FAQ

A.1. Matlab Unix Group on Vilje

If you got this message: "To use matlab on vilje you must be a member of the matlab unix group ...", then you have to send a email to support-ntnu@notur.no and ask for to be a member of the Matlab Unix Group.

A.2. Random numbers

On vilje/Kongull you will see that the "rand" command generates same numbers on every started compute node in a job.
To avoid this you have to use seed command "rng" with a unique number on each compute node, and an example of finding a unique number:

Use the internal clock as.

Matlab code:

t=clock();

seed=t(6) * 1000; % Seed with the second part of the clock array.

rng(seed);

...

c=rand;

A=rand(3,3);

...

A.3 MEX

How to compile c-code into Matlab.

Load modules

-Matlab R2014a

module load gcc/4.7.4 and module load matlab/R2014a

-Matlab R2016b

module load gcc/4.9.1 and module load matlab/R2016b

Compiling:

-Sequential code:

mex mycode.c

-Openmp code

mex CC=gcc CFLAGS="\$CFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" mycode.c

Scroll to Top