Skip over navigation

Explanation of a Shell Script for Submitting a Job

To make sure your shell scripts are executable, use

chmod +x shell

where shell is the name of your shell script.

The contents of an example shell script:

#!/bin/bashUse the bash shell for interpreting
commands.
#$ -o $HOME/subdirPut output in some subdirectory
of my home directory
#$ -j yjoin the output messages and
error messages
#$ -N jobnameGive my job "jobname". This
will be a useful in tracking
your job or deleting it
#$ -cwdsend the standard output to
your current working directory
#$-m aeMail to user on a=abort, b=begin
e=end
#$ -M emailaddresspecify your email address
#$ -l h_rt=100:00:00estimated hardware runtime.
long enough to run your job
but short enough to stop a
runaway job.
Form is hour:minute:second
echo Start `date`Put a timestamp on your program
last line

The last line must be one continuous line. The line would be of the form:

For mpich on ted with gnu compilers -
/opt/mpich/gnu/bin/mpirun -v ProgramLocation <program.input >program.output
--
For mpich on ted with pgi compilers -
/share/apps/bin/mpirun -v ProgramLocation <program.input >program.output
--
For mpich on micah with pgi compilers -
/share/apps/openmpi.pgi/bin/mpirun -v -machinefile filename -np N ProgramLocation <program.input >program.output
where filename contains the list of compute nodes
and N is the number of slots that you are requesting
--
For non-parallel code -
ProgramLocation <program.input >program.output
--
For gaussian run -
csh;$HOME/subdir/rungauss $HOME/subdir/mygaussfile.com
--
For queued matlab program -
/share/apps/bin/matlab -r inputfile

For the gaussian run we change to c-shell in order to run gaussian, rungauss is a script which sets up my gaussian run and mygaussfile.com is the input for my gaussian run. The rungauss and mygaussfile.com files are located in subdirectories under my home directory in this example.


Margaret Doll 7-2009