-cwd
Specifies the current working directory for job execution.
Categories
io
Synopsis
bsub -cwd "current_working_directory"Description
The system creates the current working directory (CWD) if the path for the CWD includes dynamic patterns for both absolute and relative paths. LSF cleans the created CWD based on the time to live value set in the JOB_CWD_TTL parameter of the application profile or in lsb.params.
- %J - job ID
- %JG - job group (if not specified, it will be ignored)
- %I - index (default value is 0)
- %EJ - execution job ID
- %EI - execution index
- %P - project name
- %U - user name
- %G - user group
- %H - first execution host name
If the job is submitted with -app but without -cwd, and LSB_JOB_CWD is not defined, then the application profile defined JOB_CWD will be used. If JOB_CWD is not defined in the application profile, then the DEFAULT_JOB_CWD value is used.
In forwarding mode, if a job is not submitted with the -cwd option and LSB_JOB_CWD is not defined, then JOB_CWD in the application profile or the DEFAULT_JOB_CWD value for the execution cluster is used.
LSF does not allow environment variables to contain other environment variables to be expanded on the execution side.
By default, if the current working directory is not accessible on the execution host, the job runs in /tmp (on UNIX) or c:\LSFversion_num\tmp (on Windows). If the environment variable LSB_EXIT_IF_CWD_NOTEXIST is set to Y and the current working directory is not accessible on the execution host, the job exits with the exit code 2.
Examples
The following command creates /scratch/jobcwd/user1/<jobid>_0/ for the job CWD:
bsub -cwd "/scratch/jobcwd/%U/%J_%I" myjob
The system creates submission_dir/user1/<jobid>_0/ for the job's CWD with the following command:
bsub -cwd "%U/%J_%I" myprog
If the cluster wide CWD was defined and there is no default application profile CWD defined:
DEFAULT_JOB_CWD =/scratch/jobcwd/ %U/%J_%I
then the system creates: /scratch/jobcwd/user1/<jobid>_0/ for the job's CWD.