This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
howto:matlab [2025/03/06 12:23] kevin created |
howto:matlab [2025/05/22 16:56] (current) kevin [Example job script] |
||
|---|---|---|---|
| Line 4: | Line 4: | ||
| Matlab is commercial software and the CSIR has a site license which allows for non-commercial use on the CHPC cluster. | Matlab is commercial software and the CSIR has a site license which allows for non-commercial use on the CHPC cluster. | ||
| + | |||
| + | ===If you are already a CHPC user:=== | ||
| Please send an email to helpdesk@chpc.ac.za to request access to run Matlab M-files on the cluster. | Please send an email to helpdesk@chpc.ac.za to request access to run Matlab M-files on the cluster. | ||
| + | |||
| + | ===If you are not a CHPC user and would like to apply to be one:=== | ||
| + | |||
| + | The CHPC is free for students and researchers and you can apply for a //normal user// account on our [[https:// | ||
| + | |||
| + | 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// | ||
| + | |||
| + | If you are a student, then the PI would normally be your thesis supervisor. | ||
| =====Environment Module===== | =====Environment Module===== | ||
| Line 21: | Line 31: | ||
| Note that you will only have access to the text mode user interface on the cluster. | Note that you will only have access to the text mode user interface on the cluster. | ||
| - | Additionally, | + | Additionally, |
| + | |||
| + | ====Example job script==== | ||
| + | |||
| + | > This job script assumes you want to use all 24 cores on one compute node. If your job needs fewer cores then change the '' | ||
| + | |||
| + | **Note:** set the '' | ||
| + | |||
| + | <code bash> | ||
| + | # | ||
| + | #PBS -N YOURJOBNAME | ||
| + | #PBS -l select=1: | ||
| + | #PBS -P YOURPROJECT | ||
| + | #PBS -q smp | ||
| + | #PBS -l walltime=0: | ||
| + | CWD=/ | ||
| + | cd $CWD | ||
| + | echo " | ||
| + | echo | ||
| + | module purge | ||
| + | module load chpc/ | ||
| + | echo " | ||
| + | module list |& cat | ||
| + | echo | ||
| + | echo " | ||
| + | which matlab | ||
| + | echo | ||
| + | nproc=`cat $PBS_NODEFILE | wc -l` | ||
| + | echo "nproc is $nproc" | ||
| + | echo | ||
| + | echo " | ||
| + | cat $PBS_NODEFILE | sort | uniq -c | ||
| + | echo | ||
| + | echo "This script is running on node" `hostname` | ||
| + | echo | ||
| + | echo " | ||
| + | # Run matlab on the m-file hello.m | ||
| + | matlab -batch " | ||
| + | echo | ||
| + | echo "... done." | ||
| + | </ | ||
| + | |||
| + | If the '' | ||
| + | |||
| + | matlab -nodesktop -nojvm < ./hello.m | ||
| + | |||
| + | |||
| + | See the [[https:// | ||