Job arrays are an easy way to submit multiple similar jobs. Each member of the job array, called a subjob, is associated with a unique index that is defined in the Linux environment variable $PBS_ARRAYID by the job manager Torque.

Submitting Job Arrays

A job array can be submitted by adding

#PBS -t 1-10

to the job script where 1 and 10 are the job array bounds.

You can also provide a comma-separated list for the array values

#PBS -t 5,10,15,20,25

Limiting the number of tasks that can run at one time

You can limit the tasks by appending the %N suffix where N is the number of active tasks at any one time. for example

#PBS -t 1-100%10

will create a 100 task job array with 10 tasks active at any given time.

Using the Array ID Index

The environment variable $PBS_ARRAYID in the job script can be used to define input and output arguments for the task. Suppose you want to run the same program 100 times, each time using a different input file. This is most easily done by naming the input files with a number in it, as in file-1, file-2, etc. A sample PBS script that uses a job array to run the same executable with 100 different input files would look like:

#!/bin/bash -l
#PBS -N yourjobname
#PBS -q default
#PBS -l nodes=1:ppn=1
#PBS -l walltime=2:00:00
#PBS -t 1-100
./myprogram file-${PBS_ARRAYID}

Viewing Job Information

Each job is also assigned a specific  job-id of the form


The user can check the status of the jobs with

qstat -t 1-100 jobid[]

To view the status of individual jobs

qstat jobid[array_id]

Deleting Job Arrays and Tasks

Delete individual jobs with

qdel jobid[array-id]

and delete all the jobs with

qdel -t 1-100 jobid[]

Another option is to specify a range of jobs (running and/or waiting)

qdel -t 3-5 jobid[]

will delete the jobs with index 3, 4, 5 from the list.
Note: it is important to specify the square bracket in the commands, as in the previous examples.

Job Output Files From a Job Array

The job output files from a job array will be of the from