Execution: sbatch

sbatch is a means of asynchronously submitting a batch file (from which tasks will be executed) to execute on allocated resources. It is inherently asynchronous in the sense that it simply queues a script to be run on allocated resources at some point in the future; it returns with success once the job has been successfully queued. The sequence of events is:

  1. Through sbatch, the user submits a script via sbatch for later execution.
    • This script must be a text file that begins with a shebang (#!) line specifying the absolute path to an interpreter for the script.
    • The interpreter may be any executable, e.g., /bin/bash, /usr/bin/perl, /usr/bin/python. TACC recommends specifying /bin/bash or /bin/csh (but not /bin/sh) as the interpreter to ensure that a suitable environment is made available to ibrun, which is needed for MPI jobs. These shells also ensure that the module command is automatically defined. Using an interpreter that is not a shell, such as perl or python, may entail extra setup if any modules are to be loaded within the submission script.
  2. When resources become available, they are allocated to this job.
  3. A single copy of the script is executed on one node (the primary node) of the allocation.
    • It is the script's responsibility to launch any other tasks on the nodes allocated to the job.
    • The stdout and stderr streams from the script are captured by Slurm and redirected to output file(s).
  4. When the script terminates, the allocation is released.
    • The script may choose to exit with a return code. Slurm will interpret a nonzero return code as a failure.
 
©   Cornell University  |  Center for Advanced Computing  |  Copyright Statement  |  Inclusivity Statement