Child pages
  • Mathematica
Skip to end of metadata
Go to start of metadata

Using Mathematica on the MCC

 

Categories for this softwareMath Libraries
What is MathematicaMathematica is a general purpose mathematical analysis package from Wolfram Research. It is a fully integrated technical computing system which combines powerful computing software with a convenient user interface. Mathematica's notebook format allows for the generation of cross-platform, fully customizable files that provide professional mathematically typesetting and publication-quality layout of electronic and printed media. Mathematica's features include symbolic and numeric computation, 2D and 3D data visualization, broad programming capabilities, and one-step creation of web documents. The Mathematica package can be used as a direct calculation tool or as a powerful modeling and simulation too
How to useMonash has a site license for Mathematica.  It contains inbuilt support for Parallel Execution.

 

Simple example


Here is a sample script, placed in a file called 'code.m'

Sample Mathematica Code
(* ::Package:: *)

 LaunchKernels[4];
Print[$KernelCount];
t1=ParallelTable[
{"Hello World from kernel",$KernelID}
,{i,4}];
Export["code.dat",t1];

Print [t1]
Print ["End Program"]
Exit[];

Here is the MCC job script. Here we request four computing cores as this is a multi-threaded program.

job.sh
#!/bin/sh
#$ -S /bin/sh
#$ -pe smp 4
#$ -l h_vmem=32G
#$ -l h_rt=1:00:00
#$ -cwd
#$ -j y
#$ -l h_stack=128M
#$ -m abe
#$ -M first.lastname@monash.edu

module load mathematica/9.0.1
module list

echo "before calling math"
math -script code.m

Output will look like this

Output (placed in SGE stdout file)
Currently Loaded Modulefiles:
  1) mathematica/9.0.1
before calling math
4
{{"Hello World from kernel", 4}, {"Hello World from kernel", 3}, {"Hello World from kernel", 2}, {"Hello World from kernel", 1}}
"End Program"

 

Common Problems

.

Problem 
Mathematica crashes

Even for simple programs, Mathematica requires a lot of memory. Increase the memory requested.

 

 

 

  • No labels