Bureaucrats, cc_docs_admin, cc_staff
2,879
edits
Line 13: | Line 13: | ||
$ sbatch --array=1-10 runme | $ sbatch --array=1-10 runme | ||
Submitted batch job 54321 | |||
Job 54321 will be scheduled as 10 independent tasks which may start at different times on different hosts. The individual tasks are differentiated by the value of an environment variable $SLURM_ARRAY_TASK_ID. The script can reference $SLURM_ARRAY_TASK_ID to select an input file, for example, or to set a command-line argument for the application code: | Job 54321 will be scheduled as 10 independent tasks which may start at different times on different hosts. The individual tasks are differentiated by the value of an environment variable $SLURM_ARRAY_TASK_ID. The script can reference $SLURM_ARRAY_TASK_ID to select an input file, for example, or to set a command-line argument for the application code: | ||
Line 20: | Line 20: | ||
my_app $SLURM_ARRAY_TASK_ID some_arg another_arg | my_app $SLURM_ARRAY_TASK_ID some_arg another_arg | ||
Using a job array instead of a large number of separate serial jobs has advantages for you and other users. A waiting job array only produces one line of output in squeue, making it easier for you to read its output. The scheduler does not have to analyze job requirements for each array task separately, so it can run more efficiently too. | |||
Using a job array instead of a large number of separate serial jobs has advantages for other users | |||
== Running the same script in multiple directories == | == Running the same script in multiple directories == |