How to use array jobs in SLURM: Difference between revisions

From RCSWiki
Jump to navigation Jump to search
Line 7: Line 7:




 
An array job script example, <code>array_job.slurm</code>:
 
<syntaxhighlight lang=bash>
<syntaxhighlight lang=bash>
#!/bin/bash
#!/bin/bash
#SBATCH --account=def-someuser
# ============================================
#SBATCH --time=0-0:5
#SBATCH --job-name=my_array_job
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=4gb
#SBATCH --time=0-01:00:00
#SBATCH --array=1-10
#SBATCH --array=1-10
# ============================================
./myapplication $SLURM_ARRAY_TASK_ID
./myapplication $SLURM_ARRAY_TASK_ID
</syntaxhighlight>
</syntaxhighlight>

Revision as of 18:19, 22 July 2022

General

Job arrays in SLURM allow you to run many jobs using one and same job script. The job script you submit with the sbatch command does not accept any parameters. Like this:

$ sbatch array_job.slurm


An array job script example, array_job.slurm:

#!/bin/bash
# ============================================
#SBATCH --job-name=my_array_job
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=4gb
#SBATCH --time=0-01:00:00
#SBATCH --array=1-10

# ============================================
./myapplication $SLURM_ARRAY_TASK_ID