University of Pretoria
Operational / Internal Site

Octave simulations with SLURM

The following provides a template for Octave simulations. Although the Octave available on the cluster nodes is compiled with OpenMP support, Octave by default only uses 1 CPU. The template therefore only reserves one CPU. If you make use of a third-party toolbox which does use multiple CPUs you will have to modify the template (similar to the multi-threaded MATLAB example).

Single CPU example

The following will run the single_example.m script in the current directory, using a single Octave computational thread (i.e. one CPU).

#SBATCH --output=<CHANGETHIS>.log
#SBATCH --cpus-per-task=1
#SBATCH --mem-per-cpu=1000
#SBATCH --mail-type=END
#SBATCH --mail-user=<CHANGETHIS>
# Run simulation
srun octave --no-window-system single_example.m

Disabling workspace dump file

When running large numbers of Octave simulations from the same directory, an issue arises when these jobs terminate at the same or nearly the same time. In particular, if the jobs are all cancelled at the same time they all attempt to write to the same workspace file causing filesystem problems.

To avoid this problem, and in general when using Octave, add the following to the top of your Octave script file: