Ask.Cyberinfrastructure

How do I request a node with a specific resource (like gpu) in Slurm?

gpu
slurm
scheduler
programming-for-hpc

#1

I know that my cluster has some gpus and a mix of hardware bought at different times and having different processors. How do I make sure that slurm allocates my job to specific nodes, for example, a specific node with a gpu?

CURATOR: Kristina Plazonic


#2

There are a number of options you can request with salloc, srun or sbatch that indicate which nodes or resources you would like to use. For example:

  • nodelist = list of nodes where to run e.g. --nodelist=mynodename1,mynodename2
  • nodefile = like nodelist but you specify the file with a list of nodes e.g. --nodefile=mynodefilelist.txt
  • constraint = list of features that need to be present on the node
    • e.g. --constraint=pascal - and this can be a boolean expression like
      --constraint="pascal|tesla" or --constraint="pascal&skylake"

For example, your command might be:
srun -N 1 -n 1 -c 2 --nodelist=mynodename1,mynodename2 --constraint=pascal myscript.sh