Difference between revisions of "Job Arrays"
(→EXAMPLE QSUB SCRIPT) |
(→Job Array Example) |
||
Line 1: | Line 1: | ||
− | + | Making a new copy of the script and then submitting each one for every input data file is time consuming. An alternative is to make a job array using the -t option in your submission script. The -t option allows many copies of the same script to be queued all at once. You can use the PBS_ARRAYID to differentiate between the different jobs in the array. | |
+ | The amount of resources you specify in the QSUB script is the amount of resources the script gets each time it is called. | ||
− | + | Lets say you want to run 16 jobs. Instead of submitting 16 different jobs, you can submit one job, but use the -T parameter and the PBS_ARRAYID variable. | |
+ | <pre>#PBS -T 0-15</pre> | ||
− | + | The -T parameter sets the range of the PBS_ARRAYID variable. So setting it to | |
+ | <pre>#PBS -T 0-4</pre> | ||
+ | will cause the qsub script to call the script 5 times, each time updating the PBS_ARRAYID, from 0 to 4 | ||
+ | |||
+ | You will need to have an additional script or configuration file to use the | ||
− | |||
Line 18: | Line 23: | ||
#PBS -M youremail@illinois.edu | #PBS -M youremail@illinois.edu | ||
#PBS -m abe | #PBS -m abe | ||
− | #PBS -N | + | #PBS -N array_of_perl_jobs |
+ | #PBS -t 0-15 | ||
# ----------------Load Modules-------------------- # | # ----------------Load Modules-------------------- # | ||
− | module load | + | module load perl/5.16.1 |
# ----------------Your Commands------------------- # | # ----------------Your Commands------------------- # | ||
− | perl | + | perl job.pl $PBS_ARRAYID</pre> |
+ | |||
+ | ==Example Perl Script == | ||
+ | <pre> | ||
+ | #!/bin/env perl | ||
+ | #This script echos | ||
+ | use strict; | ||
+ | my $argument = shift @ARGV; | ||
+ | print "This is job number $argument\n"; | ||
+ | </pre> |
Revision as of 10:22, 13 March 2014
Making a new copy of the script and then submitting each one for every input data file is time consuming. An alternative is to make a job array using the -t option in your submission script. The -t option allows many copies of the same script to be queued all at once. You can use the PBS_ARRAYID to differentiate between the different jobs in the array. The amount of resources you specify in the QSUB script is the amount of resources the script gets each time it is called.
Lets say you want to run 16 jobs. Instead of submitting 16 different jobs, you can submit one job, but use the -T parameter and the PBS_ARRAYID variable.
#PBS -T 0-15
The -T parameter sets the range of the PBS_ARRAYID variable. So setting it to
#PBS -T 0-4
will cause the qsub script to call the script 5 times, each time updating the PBS_ARRAYID, from 0 to 4
You will need to have an additional script or configuration file to use the
Example Qsub Array Script[edit]
#!/bin/bash # ----------------QSUB Parameters----------------- # #PBS -S /bin/bash #PBS -q default #PBS -l nodes=1:ppn=2,mem=1000mb #PBS -M youremail@illinois.edu #PBS -m abe #PBS -N array_of_perl_jobs #PBS -t 0-15 # ----------------Load Modules-------------------- # module load perl/5.16.1 # ----------------Your Commands------------------- # perl job.pl $PBS_ARRAYID
Example Perl Script[edit]
#!/bin/env perl #This script echos use strict; my $argument = shift @ARGV; print "This is job number $argument\n";