The CSF2 has been replaced by the CSF3 - please use that system! This documentation may be out of date. Please read the CSF3 documentation instead. To display this old CSF2 page click here. |
Mathematica
Overview
Mathematica is an integrated technical computing environment which combines numeric and symbolic compute engines, a graphics system, a programming language, a documentation system and connectivity to other programs. Mathematica may be used for handling complex symbolic calculations involving millions of terms, analyzing and visualizing data, numerical modeling and simulation, rapid application development, producing publication-quality output and presentations.
Version 11.1.1, 10.0.2 and 8.0.4 is currently installed on the CSF.
Set up procedure
To set up the Mathematica environment you need to issue the following command
module load apps/binapps/mathematica/11.1.1 OR
module load apps/binapps/mathematica/10.0.2 OR module load apps/binapps/mathematica/8.0.4
Running the application interactively
To run Mathematica 8 interactively you should first log into the CSF using the -X switch as follows
ssh -X -l username csf.itservices.manchester.ac.uk
Next, load the Mathematica modulefile
module load apps/binapps/mathematica/11.1.1
Finally, run Mathematica via qrsh
qrsh -V -l inter -l twoday mathematica
- Further information about how to start X-Windows and GUI applications on the CSF.
- More details concerning qrsh
Serial batch job submission
It is not possible to run Mathematica .nb files in batch mode. Instead, you must create a text-only file containing your Mathematica program. For example, create a text file called myprog.m containing the following
Table[ NIntegrate[Sin[x^n], {x, 1, 10}, MaxRecursion -> 1000] , {n, 1, 70}]
A suitable SGE submission script, mathematica_job.sge, for the above would be
#$ -cwd #$ -j y #$ -V math < myprog.m > out.txt
Note that the executable that runs your script is math (i.e. the Mathematica Kernel) and not mathematica (The notebook interface)
To run the above job you should first load the Mathematica modulefile (if you haven’t already)
module load apps/binapps/mathematica/11.1.1
and then use qsub
qsub mathematica_job.sge
Parallel batch job submission
A parallel version of myprog.m is
LaunchKernels[4]; ParallelTable[ NIntegrate[Sin[x^n], {x, 1, 10}, MaxRecursion -> 1000], {n, 1, 70}] // AbsoluteTiming CloseKernels[];
A suitable submission script is
#$ -cwd #$ -j y #$ -V ## The number on the pe line (number of cores) **must** match the number you set in LaunchKernels[] #$ -pe smp.pe 4 math < myprog.m > out.txt
Note that the only difference is the -pe
switch. Job submission is similar to that of serial jobs: Load the module and use qsub.