Parrallelizing on Hoffman

From Center for Cognitive Neuroscience
Jump to navigation Jump to search

This assumes you understands the SGE Commands [ Hoffman_Queues ]


[ https://sites.google.com/site/parallelcomputingtutorials/slides Hoffman2 Programming Classes]

Job Arrays

Stolen from Job Arrays

The Sun Grid Engine (SGE) has a job array option, which lets you submit multiple jobs with a single command file. Syntax for this magical wizard is:

#$ -t lower-upper:interval


example Command:

qsub -cwd -V -t 1-2:1 hellotask.sh

File: hellotask.sh

#!/bin/sh

echo "Task id is $SGE_TASK_ID"
if [ -e $HOME/JOBARRAY/data$SGE_TASK_ID.in ]; then
    while read file
    do
        echo "hello $file"
    done < $HOME/JOBARRAY/data$SGE_TASK_ID.in
fi


File: data1.in

first
second

File: data2.in

third
fourth

When the value of $SGE_TASK_ID is 1, the hellotask.sh script will output:

Task id is 1
hello first
hello second

When it is 2, the output will look like:

Task id is 2
hello third
hello fourth