HPC Home‎ > ‎Software Guide‎ > ‎



Wolfram's Mathematica is a complete tool to perform modeling, simulation, visualization, development, documentation, and deployment. The features include:
Compute and Visualize: Numerics of any precision, symbolics, or visualization--Mathematica is the ultimate computational tool, with system-wide technology to ensure reliability, ease-of-use, and performance. Use Mathematica computation directly, as the engine in an infrastructure, or integrated into a standalone application.
Develop: Develop applets, applications, documents, or infrastructure components and systems using Mathematica's unique mix of capabilities--achieving record times on large projects or making small developments practical at all.
Document and deployment: Mathematica offers a wide range of innovative deployment options based on the Mathematica notebook. Whether your deliverables are interactive documents, applications, infrastructure components, or presentations,Mathematica notebooks are the complete solution--deployable locally or across a network.

Important Notes

  • When running the parallel version of Mathematica, request the number of processors (ppn) equal to the index value of LaunchKernels.
  • Mathematica uses network license within campus

Installed Versions

All the available versions of MATHEMATICA for use can be viewed by issuing the following command. This applies for other applications as well.
module avail mathematica
----------------------------------------------------------------- /usr/local/share/modulefiles --------------------------------------------------------------------------------------------------------

The default version is identified by "(default)" behind the module name and can be loaded as:
module load mathematica

The other versions of MATHEMATICA can be loaded as:
module load mathematica/<version>

Running Mathematica Jobs

Interactive Job Submission

Graphical Interface: Since you need to set the math font locally, probably you can use only linux box or cygwin to enable Mathematica on the cluster. 

Load the mathematica module
module load mathematica

Download math fonts to your local machine. The location of the Mathematica fonts is

Once you have it in your home directory on your local terminal, you need to execute the following commands:
xset fp+ ~/math-fonts/Fonts/Type1
xset fp rehash

Request a compute Node:
srun --x11 --pty /bin/bash 

After it logs you into one of the comp nodes or at login, type:
module load mathematica

Run Mathematica

kernel or command line only:You can run Mathematica in Command Mode (no need to have mathematica fonts installed). Request the compute node and run mathematica as in Graphical User Interface.
In[1]:= 2 + 3
Out[1]= 5
In[2]:= Exit

BatchJob Submission

Serial Batch Job
Prepare a job script "job.slurm" like the one below, where mathtest.m is a mathematica script file also included below.
#SBATCH --job-name="MathTest"
#SBATCH --time=00:01:00
#SBATCH --nodes=1
#SBATCH --tasks-per-node=2
#SBATCH -o test.o%j

module load mathematica

cp mathtest.m $PFSDIR


math -noprompt -run "<<mathtest.m"

(* ::Package:: *)

Submit the job:
sbatch job.slurm
Check the result in "t.out"

Parallel Batch Job

Mathematica will work with local node kernels to spawn kernels on each processor with OpenMP procedure, so we can launch up to 12 kernels for each job. You have to request enough processors in your slurm script to cover your usage.

Prepare a job script (parjob.slurm) like the one below, where parallel.m is a mathematica script file included below as well.
#SBATCH --job-name="test"
#SBATCH --time=00:10:00
#SBATCH --nodes=1
#SBATCH --tasks-per-node=2
#SBATCH -o math_test.o%j

module load mathematica

cp parallel.m $PFSDIR


math -noprompt -run "<<parallel.m"


(* ::Package:: *)
Parallelize[Select[Range[1000],PrimeQ[2^# - 1]&]] >>"test.out";
(Important Note: set the index value of LaunchKernels[n] equal to --cpus-per-task value in the slurm script)

Submit the job:
sbatch parjob.slurm

Check the result in "test.out"


GUI fails to launch

When the gui fails to launch when using the bare command "mathematica", it may be helpful to launch by directing the application to open a notebook. For this example, an empty file, called 'blank.nb' is created.

mathematica blank.nb


Demo of mathematica: http://www.youtube.com/watch?v=ilm14HYsl6M