...
Code Block | ||
---|---|---|
| ||
#!/bin/bash # The job name #SBATCH --job-name=helloworld # Set the error and output files #SBATCH --output=hello-%J.out #SBATCH --error=hello-%J.out # Set the initial working directory #SBATCH --workdirchdir=/scratch/us/usxa # Choose the queue #SBATCH -–qos=express # Wall clock time limit #SBATCH --time=00:05:00 # Send an email on failure #SBATCH --mail-type=FAIL # This is the job echo “Hello World!” sleep 30 |
...
Note |
---|
You may need to change the QOS depending on the platform. Check the queues available before submitting. |
...
Info |
---|
You can also use these options as command line arguments to sbatch. |
General directives
Directive | Description | Default |
---|---|---|
|
| A descriptive name of the job | Script name |
|
| Path to the file where standard output is redirected. Special placeholders for job id (%j) and the execution node (%N) | slurm-%j.out |
| Path to the file where standard error is redirected. Special placeholders for job id (%j) and the execution node (%N) | output value |
-- |
chdir=... | Working directory of the job. The output and error files can be defined relative to this directory | submitting directory |
|
| Quality of Service (or queue) where the job is to be submitted. Check the available queues for the platform. | normal |
|
| Wall clock limit of the job. Note that this is not cpu time limit The format can be: m, m:s, h:m:s, d-h, d-h:m or d-h:m:s | qos default time limit |
--mail-type= |
<type> | Notify user by email when certain event types occur. Valid values are: BEGIN, END, FAIL, REQUEUE and ALL | disabled |
--mail-user= |
<email> | email address to send the email | submitting user |
| Project account for resource accounting and billing purposes. | default project account for the user |
Directives for non-serial jobs
Note |
---|
These directives are not available for ECGATE or Linux Clusters outside a parallel queue |
Directive | Description | Default |
---|---|---|
|
| Allocate resources for the specified number of parallel tasks. Note that a job requesting more than one must be submitted to a parallel queue. There might not be any parallel queue configured on the cluster | 1 |
| Allocate <nodes> number of nodes to the job | 1 |
| Allocate <threads> number of cpus for every task. Use for threaded applications. | 1 |
| Allocate a maximum of <tasks> tasks on every node. | node capacity |
| Allocate <threads> threads on every core (HyperThreading) | core thread capacity |
Tip |
---|
See man sbatch or https://slurm.schedmd.com/sbatch.html for the complete list of directives |
Info |
You can also use these options as command line arguments to sbatch. |
Job variables
Inside a job, you can benefit from some variables defined by SLURM automatically. Some examples are:
- SLURM_JOBID
- SLURM_NODELIST
SLURM_SUBMIT_DIR
Job arrays
...
Job arrays offer a mechanism for submitting and managing collections of similar jobs quickly and easily. The array index values are specified using the --array or -a option of the sbatch command. The option argument can be specific array index values, a range of index values, and an optional step size as shown in the examples below. Jobs which are part of a job array will have the environment variable SLURM_ARRAY_TASK_ID set to its array index value.
...