Matlab is commercial software and the CSIR has a site license which allows for non-commercial use on the CHPC cluster.
Please send an email to helpdesk@chpc.ac.za to request access to run Matlab M-files on the cluster. Please mention your use case and project.
The CHPC is free for students and researchers and you can apply for a normal user account on our User Portal as described in our Registrations guide.
Note that after you register as a user, you will only receive a cluster account and access to a cpu-hour allocation once a CHPC principal investigator (PI) has added you to their research programme.
If you are a student, then the PI would normally be your thesis supervisor. If they are not currently a CHPC PI, then they can register as a PI on our User Portal as described in the Registrations guide.
Matlab 2020a is available by loading the shell environment module
module load chpc/math/matlab/R2020a
Note that you must include this command in your job scripts too in order to load Matlab into your job script environment.
Note that you will only have access to the text mode user interface on the cluster. Make sure your M-files can run without needing the Matlab GUI.
Additionally, your M-files need to be able to work non-interactively to run within a job script, i.e., using matlab -batch “command”
.
This job script assumes you want to use all 24 cores on one compute node. If your job needs fewer cores then change the-l
parameter below, e.g.,-l select=1:ncpus=8:mpiprocs=8
and use-q serial
instead of thesmp
queue.
Note: set the walltime
parameter to the maximum run time you expect your job to need.
#!/bin/bash #PBS -N YOURJOBNAME #PBS -l select=1:ncpus=24:mpiprocs=24 #PBS -P YOURPROJECT #PBS -q smp #PBS -l walltime=0:30:00 CWD=/mnt/lustre/users/$USER/yourmatlabfiles/ cd $CWD echo "Working directory is" `pwd` echo module purge module load chpc/math/matlab/R2020a echo "Modules loaded:" module list |& cat echo echo "Matlab interpreter:" which matlab echo nproc=`cat $PBS_NODEFILE | wc -l` echo "nproc is $nproc" echo echo "Threads & nodes used by this job:" cat $PBS_NODEFILE | sort | uniq -c echo echo "This script is running on node" `hostname` echo echo "Starting run..." # Run matlab on the m-file hello.m matlab -batch "hello" echo echo "... done."
If the matlab -batch “hello”
command does not work then try the command
matlab -nodesktop -nojvm < ./hello.m
See the Matlab on Linux doc for more options.