[slurm-users] SLURM_NTASKS not defined after salloc
Alexander Grund
alexander.grund at tu-dresden.de
Wed Jul 11 08:38:33 MDT 2018
Unfortunately this will not work. Example: salloc --nodes=3 --exclusive
I'm wondering, why there is a discrepancy between the environment
variables and scontrol. The latter clearly shows "NumNodes=3 NumCPUs=72
NumTasks=3 CPUs/Task=1" (yes I realize that those values are
inconsistent too, but at least it matches srun behavior (ignoring NumCPUs))
Alex
Am 11.07.2018 um 16:10 schrieb Jeffrey Frey:
> SLURM_NTASKS is only unset when no task count flags are handed to salloc (no --ntasks, --ntasks-per-node, etc.). Can't you then assume if it's not present in the environment you've got a single task allocated to you? So in your generic starter script instead of using SLURM_NTASKS itself, use an expansion with a default value of 1:
>
>
> ${SLURM_NTASKS:-1}
More information about the slurm-users
mailing list