To use Mathematica on the cluster, the job should not require input from you - as it will be running indepdentenly on a node.

Take your mathematica file (.nb) and add to the top

AppendTo[$echo,”stdout”] (this will echo your input commands - if you don't need/want to see them, you can leave out this step)

Select All Cells (e.g. Control-A), then under the 'Cell' menu, go to 'Cell Properties' and check off 'Initialization cell'. If you don't do this, the program will run, but not actually execute any of your cells!

Save as “Mathematica Package” which will have a .m extention.(for example, test_code.m)

You then need a simple job file, e.g.

#!/bin/bash #PBS -l nodes=1:ppn=8 # This next line makes sure it only uses the cores (ppn) allocated to it export OMP_NUM_THREADS=$PBS_NUM_PPN /bin/hostname /sw/csc/Mathematica/9.0/Executables/math < test_code.m > test-output.m

In this case 'test_code.m' is your input file that you just saved, and test-output.m is where the output will go (that is later read by Mathematica).

Submit this job with 'qsub myfile.job' if 'myfile.job' is the name of that 4 line example above. You can monitor the job with the 'qstat -u username' , where 'username' is the name you login with.

When the job is finished, you can run Mathematica to look at the test-output.m file. You can run Mathematica on the login node by

/usr/local/bin/mathematica

Note if you want to see graphical output, you'll need to have logged in with “ssh -X knot.cnsi.ucsb.edu”, or have used NX.