Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
habrok:advanced_job_management:job_arrays [2024/03/14 14:32] – Minor formatting pedrohabrok: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:
  
-<code>+<code bash>
 #!/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:
  
-<code>+<code bash>
 #SBATCH --array=1-100 #SBATCH --array=1-100
 </code> </code>
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, myscript2.r, …, myscript100.r. Now we can use the aforementioned environment variable to pick the right R script for each job: 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, myscript2.r, …, myscript100.r. Now we can use the aforementioned environment variable to pick the right R script for each job:
  
-<code>+<code bash>
 #!/bin/bash #!/bin/bash
 #SBATCH --job-name=R_job #SBATCH --job-name=R_job