Job Arrays - Run multiple similar jobs simultaneously
Job array is an efficient way to submit and manage a collection of jobs that differ from each other by only a single index parameter. All jobs in a job array should have the same resource request (ex. size, time, etc.). For example, in the task below we wish to run python script "hello.py" ten times, each with a different input parameter for. Instead of creating 10 separate Slurm job scripts and submitting them separately, we can create an array job in a script and submit it once for all.
-
Creat Python script file "hello.py" as show below.
hello.py
1 2 3 4 5 6 7 |
|
-
Creat a job array script file "hello.sb" as show below.
hello.sb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
- Submit the job array as shown in following line:
1 |
|
Now you can see there are 10 jobs submitted into your job queue.
This example was modified from the example at: https://rcpedia.stanford.edu/topicGuides/jobArrayPythonExample.html
User can also download job array examples from our collection of examples by running following commands:
1 2 |
|
A directory named "basic_array_job" containing two simple examples of job array will be downloaded to user's current directory.