Submit a job
To submit a job on the computing platform, you must have a computing account and connect on an interactive server. Two commands allow job submission.
sbatch
allows the submission of a batch script. The needed submission syntax is explained in the example of a standard job.
srun
allows the allocation of the specified resources and runs a program or an application. When run from the command line,
srun
allows the execution of interactive jobs or, if used in a script to run various commands (multiple tasks), it allows the execution of tasks in parallel.
The srun
and sbatch
commands admit the same set of parameters, but the srun
execution, unlike sbatch
is not associated to an interactive shell. The main consequence is that the errors potentially encountered during the execution of srun
will not be reported in the output file (which is the case for sbatch
). To associate the command to a shell, use the option --pty
(see example of interactive jobs).
To monitor your job progress, please refer to the commands and tools explained in the Job monitoring chapter.
Attention
In the absence of options indicating the time -t
, the number of tasks -n
or CPUs per task -c
, and the memory --mem =
, the job submission will be refused. The upper limits of these parameters will be discussed in the Required parameters limits section.
Important
The default computing group (“account”) is the user’s main Unix group.
To know all your accounts limitations, use the command suggested in paragraph User information.
To compute on a different account than the default, use the
-A | --account=
submission option or the change group command to change your main group.
If you are sure of your syntax, but your job remains pending, please copy on a ticket to user support the message in the
REASON
field in the “squeue” command output.
Note
The job submission directory is the working directory. TMPDIR
may be used for storing large amounts of data, but it is not the default working directory. You may force Slurm to use this space, or any other space, as your workspace using the option -D | --chdir=
. Please refer also to the Computing environment page.
Essential sbatch options
You may find below a brief description of the essential sbatch
options. To browse all the available options, please refer to the command help sbatch -h
.
-n | --ntasks=
states the maximum number of parallel tasks lauched by the job. By default it corresponds to allocated CPU number. If this option is used with
srun
, then the task will be repeatedn
times.-c | --cpus-per-task=
states the number of cores per process. This option must be specified if a parent process launches parallel child processes.
--mem=
states the amount of needed memory (ex.
--mem=5G
). This option accepts only integer values (ex. do not declare--mem=5.5G
, but--mem=5500M
).-N | --nodes=
states the number of the computing servers needed.
-L | --licenses=
states the types of storage and software resources needed by the job.
-p | --partition=
allows to select the chosen partition.
-t | --time=
sets a limit on the total run time of the job allocation. Acceptable formats: “minutes”, “minutes:seconds”, “hours:minutes:seconds”, “days-hours”, “days-hours:minutes” and “days-hours:minutes:seconds”.
-A | --account=
states the group to be charged with the resources used by the job.
-a | --array=
allows the description of a job array,
,
is the separator to define a list or-
to define an interval, ex.--array=0,6,16-32
.-J | --job-name=
defines the job name.
-D | --chdir=
sets the working directory of the batch script before it is executed. The path can be specified as full path or relative path.
-o | --output=
states the file name for the standard output, by default
slurm-jobid.out
. Use%j
in the file name to include the job number and avoid the output being overwritten by successive jobs. Example:--output=<job name>-%j.out
. If left blank, the default output file will be namedslurm-%j.out
.-e | --error=
states the file name for the error messages. By default both standard output and standard error are directed to the same file.
--mail-user=
states the email to receive the chosen notifications, such as job state changes. Must contains a valid, professionnal email address. Please do not activate automatic replies during the job run-time.
--mail-type=
states the type of alert to be notified. If set, then
--mail-user
must also be set or no email will be sent.