sbatch
Submit batch jobs to Slurm
TLDR
Submit a batch job
Submit a batch job with a custom name
Submit a batch job with a time limit of 30 minutes
Submit a job and request multiple nodes
SYNOPSIS
sbatch [options]
PARAMETERS
-a, --array=
Submit a job array with the specified index range (e.g., 1-10, 1,3,5).
-A, --account=
Specify the account to charge job resources to.
-c, --cpus-per-task=
Request the specified number of CPUs per task.
--chdir=
Set the working directory for the job.
-d, --dependency=
Define dependencies between jobs (e.g., afterok:12345).
-D, --workdir=
Specify the working directory of the job.
-e, --error=
Specify the file to which standard error is redirected.
-h, --hold
Submit the job in a held state (requires manual release).
-J, --job-name=
Assign a name to the job.
-l, --licenses=
Request licenses for the job.
-m, --mail-type=
Specify when to send email notifications (e.g., BEGIN, END, FAIL, ALL).
-M, --clusters=
Clusters to use.
-n, --ntasks=
Request the specified number of tasks.
-N, --nodes=
Request the specified number of nodes.
-o, --output=
Specify the file to which standard output is redirected.
-p, --partition=
Request a specific partition for the job.
-Q, --qos=
Request a specific quality of service (QOS).
-t, --time=
Set a limit on the total run time of the job. Accepted time formats include "minutes", "minutes:seconds", "hours:minutes:seconds", "days-hours", "days-hours:minutes" and "days-hours:minutes:seconds".
--wrap=
Submit a simple command line to be executed.
The path to the script file to be submitted.
DESCRIPTION
The sbatch command is used to submit a batch script to the Slurm Workload Manager for execution. Slurm manages resources in a cluster or supercomputer environment, scheduling jobs based on availability and priority.
sbatch reads the specified script (or standard input if no script is given) and submits it to the Slurm controller. The script typically contains shell commands and Slurm directives (starting with #SBATCH) that define resource requirements such as the number of nodes, CPUs, memory, and wall time.
Upon successful submission, sbatch returns a job ID, which can be used to monitor and manage the job. The script executes in the background, and output is usually redirected to a file.
sbatch provides a powerful and flexible way to manage complex computational workflows and distribute tasks across a cluster.
RETURN VALUE
Upon successful program execution, the Job ID of the job submitted is printed to standard output. Otherwise, an error message is printed to standard error.
ENVIRONMENT VARIABLES
SLURM_CONF The location of the Slurm configuration file.
SLURM_JOB_ID Job id of the running job, assigned upon job allocation.
Numerous other environment variables are set by Slurm; consult the Slurm documentation for a comprehensive list.
HISTORY
sbatch is a core command in the Slurm Workload Manager, a widely used open-source job scheduler for Linux clusters. Slurm was developed to provide resource management and job scheduling capabilities for high-performance computing (HPC) environments. Its design emphasizes scalability, reliability, and flexibility. The command has evolved through various Slurm versions to incorporate new features, improved performance, and enhanced security. It has become an indispensable tool for managing computational workloads in research and industrial settings.