Matlab can be used within a batch script. Here is an example batch script for running a serial Matlab program on an Oscar compute node:
This is also available in your home directory as the file:
Note the exit
command at the end which is very important to include either there or in the Matlab function/script itself. If you don't make Matlab exit the interpreter, it will keep waiting for the next command until SLURM cancels the job after running out of requested walltime. So for example, if you requested 4 hours of walltime and your actual program completes in 1 hour, the SLURM job will not complete until the designated 4 hours which results in idle cores and wastage of resources and also blocks up your other jobs.
If the name of your batch script file is matlab-serial.sh
, the batch job can be submitted using the following command: