Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: matlab -batch requires 2019a+

...

Running in batch mode

MATLAB (2019a and newer) can also be run in batch mode, I.E non-interactively. This model of execution fits nicely with HPC systems like Viking, where work can be submitted to the scheduler to be executed.

...

Code Block
languagebash
titleExample MATLAB batch mode script
#!/bin/bash
#SBATCH --job-name=matlab_batch_example        # Job name
#SBATCH --account=PROJECT-ACCOUNT-2020         # Your Viking project account code
#SBATCH --partition=nodes                      # Partition for the job
#SBATCH --ntasks=1                             # Run a single task 
#SBATCH --cpus-per-task=1                      # Number of cores per task
#SBATCH --mem=4800MB                           # Job memory request
#SBATCH --time=00:02:00                        # Time limit hrs:min:sec
#SBATCH --output=%x.log                        # Standard output and error log
#SBATCH --mail-type=ALL                        # Events to receive emails about
#SBATCH --mail-user=a.user@york.ac.uk          # Where to send mail
 
module load math/MATLAB/2018a2021a
matlab -batch matlab_batch_example

...