Submit Mathematica Script to Batch

We will assume that your mathematica script yourmathematicascript.m is already in the area where you intend to do your work.

1. Copy the files runmath_qsub and runmathforqsub into your work area, and do chmod +x runmath* there.

Here is runmath_qsub:

#$ -S /bin/bash

# Usage: runmath_qsub <yourmathematicascript.m>

if [ $# -ne 1 ]; then
    echo Command received: $0
    echo "Usage: ./runmath_qsub <yourmathematicascript.m>"
    exit 1
fi


WORKSPACE=/cdat/tem/user/mywork
MAIL=xyz@cornell.edu
OPTIONS="-q all.q@lnx651*,all.q@ilc32*"

qsub ${OPTIONS} -N $1 -m abe -M ${MAIL} -o ${WORKSPACE} -e ${WORKSPACE} ${WORKSPACE}/runmathforqsub ${WORKSPACE}/$1

and here is runmathforqsub:

#$ -S /bin/bash
#$ -l arch=lx24-x86

math -noprompt -run "<<$1"

2. Edit runmath_qsub to supply the proper parameters for WORKSPACE, MAIL, and OPTIONS. You will need to replace:
in WORKSPACE "/cdat/tem/user/mywork" --> your working area
in MAIL "xyz@cornell.edu" --> your mail address.

Note: OPTIONS can be set to the null string if your job is not especially computationally intensive. This will allow the job to run on the less powerful linux CPUs in the grid as well.

3. In the near future, many of the batch nodes will be converted from 32-bit SL-4 to the 64-bit SL-5 operating system. If you want your job to run on the 64-bit SL-5 nodes, replace the second line of runmathforqsub:
"#$ -l arch=lx24-x86" --> "#$ -l arch=lx24-amd64"

4. You're now ready to run jobs! In the terminal, go to your work area and type ./runmath_qsub yourmathematicascript.m, where yourmathematicascript.m represents your Mathematica script.

You will get an email when the job has started processing and when it has an error or when it finishes (This was specified by the -m abe command on the last line of runmath_qsub).

Any text-only mathematica output will be saved in the file yourmathematicascript.m.o123456 and any error messages are displayed in yourmathematicascript.m.e.123456

Acknowledgement

The above example was provided by David Curtin and edited by David Kreinick, with help from the Computer Group

This topic: Computing > WebHome > GridEngine > SubmitMathematicaJob
Topic revision: 28 Apr 2011, DevinBougie
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding CLASSE Wiki? Send feedback