Environment variables set for job execution

In addition to environment variables inherited from the user environment, LSF also sets several other environment variables for batch jobs.

LSF transfers most environment variables between submission and execution hosts.

Environment variables related to file names and job spooling directories support paths that contain up to 4094 characters for UNIX and Linux, or up to 255 characters for Windows.

Environment variables related to command names and job names can contain up to 4094 characters for UNIX and Linux, or up to 255 characters for Windows.
  • LSB_ERRORFILE: Name of the error file specified with a bsub -e.
  • LSB_EFFECTIVE_RSRCREQ: The job effective resource requirement. If the job level resource requirement was changed by the bmod -R command for a running job, the changed effective resource requirement is not available through this environment variable.
  • LSB_JOBID: Job ID assigned by LSF.
  • LSB_JOBINDEX: Index of the job that belongs to a job array.
  • LSB_CHKPNT_DIR: This variable is set each time a checkpointed job is submitted. The value of the variable is chkpnt_dir/job_Id, a subdirectory of the checkpoint directory that is specified when the job is submitted. The subdirectory is identified by the job ID of the submitted job.
  • LSB_HOSTS: The list of hosts that are used to run the batch job. For sequential jobs, this is only one host name. For parallel jobs, this includes multiple host names.
  • LSB_RESIZABLE: Indicates that a job is resizable or auto-resizable.
  • LSB_QUEUE: The name of the queue the job is dispatched from.
  • LSB_JOBNAME: Name of the job.
  • LSB_RESTART: Set to Y if the job is a restarted job or if the job has been migrated. Otherwise this variable is not defined.
  • LSB_EXIT_PRE_ABORT: Set to an integer value representing an exit status. A pre-execution command should exit with this value if it wants the job to be aborted instead of requeued or executed.
  • LSB_EXIT_REQUEUE: Set to the REQUEUE_EXIT_VALUES parameter of the queue. This variable is not defined if REQUEUE_EXIT_VALUES is not configured for the queue.
  • LSB_INTERACTIVE: Set to ‘Y’ if the job is submitted with the -I option. Otherwise, it is not defined.
  • LS_EXECCWD: Sets the current working directory for job execution.
  • LS_JOBPID: Set to the process ID of the job.
  • LS_SUBCWD: This is the directory on the submission when the job was submitted. This is different from PWD only if the directory is not shared across machines or when the execution account is different from the submission account as a result of account mapping.
  • LSB_BIND_JOB: Set to the value of binding option. But when the binding option is USER, LSB_BIND_JOB is set to the real binding decision of end user.
    Note: If the binding option is Y, LSB_BIND_JOB is set to BALANCE. If the binding option is N, LSB_BIND_JOB is set to NONE.
  • LSB_BIND_CPU_LIST: Set to the actual CPU list used when the job is sequential job and single host parallel job.

    If the job is a multi-host parallel job, LSB_BIND_CPU_LIST is set to the value in submission environment variable $LSB_USER_BIND_CPU_LIST. If there is no such submission environment variable in user's environment, LSB_BIND_CPU_LIST is set to an empty string.

The following environment variables are set only in the post job environment:
  • LSB_ACCUMULATED_CPUTIME: Job accumulated CPU time. For migrated jobs, the CPU time can be accumulated across migration runs. Job CPU time is shown to two decimal places.
  • LSB_MAX_MEM_RUSAGE: Maximum memory rusage of the job processes, not including post_exec. Always in KB.
  • LSB_MAX_SWAP_RUSAGE: Maximum swap rusage of the job processes, not including post_exec. Always in KB.
  • LSB_MAX_PROCESSES_RUSAGE: Number of processes for the job, not including post_exec.
  • LSB_MAX_THREADS_RUSAGE: Number of threads for the job, not including post_exec.
  • LSB_JOB_SUBMIT_TIME: The time that the job was submitted.
  • LSB_JOB_START_TIME: The time that the job was started. For requeued or migrated jobs, the start time is the time the job started after it was requeued or migrated. For chunk job members, it is the time the member actually starts, not the start time of the chunk.
  • LSB_JOB_END_TIME: The time that the job ended, not including post_exec.
  • LSB_JOB_PEND_TIME: Pend time for the job, in seconds, which is calculated from submit time and start time (start time - submit time). For a requeued or migrated job the pend time may be longer than its real time in PEND state, including the time for the previous run. In those cases, the pend time is the time from job submission to the time of last job start.
  • LSB_JOB_STATUS: Job status value as defined in lsbatch.h. LSB_JOB_STATUS is set to 32 for job exit and 64 for job doneb.