[slurm-users] job_submit.lua and memory allocations

William G. Wichser bill at Princeton.EDU
Fri Jan 24 15:38:16 UTC 2020

Answering my own question after much help from Josko Plazonic-

local mem_to_use = 0

-- This is the logic -
-- either min_mem_per_node or min_mem_per_cpu will be set
-- Both can't be set, so only act in those two cases

if job_desc.min_mem_per_node ~= nil then
         mem_to_use = job_desc.min_mem_per_node
if job_desc.min_mem_per_cpu ~= nil then
         mem_to_use = job_desc.min_mem_per_cpu * job_desc.min_cpus

log_info("slurm_job_submit: Got total memory: %d", mem_to_use)


On 1/24/20 8:52 AM, William G. Wichser wrote:
> Resurrecting an older thread where I need to obtain the value for memory
> in a submitted job.  Turns out this is not an easy case with the method
> I'm trying to use so hope that there is just some variable I am overlooking.
> The trivial case was simply to look at job_desc.pn_min_memory.  And this
> works fine as long as jobs are submitted with a --mem= flag.  But there
> are two other ways that jobs get submitted which make this value
> something like 2^63.
> The first is when no memory is specified and users rely on the default.
> The second is with --mem-per-cpu=X
> For that second case I can detect using
> (job_desc.pn_min_memory - slurm.MEM_PER_CPU) * job_desc.min_cpus
> But I find that when users are using the default memory allocation, it
> isn't so easy to detect since it appears that both of the memory values
> are set to 2^63 or close to that number.  Maybe it's 2^64 -1.  Whatever.
> I just feel that there has to be a better way!  Is there soemthing that
> I'm missing?  Perhaps a tres.memory or something which has the right
> value when in job_submit.lua?
> Thanks,
> Bill

More information about the slurm-users mailing list