Platform LSF Administration Guide Version 6.2
Chapter 27
Job Arrays
Administering Platform LSF
419
Redirecting Standard Input and Output
The variables %I and %J are used as substitution strings to support file redirection for
jobs submitted from a job array. At execution time, %I is expanded to provide the job
array index value of the current job, and %J is expanded at to provide the job ID of the
job array.
Standard input
Use the -i option of bsub and the %I variable when your executable reads from
standard input. To use %I, all the input files must be named consistently with a variable
part that corresponds to the indices of the job array. For example:
input.1, input.2, input.3, ..., input.N
For example, the following command submits a job array of 1000 jobs whose input files
are named
input.1, input.2, input.3, ..., input.1000 and located in the current
working directory:
% bsub -J "myArray[1-1000]"
-i "input.%I"
myJob
Standard output and error
Use the -o option of bsub and the %I and %J variables when your executable writes to
standard output and error.
To create an output file that corresponds to each job submitted from a job array, specify
%I as part of the output file name. For example, the following command submits a job
array of 1000 jobs whose output files will be located in CWD and named
output.1,
output.2, output.3, ..., output.1000:
% bsub -J "myArray[1-1000]"
-o "output.%I"
myJob
To create output files that include the job array job ID as part of the file name specify
%J. For example, the following command submits a job array of 1000 jobs whose output
files will be located in CWD and named
output.123.1, output.123.2,
output.123.3, ..., output.123.1000. The job ID of the job array is 123.
% bsub -J "myArray[1-1000]"
-o "output.%J.%I"
myJob