Mathematica¶

Wolfram Mathematica is a software system with built-in libraries for several areas of technical computing that allows machine learning, statistics, symbolic computation, data manipulation, network analysis, time series analysis, NLP, optimization, plotting functions and various types of data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other programming languages. I
Usage¶
The Mathematica environment at DIPC can be accessed and used on our systems after loading the relevant module using the Lmod system. This can be done by issuing the following command in your terminal:
$ module load Mathematica/14.2.0
Available Versions and Modules¶
Different versions of Mathematica can be listed by using the module spider
command as shown below:
$ module spider Mathematica
This will display a list of all available Mathematica versions that can be loaded using Lmod.
Software version¶
Here you can check the available versions for Mathematica in the different clusters
Mathematica/7.0.1
Mathematica/12.1.1
Mathematica/11.0.1
Mathematica/13.2.1
Mathematica/14.2.0
Job Submission¶
Example : Running a Simple Calculation on Hyperion cluster¶
Let's walk through a basic example of running a Mathematica job on the cluster.
Step 1: Create the Batch Script¶
Create a file named simple_math.slurm
with the following content:
#!/bin/bash
#SBATCH --qos=regular
#SBATCH --job-name=simple_math
#SBATCH --cpus-per-task=1
#SBATCH --mem=4G
#SBATCH --nodes=1
#SBATCH --ntasks-per-node=1
#SBATCH --time=00:10:00
#SBATCH --output=simple_mathematica_%j.out
#SBATCH --error=simple_mathematica_%j.err
# Load the Mathematica module
module load Mathematica/14.2.0
# Run the Mathematica script
math -noprompt -run < simple_math.m
Step 2: Create the Mathematica Script¶
Create a file named simple_math.m
containing your computation:
(* Calculate the sum of integers from 1 to 100 *)
A = Sum[i, {i, 1, 100}]
(* Calculate the average of a set of numbers *)
B = Mean[{25, 36, 22, 16, 8, 42}]
(* Add these two results together *)
Answer = A + B
(* Exit Mathematica *)
Quit[];
Step 3: Submit the Job¶
Submit your job to the cluster queue with:
$ sbatch simple_math.slurm
Step 4: View Results¶
Once the job completes, the computation results will be available in the output file: simple_math_[JobID].out