Running multiple commands in parallel on the Sun Grid

A sample grid script to execute a simple command on the sun grid can look like this.

#$ -N jobName
#$ -S /bin/sh
#$ -cwd
myCommand

However, if one needs to run multiple independent commands in parallel, the following procedure can be followed.

Enter all the commands in a file called myCommands.in, say.

#$ -N jobName
#$ -S /bin/sh
#$ -cwd

PATH=.:$PATH
export PATH

inputFile=myCommands.in
i=1
while read inputLine
do
echo "#\\$ -N Command$i" > script$i.sh
echo "#\\$ -S /bin/sh" >> script$i.sh
echo "#\\$ -cwd" >> script$i.sh
echo "PATH=.:\\$PATH" >> script$i.sh
echo "export PATH" >> script$i.sh
echo $inputLine >> script$i.sh
$SGE_BINARY_PATH/qsub script$i.sh
i=`expr $i + 1`
done < $inputFile

HTH

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

gkrish

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today