I think you're misinterpreting the code. I don't see in that code
snippet where it says that the 'alloc_cpus' field is empty but there's a
corresponding value in AllocCPU.
They way I read it, it's saying that if $job->{'alloc_cpus'} doesn't
exist, than Slurm is configured to count CPUs as a TRES, so look at the
TRES for a job and get the CPU count from there.
I think this behavior depends on the value of the SelectType parameter
in slurm.conf. Read the section of the slurm.conf documentation starting
at "SelectType".
https://slurm.schedmd.com/slurm.conf.html
Prentice
On 3/9/21 2:52 AM, xiaojingh...@163.com wrote:
Hi guys,
I would like to calculate the CPU efficiency and Memory efficiency of slurm
jobs. I know that the “seff” command is for this. I’d like to do the same job
on my own.
When I was studying the source code of the seff command, I saw the code below:
my $ncpus = 1;
if (exists $job->{'alloc_cpus'}) {
$ncpus = $job->{'alloc_cpus'};
} else {
if (exists $job->{'tres_alloc_str'}) {
$ncpus = Slurmdb::find_tres_count_in_string($job->{'tres_alloc_str'},
TRES_CPU);
}
}
I am wondering under what circumstance would the “alloc_cpus” field for a job
to be empty while having corresponding value in AllocCPU field?
Very grateful for any help.
Thank you!