diff --git a/NEWS b/NEWS index 08c60874f52c6e95ad43fda18d7752161eea82ed..4dd3618c7acc2c585131df627b74a14a1a1c7a25 100644 --- a/NEWS +++ b/NEWS @@ -168,6 +168,9 @@ documents those changes that are of interest to users and admins. -- launch/poe - Fix for hostlist file support with repeated host names. -- priority/multifactor2 - Prevent possible divide by zero. -- srun - Don't check for executable if --test-only flag is used. + -- energy - On a single node only use the last task for gathering energy. + Since we don't currently track energy usage per task (only per step). + Otherwise we get double the energy. * Changes in Slurm 2.5.6 ======================== diff --git a/src/slurmd/slurmstepd/mgr.c b/src/slurmd/slurmstepd/mgr.c index 3882852cd451523c2c466dccc488765f17cf9b6a..01b8ceb8996eceba78ecdc39182483fa9c11c87c 100644 --- a/src/slurmd/slurmstepd/mgr.c +++ b/src/slurmd/slurmstepd/mgr.c @@ -1695,6 +1695,18 @@ _wait_for_any_task(slurmd_job_t *job, bool waitflag) if (jobacct) { jobacctinfo_setinfo(jobacct, JOBACCT_DATA_RUSAGE, &rusage); + /* Since we currently don't track energy + usage per task (only per step). We take + into account only the last poll of the last task. + Odds are it is the only one with + information anyway, but just to be safe we + will zero out the previous value since this + one will over ride it. + If this ever changes in the future this logic + will need to change. + */ + if (jobacct->energy.consumed_energy) + job->jobacct->energy.consumed_energy = 0; jobacctinfo_aggregate(job->jobacct, jobacct); jobacctinfo_destroy(jobacct); }