SGE array Job Example

#!/bin/bash
#$ -cwd
#$ -j y
#$ -m n
#$ -l h_rt=4000
#$ -P euclid
#$ -M username@mpe.mpg.de
#$ -N <jobname>
#$ -e jobs/$JOB_NAME.$JOB_ID.$TASK_ID.err
#$ -o jobs/$JOB_NAME.$JOB_ID.$TASK_ID.out

# run 50 tasks with id of 1,3,5,etc … (i.e. step is 2) up to 100.
#$ -t 1-100:2

# limit simultaneous tasks to 20, useful to not overload the system
#$ -tc 20

# use -hold_jid <name_of_job_by_same_user|any_job_id> for postprocessing

# which task id?
echo “this is $SGE_TASK_ID in range $SGE_TASK_FIRST-$SGE_TASK_LAST:$SGE_TASK_STEPSIZE”

# start my program
./a.out -j $JOB_ID -t $SGE_TASK_ID