Mathematica Sample Scripts
In order to submit a job to the cluster you need to write a script file similar to the one below. Lines beginning with “##” represents comments. Replace the username in the directory structure to your username and the email address to your email address. Change the Mathematica Script File Name to the name of the Mathematica file that you want to be executed on the cluster.
You may replace every occurrence of the file name “Mathematica-Job1” in the file with your own choice of file name.
Example Mathematica PBS Submission Script (/apps/samples/PBS/mathematica.pbs)
###### Select resources #####
#PBS -N Math-Job1
#PBS -l ncpus=1
#PBS -l mem=4g
#PBS -l walltime=100:00:00
#### Output File #####
#PBS -o /home/username/DirectoryName/Mathematica-Job1.out
#### Error File #####
#PBS -e /home/username/DirectoryName/Mathematica-Job1.err
##### Queue #####
#pbs -q workq
##### Mail Options #####
#PBS -m abe
#PBS -M EmailAddress@cqu.edu.au
##### Change to current working directory #####
cd /home/username/DirectoryName
##### Execute Program #####
. /etc/profile.d/modules.sh
module load x11
export DISPLAY=`cd /home/username/.vnc ; ls einstein\:?.pid | awk -F. ‘{print $1}’`
math < MathematicaScriptFileName.m
To submit a job, simply execute the command:
qsub [pbs_script_file]
Handy commands, to check if your job is running, queued or completed is by using one of the following commands:
qstat -an
qusers
myjobs