How to use mathematica


Mathematica can be accessed by loading the appropriate module. To see which versions of Mathematica are available use the command

ml PDC
ml spider mathemmatica
ml avail mathematica
# To view info on the module
ml show mathematica
# To load the module
ml mathematica

In order to use Mathematica you need to have a Mathematica license. KTH has a site license for KTH users, the server is

In order to access the installation of Mathematica on Dardel, please contact PDC support and request access.

When you run mathematica for the first time it needs to be activated by pointing it at the license server.

Running interactively

Mathematica can be run interactively on an allocated node or on cores allocated on a shared node. To book a single node for one hour, type:

salloc -N 1 -t 1:00:00 -A pdc.staff -p main
# wait for a node to be reserved

A typical output will look like:

salloc: Granted job allocation 591571
salloc: Waiting for resource configuration
salloc: Nodes nid001015 are ready for job

Node nid001015 is now yours for the next hour, and you can log into it and start Mathematica. On Dardel you can login to the reserved node via the login node:

ssh -X nid001015

and then start Mathematica with:

ml PDC/22.06
ml mathematica/13.0.1

In case you do not need a full node with 128 cores, you could request cores in the shared partition. These cores are shared with other users, with the amount of memory provided proportional to the number of cores awarded.:

salloc -n 24 -t 1:00:00 -A pdc.staff -p shared

Running parallel batch jobs

You can also submit parallel workflows to the SLURM queueing system. The following job script allocates 16 cores on Dardel and runs one Mathematica program. Mathematica will parallelize the computation over different cores of the node.


#SBATCH -A pdc.staff
#SBATCH -J ker
#SBATCH -t 00:10:00
#SBATCH -p shared
#SBATCH -n 4

# load the Mathematica module
ml PDC/22.06
ml mathematica/13.0.1

# Run Mathematica with the text script <routine name>.m
math -script ker.m

Update the SLURM directives to set your project ID and the number of nodes and hours that you wish to allocate, and save the script as You can then submit the job with:



PDC takes no responsibility for the correctness of results produced with the binaries. Always evaluate the binaries against known results for the systems and properties you are investigating before using the binaries for production jobs.