[gmx-users] chaining jobs in queuing systems

Dallas B. Warren Dallas.Warren at vcp.monash.edu.au
Fri Dec 2 02:47:25 CET 2005

I pass the following command to submit a job ...

qsub -v NJOBS=##,NJOB=## script.tcsh

And the script contains the following code (plus some other stuff which
is standard anyway).  Adjust to suit your particular situation,
simulation, computer etc.  If you use a computing center, then those
that run it will be able to provide you with advice etc.  The one I use
actually wrote this script for me.


# check to ensure NJOB and NJOBS is defined
if (! $?NJOBS ) then
    $ECHO "\nNJOBS (total number of jobs in sequence) is not set -
defaulting to 1\n"
    setenv NJOBS 1
if (! $?NJOB) then
    $ECHO "\nNJOB (current job number in sequence) is not set -
defaulting to 1\n"
    setenv NJOB 1

# determine number for last job
@ lastnjob = $NJOB
@ lastnjob--
setenv LASTNJOB $lastnjob

# do correct preprocessing if first simulation block
if ( $NJOB < 1 ) then
	grompp -f md -c md_$LASTNJOB -t md_$LASTNJOB -p topology -e
md_$LASNJOB -o md_$NJOB -np ##
	tpbconv -s md_$LASTNJOB.tpr -f md_$LASTNJOB.trr -o md_$NJOB.tpr
-extend #####

# perform the simulation
sleep 5
mpirun mdrun -deffnm md_$NJOB

# Check exit status
set errstat=$?
if ($errstat != 0) then
	sleep 5
	$ECHO "\nJob number $NJOB returned an error status $errstat -
stopping job.\n"
	exit $errstat

# Now increment NJOB and submit subsequent jobs
if ( $NJOB < $NJOBS ) then
    @ njob=$NJOB
    @ njob++
    setenv NJOB $njob
    $ECHO "\nSubmitting job number $NJOB in sequence of $NJOBS jobs\n"
    qsub $PBS_JOBNAME
    $ECHO "\nFinished last job in sequence of $NJOBS jobs\n"

Catch ya,

Dr. Dallas Warren
Department of Pharmaceutical Biology and Pharmacology
Victorian College of Pharmacy, Monash University
381 Royal Parade, Parkville VIC 3010
dallas.warren at vcp.monash.edu.au
+61 3 9903 9073
When the only tool you own is a hammer, every problem begins to resemble
a nail.

More information about the gromacs.org_gmx-users mailing list