sbatch(1)

NAME

sbatch - Submit a batch script to SLURM.

SYNOPSIS

sbatch [options] [script]

DESCRIPTION

sbatch submits a batch script to SLURM. The batch script may be given to sbatch through a file name on the command line, or if no file name is specified, sbatch will read in a script from standard input. sbatch exits immediately after the script is successfully transferred to the SLURM controller and assigned a SLURM job ID. The batch script is not necessarily granted resources immediately, it may sit in the queue of pending jobs for some time before its required resources become available. When the job allocation is finally granted for the batch script, SLURM runs a single copy of the batch script on the first node in the set of allocated nodes.

OPTIONS

-N, --nodes[=]<number|[min]-[max]>
    Specify the number of nodes to be used by this job step. This option accepts either a single number, or a range of possible node counts. If a single number is used, such as "-N 4", then the allocation is asking for four and ONLY four nodes. If a range is specified, such as "-N 2-6", SLURM controller may grant the batch job anywhere from 2 to 6 nodes. When using a range, either of the min or max options may be omitted. For instance, "-N 10-" means "no fewer than 10 nodes", and "-N -20" means "no more than 20 nodes". The default value of this option is one node, but other command line options may implicitly set the default node count to a higher value.

-n, --tasks[=]<number>
    sbatch does not launch tasks, it requests an allocation of resources and submits a batch script. However this --tasks option advizes the SLURM controller that job steps run within this allocation will launch a maximum of number tasks. This option, possibly with collaboration with the --cpus-per-task option, will directly impact the number of processors granted to the job allocation.

-d, --dependency[=]<jobid>
    Defer the start of this job until the specified jobid has completed. Many jobs can share the same dependency and these jobs may even belong to different users. The value may be changed after job submission using the scontrol command.

-s, --share
    The job allocation can share nodes with other running jobs. (The default shared/exclusive behaviour depends on system configuration.) This may result the allocation being granted sooner than if the --shared option was not set and allow higher system utilization, but application performance will likely suffer due to competition for resources within a node.

--exclusive
    The job allocation cannot share nodes with other running jobs. This is the oposite of --shared, whichever option is seen last on the command line will win. (The default shared/exclusive behaviour depends on system configuration.)

-t, --time[=]<minutes>
    Set a limit, in minites, on the total run time of the job allocation. If the requested time limit exceeds the partition's time limit, the job will be left in a PENDING state (possibly indefinitely). The default time limit is the partition's time limit. When the time limit is reached, the each task in each job step is sent SIGTERM followed by SIGKILL. The interval between signals is specified by the SLURM configuration parameter KillWait. A time limit of zero represents unlimited time.

-I,--immediate
    The batch script will only be submitted to the controller if the resources necessary to grant its job allocation are immediately available. If the job allocation will have to wait in a queue of pending jobs, the batch script will not be submitted.

-p, --partition[=]<partition name>
    Request a specific partition for the resource allocation. If not specified, the default behaviour is to allow the slurm controller to select the default partition as designated by the system administrator.

--contiguous
    Demand a contiguous range of nodes. The default is "yes". Specify --contiguous=no if a contiguous range of nodes is not required.

--mail-type=type
    Notify user by email when certain event types occur. Valid type values are BEGIN, END, FAIL, ALL (any state change). The user to be notified is indicated with --mail-user.

--mail-user=user
    User to receive email notification of state changes as defined by --mail-type. The default value is the username of the submitting user.

--uid[=]<user>
    Attempt to submit and/or run a job as user instead of the invoking user id. The invoking user's credentials will be used to check access permissions for the target partition. User root may use this option to run jobs as a normal user in a RootOnly partition for example. If run as root, sbatch will drop its permissions to the uid specified after node allocation is successful. user may be the user name or numerical user ID.

--gid[=]<group>
    If sbatch is run as root, and the --gid option is used, submit the job with group's group access permissions. group may be the group name or the numerical group ID.

-J, --job-name[=]<jobname>
    Specify a name for the job allocation. The specified name will appear along with the job id number when querying running jobs on the system. The default is the name of the batch script, or just "sbatch" if the script is read on sbatch's standard input.

-c, --cpus-per-task[=]<ncpus>
    Advise the SLURM controller that ensuing job steps will require ncpus number of processors per task. Without this option, the controller will just try to allocate one processor per task. For instance, consider an application that has 4 tasks, each requiring 3 processors. If our cluster is comprised of quad-processors nodes and we simply ask for 12 processors, the controller might give us only 3 nodes. However, by using the --cpus-per-task=3 options, the controller knows that each task requires 3 processors on the same node, and the controller will grant an allocation of 4 nodes, one for each of the 4 tasks.

--mincpus[=]<n>
    Specify minimum number of cpus per node.

--mem[=]<MB>
    Specify a minimum amount of real memory.

--tmp[=]<MB>
    Specify a minimum amount of temporary disk space.

-C, --constraint[=]<list>
    Specify a list of constraints. The constraints are features that have been assigned to the nodes by the slurm administrator. The list of constraints may include multiple features separated by ampersand (AND) and/or vertical bar (OR) operators. For example: --constraint="opteron&video" or --constraint="fast|faster". If no nodes have the requested features, then the job will be rejected by the slurm job manager.

-w, --nodelist[=]<node name list>
    Request a specific list of node names. The list may be specified as a comma-separated list of node names, or a range of node names (e.g. mynode[1-5,7,...]). Duplicate node names in the list will be ignored. The order of the node names in the list is not important; the node names will be sorted my SLURM.

-F, --nodefile[=]<node file>
    Much like --nodelist, but the list is contained in a file of name node file. The node names of the list may also span multiple lines in the file. Duplicate node names in the file will be ignored. The order of the node names in the list is not important; the node names will be sorted my SLURM.

-x, --exclude[=]<node name list>
    Explicitly exclude certain nodes from the resources granted to the job.

-D, --workdir[=]<directory>
    Set the working directory of the batch script to directory before it it executed.

-k, --no-kill
    Do not automatically terminate a job of one of the nodes it has been allocated fails. The user will assume the responsibilities for fault-tolerance should a node fail. When there is a node failure, any active job steps (usually MPI jobs) on that node will almost certainly suffer a fatal error, but with --no-kill, the job allocation will not be revoked so the user may launch new job steps on the remaining nodes in their allocation. By default SLURM terminates the entire job allocation if any node fails in its range of allocated nodes.

-I, --input[=]<filename pattern>
-O, --output[=]<filename pattern>
-E, --error[=]<filename pattern>
    Instruct SLURM to connect the batch script's standard input, standard output, or standard error directly to the file name specified in the "filename pattern". By default, "/dev/null" is open on the batch script's standard input and both standard output and standard error are directed to a file of the name "slurm-%j.out", where the "%j" is replaced with the job allocation number, as described below. The filename pattern may contain one or more replacement symbols, which are a percent sign "%" followed by a letter (e.g. %t). Supported replacement symbols are:
    %j  Job allocation number.
    %N  Node name. (Will result in a separate file per node.)
        -U, --account[=]<account>
            Change resource use by this job to specified account. The account is an arbitrary string. The account name may be changed after job submission using the scontrol command.
        --begin[=]<time>
            Submit the batch script to the SLURM controller immediately, like normal, but tell the controller to defer the allocation of the job until the specified time. Time may be of the form HH:MM:SS to run a job at a specific time of day (seconds are optional). (If that time is already past, the next day is assumed.) You may also specify midnight, noon, or teatime (4pm) and you can have a time-of-day suffixed with AM or PM for running in the morning or the evening. You can also say what day the job will be run, by giving a date in the form month-name day with an optional year, or giving a date of the form MMDDYY or MM/DD/YY or DD.MM.YY. You can also give times like now + count time-units, where the time-units can be minutes, hours, days, or weeks and you can tell SLURM to run the job today with the keyword today and to run the job tomorrow with the keyword tomorrow. The value may be changed after job submission using the scontrol command.
        --nice[=]<adjustment>
            Run the job with an adjusted scheduling priority. With no adjustment value the scheduling priority is decreased by 100. The adjustment range is from -10000 (highest priority) to 10000 (lowest priority). Only privileged users can specify a negative adjustment. NOTE: This option is presently ignored if SchedulerType=sched/maui.
        --no-requeue
            Specifies that the batch job should not be requeued. Setting this option will prevent system administrators from being able to restart the job (for example, after a scheduled downtime). When a job is requeued, the batch script is initiated from its beginning.
        --jobid
            Allocate resources as the specified job id. NOTE: Only valid for user root.
        -q, --quiet
            Suppress informational messages from sbatch. Errors will still be displayed.
        -v, --verbose
            Increase the verbosity of sbatch's informational messages. Multiple -v's will further increase sbatch's verbosity.
        -h, --help
            Display help information and exit.
        -u, --usage
            Display brief usage message and exit.
        -V, --version
            Display version information and exit.
        The following options support Blue Gene systems, but may be applicable to other systems as well.
        -g, --geometry[=]<XxYxZ>
            Specify the geometry requirements for the job. The three numbers represent the required geometry giving dimensions in the X, Y and Z directions. For example "--geometry=2x3x4", specifies a block of nodes having 2 x 3 x 4 = 24 nodes (actually base partions on Blue Gene).
        --conn-type[=]<type>
            Require the partition connection type to be of a certain type. On Blue Gene the acceptable of type are MESH, TORUS and NAV. If NAV, or if not set, then SLURM will try to fit a TORUS else MESH. You should not normally set this option. SLURM will normally allocate a TORUS if possible for a given geometry.
        -R, --no-rotate
            Disables rotation of the job's requested geometry in order to fit an appropriate partition. By default the specified geometry can rotate in three dimensions.

ENVIRONMENT VARIABLES
SBATCH_ACCOUNT
    Same as --account.
SBATCH_CONN_TYPE
    Same as --conn-type.
SBATCH_DEBUG
    Same as -v or --verbose.
SBATCH_GEOMETRY
    Same as -g or --geometry.
SBATCH_IMMEDIATE
    Same as -I or --immediate.
SBATCH_JOBID
    Same as --jobid.
SBATCH_JOB_NAME
    Same as -J or --job-name.
SBATCH_NO_REQUEUE
    Same as --no-requeue.
SBATCH_NO_ROTATE
    Same as -R or --no-rotate.
SBATCH_PARTITION
    Same as -p or --partition.
SBATCH_TIMELIMIT
    Same as -t or --time.

EXAMPLES
Specify a batch script by filename on the command line:
    $ cat myscript
    #!/bin/sh
    slaunch hostname |sort
    $ sbatch -N4 myscript
    salloc: Granted job allocation 65537
    $ cat slurm-65537.out
    host1
    host2
    host3
    host4
Pass a batch script to sbatch on standard input:
    morrone:~$ sbatch -N4 <<EOF
    > #!/bin/sh
    > slaunch hostname |sort
    > EOF
    sbatch: Submitted batch job 65541
    $ cat slurm-65541.out
    host1
    host2
    host3
    host4

SEE ALSO
sinfo(1), slaunch(1), sattach(1), salloc(1), squeue(1), scancel(1), scontrol(1), slurm.conf(5), sched_setaffinity(2), numa(3)