cluster-computingslurmsbatch

Is --nodes 2 (without '=') accepted way of requesting nodes in slurm?


I just realized that I have been always using a slurm script, where in the first line I specify number of nodes in a wrong way. I see two options are either #SBATCH N 2 or #SBATCH --nodes=2. Instead I have been using #SBATCH --nodes 2 (missing '=') in my script all the time (of course I change 2 to other values as well as per need). However I have looked at all my finished jobs using sacct and running jobs, and it used number of nodes I requested correctly. But I couldn't find anywhere in official documentation if #SBATCH --node 2 is right way, and I am worried if it causes some issues which are hidden from me now. Is there any assurance that #SBATCH --nodes 2 is accepted same way as #SBATCH --nodes=2?


Solution

  • While the Slurm documentation consistently uses the form --nodes=2, the code uses the getopt_long function from unistd.h to parse arguments. The manpage of that function says:

    A long option may take a parameter, of the form --arg=param or --arg param

    So the version without the =, i.e. --nodes 2, will most probably always be valid. Note that you can check that at submission time by using the --verbose argument of sbatch, which makes sbatch output a summary of the options that were found in the submission script.

    Note that #SBATCH N 2 is a mistake and should be #SBATCH -N 2.