Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The following job script could be used to submit a MATLAB script to the cluster, using 1 core and 4.8GB of memory for 2 hours. The following assumes that you have a MATLAB script matlab_batch_example.m either in the job's working directory, or in the MATLAB search path:

Note: Do not include the  .m   extension, which is part of the  matlab_batch_example.m  filename, in the job script when calling  matlab -batch command, as shown below.

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/2021a
matlab -batch matlab_batch_example

...