Here is a short guide to start using Matlab on the HPC (High Performance Computer).

VSC Account

Make sure you followed vsc-account.

Transfer your Matlab code to the HPC

cd {your_matlab_dir}
scp * {vsc_account_number}

Compile your Matlab-code

To compile on the HPC, login first:

ssh {vsc_account_number}

On the HPC:

module load MATLAB/2022b-r5
mcc -m -R -nojvm -R -nodisplay {matlab_file}

Make a job file

cat > <<EOF
#PBS -l walltime=11:44:00
#PBS -l mem=8gb
#PBS -l nodes=1:ppn=1
#PBS -m abe

module load MATLAB/2022b-r5
./run_{matlab_file}.sh $EBROOTMATLAB

chmod +x

The jobfile descibes the runtime to maximum 11:45 hours (maximum 71:44:00), use 1 node and 1 core. With the mem parameter you can specify the amount of memory you want to reserve (in this case 4GB, if you don’t specify it, it goes to the maximum available). The output and error can be found in the… and… files.

Launch your Matlab job to the compute queue

qsub ./

Check your compute queue

qstat                # list; Q = queued, R = running 
qstat -n             # list and show the node it is running, you can ssh to this node and check with top
qdel {jobnumber}     # delete the job with the number you found with qstat
qdel all             # delete all jobs

Switch cluster

When you login you can see a lot of HPC clusters. When you want to launch your jobs to another cluster, you can instruct it before launching the qsub command e.g. to doduo:

module swap cluster/doduo