Specifying memory or leaving it blank (Slurm)

In our desktop apps we allow users to specify number of nodes, number of cores, and/or total amount of RAM. If they did not specify memory, Slurm would allocate them what the DefMemPerCPU is for the node they were on. We have a very heterogenous cluster so we’re trying to be flexible and either let the user decide or let Slurm assign it based on whatever node they get on. After we upgraded to Slurm 20.11 this no longer works if the memory field is left blank.

This in the submit.yml file:
- “–mem”
- “<%= memory %>”

Results in:
sbatch: error: Invalid --mem specification

It doesn’t like it left blank. Do you know of a way to force Slurm to set it? Something like:
- “–mem”
- “<%= memory.blank? ? DefMemPerCPU : memory.to_i %>”

Unfortunately, this doesn’t work. That would be too easy! I don’t know how to get a native Slurm variable/field into this statement. Thanks for any insight you may have or suggestions for other ways of approaching this.

Thanks!
Dori

Maybe you can try the way we do licenses. So instead of trying to fill out the --mem option, you only supply it when you have a known good value.

Of course then in native you have to loop through the args, so it’s a bit different, but if you like you could just wrap it in an if block.

<%- if memory.present? -%>
- "--mem"
- "<%= memory %>" 
<%- end -%>
1 Like

Thanks! I’ll try that and let you know how it goes

@jeff.ohrstrom this worked perfectly! Thanks very much!!

1 Like