High Performance Computing

Task array jobs

A powerful feature of SGE is the ability to submit array jobs. This allows you to submit a range of jobs with a single qsub. For example:

qsub -t 1-100:2 myjob.sh
This will submit 50 tasks (1,3,5,7,.. .,99). The job script knows which of the tasks it is via the $SGE_TASK_ID variable. For example a job script might look like:
#! /bin/sh
TASK=$SGE TASK ID
_ _
# Run my code for input case $TASK and output it to an
# appropriate output file.
cd /work/work1/egzcb/data
DATE=`date`
echo "This is the standard output for task $TASK on $DATE"
/work/work1/egzcb/bin/mycode.exe input.$TASK output.$TASK
This would enable a user to run the code mycode.exe taking its input from a series of input files input.1, input.3,... ,input.99 and sending the output of the run to output files.