[torqueusers] Can I submit multiple jobs using a single script file?

Gareth.Williams at csiro.au Gareth.Williams at csiro.au
Tue Oct 5 16:34:57 MDT 2010


> -----Original Message-----
> From: Glen Beane [mailto:glen.beane at gmail.com]
> Sent: Wednesday, 6 October 2010 2:31 AM
> To: Torque Users Mailing List
> Subject: Re: [torqueusers] Can I submit multiple jobs using a single
> script file?
> 
> On Tue, Oct 5, 2010 at 5:16 AM, 정지욱 <librasonatine at gmail.com> wrote:
> > Hi,
> > I made up linux cluster using torque 2.4.8.
> > I need to submit many jobs at the same time.
> > But, using qsub, I can make only one job for each 1 script file.
> > I want to distribute many jobs to many nodes at a time using only one
> script
> > file.
> > Is it possible to submit mutiple jobs using a single script file?
> > Using background job(&), It's too heavy to run at a single node...
> > It's very inconvenient to make script files for each command line.
> >
> > How can I submit multiple jobs using a single script file?
> >
> > example : batch.sh
> > ------------------------------------------------------
> > #!/bin/bash
> > #PBS -l nodes=1:ppn=1
> > cd $PBS_O_WORKDIR
> > cmd option1
> > cmd option2
> > cmd option3
> > -------------------------------------------------------
> > cmd is executable filename. option# is a parameter
> >
> > Can I run three jobs at different nodes using 1 script file?
> >
> > Thank you.
> 
> 
> you could use job arrays.  you would have to wrap your commands in an
> if-else block and test the value of the environment variable
> $PBS_ARRAYID to determine which command to run

You could also take the simple approach of passing a variable to the script 
with the -v option.  For example:
#!/bin/bash
#PBS -l nodes=1:ppn=1
cd $PBS_O_WORKDIR
cmd $OPTION

and a bash loop to submit 3 jobs:
for MY_OPT in option1 option2 option3; do
  qsub -v OPTION=$MY_OPT batch.sh
done

-- Gareth


More information about the torqueusers mailing list