Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slurm: variable for max SLURM_ARRAY_TASK_ID

I have a simple slurm job file that looks like:

#!/bin/bash

#SBATCH --array=1-1000
#SBATCH -t 60:00
#SBATCH --mail-type=ALL
python cats.py ${SLURM_ARRAY_TASK_ID} 1000

That second argument is so my script know the total number of workers in this job.

I'd like to make that 1000 value into a variable though, so I don't need to hardcode the total number of workers. Is there some slurm variable for the maximum array task id in the current job?

like image 594
duhaime Avatar asked May 11 '26 11:05

duhaime


1 Answers

You can use the environment variable SLURM_ARRAY_TASK_MAX

like image 81
Carles Fenoy Avatar answered May 14 '26 19:05

Carles Fenoy