Mathematica on Biowulf

Mathematica is software for mathematical calculations, data analysis, and plotting. It supports both symbolic work, such as simplifying expressions and solving equations, and numerical calculations. Its notebook interface keeps code, results, plots, and explanatory text together in one document. Starting with version 14.1, Mathematica runs through an application called Wolfram.

Running the Mathematica GUI Interactively

To run the Mathematica graphics interface, a graphic connection is required, preferably using the HPC OnDemand web interface.

Allocate an interactive session and run the program.
Sample session (user input in bold):

[user@biowulf]$ sinteractive --mem=8g --cpus-per-task=4
salloc.exe: Pending job allocation 46116226
salloc.exe: job 46116226 queued and waiting for resources
salloc.exe: job 46116226 has been allocated resources
salloc.exe: Granted job allocation 46116226
salloc.exe: Waiting for resource configuration
salloc.exe: Nodes cn3144 are ready for job
[user@cn3144 ~]$ module load mathematica
[+] Loading mathematica 15.0.1  on cn0141 

[user@cn0141 ~]$ mathematica &

You should see the Mathematica Welcome Screen as below:

Mathematica Welcome Screen

The main Mathematica Notebook window will appear when you click on a file listed on the Welcome screen.

Run Mathematica interactively without the GUI

It is also possible to run Mathematica interactively on the command-line, without the GUI. This would be useful if you do not wish to use Xwindows, and is obviously most useful for calculations rather than interactive graphics. Sample session (user input in bold):

Allocate an interactive session and run the program.
Sample session (user input in bold):

[user@biowulf]$ sinteractive
salloc.exe: Pending job allocation 46116226
salloc.exe: job 46116226 queued and waiting for resources
salloc.exe: job 46116226 has been allocated resources
salloc.exe: Granted job allocation 46116226
salloc.exe: Waiting for resource configuration
salloc.exe: Nodes cn3144 are ready for job
[user@cn3144 ~]$ module load mathematica
[+] Loading mathematica 15.0.1  on cn3144 

[user@cn3144 ~]$ math
Wolfram 15.0.1 Kernel for Linux x86 (64-bit)
Copyright 1988-2026 Wolfram Research, Inc.

In[1]:=  data=ReadList["rmsdplot.list",{Number,Number,Number}];

In[2]:= [..enter other Mathematica commands..]

In[22]:= Exit[]
[user@cn3144 ~]$
[user@cn3144 ~]$ exit
salloc.exe: Relinquishing job allocation 46116226
[user@biowulf ~]$
Run Mathematica using a math command file

You can insert Mathematica commands into a math command file, and run that file interactively at the prompt. This is convenient if you perform the same Mathematica tasks frequently. Let us use the following Math command file test.m.

------------------------ test.m -------------------------------
A = Sum[i, {i,1,100}]
B = Mean[{25, 36, 22, 16, 8, 42}]
Answer = A + B
Print["Answer=", Answer]
Exit[]
-------------------- test.m -----------------------------------

Allocate an interactive session and run the program.
Sample session (user input in bold):

[user@biowulf]$ sinteractive
salloc.exe: Pending job allocation 46116226
salloc.exe: job 46116226 queued and waiting for resources
salloc.exe: job 46116226 has been allocated resources
salloc.exe: Granted job allocation 46116226
salloc.exe: Waiting for resource configuration
salloc.exe: Nodes cn3144 are ready for job
[user@cn3144 ~]$ module load mathematica
[+] Loading mathematica 15.0.1  on cn3144 

[user@cn3144 ~]$ math
Wolfram Kernel for Linux x86 (64-bit)
Copyright 1988-2026 Wolfram Research, Inc.

In[1]:= <<test.m

       30449
Answer=-----
         6

[user@cn3144 ~]$

Alternatively, you can type directly at the command prompt:

[user@cn3144~] math -noprompt -run "<<test.m"
"Answer="30449/6
[user@cn3144 ~]
Running Mathematica Jobs on Biowulf

Mathematica provides a seamless, integrated and automated environment for parallel computing. To submit a Mathematica job to the batch system, you must create a .m file containing the mathematica commands. The .m script will be passed to the math command in an sbatch file.

The above example can be sent to batch with the following script:

------------------------ test.sh-------------------------------
#!/bin/bash

module load mathematica

math -run < test.m > outputfile.out
--------------------end test.sh -------------------------------

Submit with sbatch test.sh

Troubleshooting

If Mathematica prompts you for an Activation Key:

Mathematica Activation Screen

Click on "Other ways to activate", and set the licenses server to badmin.cit.nih.gov.
Documentation

Wolfram Mathematica Documentation Center
Mathematica FAQs