Prepare input files

About this task

LSF needs all the input files for the jobs in your job array to be located in the same directory. By default LSF assumes the current working directory (CWD); the directory from where bsub was issued.

Procedure

To override CWD, specify an absolute or relative path when submitting the job array.
Each file name consists of two parts, a consistent name string and a variable integer that corresponds directly to an array index. For example, the following file names are valid input file names for a job array. They are made up of the consistent name input and integers that correspond to job array indices from 1 to 1000:
input.1, input.2, input.3, ..., input.1000

Redirect standard input

About this task

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.

Procedure

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

Redirect standard output and error

Procedure

Use the -o option of bsub and the %I and %J variables when your executable writes to standard output and error.
  1. 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 are put in CWD and named output.1, output.2, output.3, ..., output.1000:
    bsub -J "myArray[1-1000]" -o "output.%I" myJob
  2. 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 are put 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