Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
habrok:advanced_job_management:job_arrays [2024/03/14 14:31] – Add short notes on %a and %j pedrohabrok:advanced_job_management:job_arrays [2024/03/14 14:32] (current) – Minor formatting pedro
Line 76: Line 76:
 ===== Output and job information for job arrays ===== ===== Output and job information for job arrays =====
  
-A job array will get just one main job id, just like a regular job. However, the index values of the range will be used as suffix for the job id: <jobid>_1, <jobid>_2, etcetera. Furthermore, each job will produce its own output file with a filename like slurm_<jobid>_<index>.out. It is also possible to to provide a custom name for the slurm output file with ''$SBATCH --ouput=''. In normal circumstances a name such as ''R_job.out'' would be fine, however, with job arrays that would result in every job writing to the same output file, thus overwriting the previous one. We can get around his by using ''%j'' and ''%a'', which here will be replaced with the job ID and array index, which would look like: ''$SBATCH --ouput=R_job_%j_%a.out''+A job array will get just one main job id, just like a regular job. However, the index values of the range will be used as suffix for the job id: <jobid>_1, <jobid>_2, etcetera. Furthermore, each job will produce its own output file with a filename like slurm_<jobid>_<index>.out. It is also possible to to provide a custom name for the slurm output file with ''$SBATCH --ouput=''. In normal circumstances a name such as ''R_job.out'' would be fine, however, with job arrays that would result in every job writing to the same output file, thus overwriting the previous ones. We can get around his by using ''%j'' and ''%a'', which here will be replaced with the job ID and array index, which would look like: ''$SBATCH --ouput=R_job_%j_%a.out''
  
-The same kind of job ids will also be used in the output of SLURM tools like squeue and sacct. The squeue command will usually try to combine the jobs in the array into a single line, e.g.:+The same kind of job ids will also be used in the output of SLURM tools like ''squeue'' and ''sacct''. The ''squeue'' command will usually try to combine the jobs in the array into a single line, e.g.:
  
 <code> <code>
Line 85: Line 85:
 </code> </code>
 \\ \\
-If you want to get each job of the array to appear on a separate line, you can pass the ''-r'' or ''—array'' option to squeue.+If you want to get each job of the array to appear on a separate line, you can pass the ''-r'' or ''—array'' option to ''squeue''.
  
 ===== Cancelling job arrays ===== ===== Cancelling job arrays =====