Skip to end of metadata
Go to start of metadata

How to run an interactive Mathematica shell

After setting up your license file you will be able to load a Mathematica module and start an interactive job. Find out which version of Mathematica is currently available on the cluster with 

module spider mathematica


then load the desired version, for example:

module load mathematica/12.1.1


You can now submit an interactive Mathematica job using the SLURM command srun for example:

Non-graphical Mathematica
srun -c 1 --pty -t 06:00:00 -p interactive --mem=2GB math


To run Mathematica with full graphics, please first refer to our instructions for how to use X11 applications on O2. There are preliminary steps to make sure your desktop can use X11 forwarding to display graphics from O2.

After that, you can similarly submit a graphical Mathematica job. The command "mathematica" enables full graphics:

Graphical Mathematica job
srun -c 1 --pty -t 06:00:00 -p interactive --mem=2GB mathematica


How to run a batch Mathematica job

You can run Mathematica scripts as batch jobs using the SLURM command sbatch and a submission script, for example:

module load mathematica/12.1.1
sbatch my_mathematica_job.sh

when my_mathematica_job.sh is a script like

#!/bin/bash
#SBATCH -c 1                               # Request one core
#SBATCH -t 01:00:00                        # Runtime in HH:MM:SS format
#SBATCH -p short                           # Partition to run in
#SBATCH --mem=100                          # Memory total in MB (for all cores)


math -noprompt -run '<<your_mathematica_script.m'


Please check our other wiki pages to learn more about the scheduler (SLURM), the O2 cluster, the available partitions, etc.



  • No labels