An integrated environment for numerical computing

Running Mathematica via Your Web Browser

Princeton Virtual Desktop

If you are most comfortable with Microsoft Windows and only need a single CPU-core, consider running Mathematica using the Princeton Virtual Desktop. Choose "Student Labs" then "Mathematica". Central OIT maintains this service, so please open a Support Ticket with issues.

Learn More about Princeton Virtual Desktop.

Research Computing OnDemand

Mathematica is available through a web portal. You will need to use a VPN to connect from off-campus (GlobalProtect VPN is recommended). If you have an account on Adroit then browse to https://myadroit.princeton.edu. To begin a session, click on "Interactive Apps" and then "Mathematica". Complete the Cluster Account Requests form if you need an account on Adroit.

Mathematica is Not Allowed on Tiger or Stellar

Mathematica can be used on Della and Adroit. It should not be used on Tiger or Stellar since those clusters are designed for large multi-node parallel jobs.

Interactive Sessions

To see the available modules on a given cluster, run this command:

$ module avail mathematica

For interactive use with the GUI you will need to enable X11 forwarding:

$ ssh -X <YourNetID>@della.princeton.edu
$ salloc --nodes=1 --ntasks=1 --mem=4G --time=00:20:00 --x11
$ module load mathematica/12.1.1
$ mathematica

To use mathematica on the command line:

$ ssh <YourNetID>@della.princeton.edu
$ salloc --nodes=1 --ntasks=1 --mem=4G --time=00:20:00
$ module load mathematica/12.1.1
$ math

See the Slurm page to learn about salloc.

Batch Jobs

Serial

Consider the trivial Mathematica script (hello_world.m):

Print["Hello, World."]

Below is a Slurm script (job.slurm) appropriate for a serial Mathematica job:

#!/bin/bash
#SBATCH --job-name=myjob         # create a short name for your job
#SBATCH --nodes=1                # node count
#SBATCH --ntasks=1               # total number of tasks across all nodes
#SBATCH --cpus-per-task=1        # cpu-cores per task (>1 if multi-threaded tasks)
#SBATCH --mem-per-cpu=4G         # memory per cpu-core (4G per cpu-core is default)
#SBATCH --time=00:01:00          # total run time limit (HH:MM:SS)
#SBATCH --mail-type=begin        # send email when job begins
#SBATCH --mail-type=end          # send email when job ends
#SBATCH --mail-user=<YourNetID>@princeton.edu

module purge
module load mathematica/12.1.1

math -run < hello_world.m

Submit the job with:

$ sbatch job.slurm

Parallel

Consider the trivial parallel Mathematica script (simple_par.m):

Print[ParallelEvaluate[$KernelID]]
Print[ParallelEvaluate[$ProcessID]]

Below is a sample Slurm script (job.slurm) that is appropriate for a parallel job:

#!/bin/bash
#SBATCH --job-name=myjob         # create a short name for your job
#SBATCH --nodes=1                # node count
#SBATCH --ntasks=1               # total number of tasks across all nodes
#SBATCH --cpus-per-task=4        # cpu-cores per task (>1 if multi-threaded tasks)
#SBATCH --mem-per-cpu=4G         # memory per cpu-core (4G per cpu-core is default)
#SBATCH --time=00:01:00          # total run time limit (HH:MM:SS)
#SBATCH --mail-type=begin        # send email when job begins
#SBATCH --mail-type=end          # send email when job ends
#SBATCH --mail-user=<YourNetID>@princeton.edu

module purge
module load mathematica/12.1.1

math -run < simple_par.m

Submit the job with:

$ sbatch job.slurm

FAQ

1. How should I resolve this error: Put::noopen: Cannot open /home/<YourNetID>/.Mathematica/ApplicationData/CloudObject/Authentication/properties.wl.?

Try creating that file then re-run your code:

$ mkdir -p /home/<YourNetID>/.Mathematica/ApplicationData/CloudObject/Authentication
$ touch /home/<YourNetID>/.Mathematica/ApplicationData/CloudObject/Authentication/properties.wl.

2. How can I install Mathematica on my laptop?

See the Mathematica page by OIT.