Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
| habrok:advanced_job_management:job_arrays [2024/03/14 14:32] – Minor formatting pedro | habrok:advanced_job_management:job_arrays [2026/03/27 14:09] (current) – pedro | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| In order to create a job array, start by creating the job script that you would need to run just one instance of the job. For instance, consider the following job script for running R: | In order to create a job array, start by creating the job script that you would need to run just one instance of the job. For instance, consider the following job script for running R: | ||
| - | < | + | < |
| #!/bin/bash | #!/bin/bash | ||
| #SBATCH --job-name=R_job | #SBATCH --job-name=R_job | ||
| Line 17: | Line 17: | ||
| Now suppose you want this to be run 100 times. You can simply add the array definition by adding the following line somewhere at the top of the script: | Now suppose you want this to be run 100 times. You can simply add the array definition by adding the following line somewhere at the top of the script: | ||
| - | < | + | < |
| #SBATCH --array=1-100 | #SBATCH --array=1-100 | ||
| </ | </ | ||
| Line 27: | Line 27: | ||
| So let us take it a step further: suppose we have 100 different R scripts that have to be run, which are named myscript1.r, | So let us take it a step further: suppose we have 100 different R scripts that have to be run, which are named myscript1.r, | ||
| - | < | + | < |
| #!/bin/bash | #!/bin/bash | ||
| #SBATCH --job-name=R_job | #SBATCH --job-name=R_job | ||