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:
- Through
sbatch
, the user submits a script viasbatch
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 toibrun
, which is needed for MPI jobs. These shells also ensure that themodule
command is automatically defined. Using an interpreter that is not a shell, such asperl
orpython
, may entail extra setup if any modules are to be loaded within the submission script.
- This script must be a text file that begins with a shebang (
- When resources become available, they are allocated to this job.
- 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).
- 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.