Commit 53ecf351 authored by Moe Jette's avatar Moe Jette
Browse files

Patch #30 tries to minimize double->int conversion rounding errors

           by behaving like slurmctld (truncation of double value)
           and rounding double-valued components otherwise. I have
           tested this and observed that it improves the accuracy.

priority/multifactor: minimize rounding errors

This fixes a rounding problem introduced in an earlier patch,

     26_PRIO_print-negative-sprio.diff
     "sprio: print overall priority value even if it is less than 0",

and minimizes other sources of rounding errors in the computation of floating-point
sprio factors.

Summary of issues fixed by this patch:
--------------------------------------
 * when assembling the job_ptr->priority (the squeue -o %Q output), truncation
   happens when converting from double to uint32_t (fractions are discarded);
 * the priority components are all double-valued, hence it would minimize 
   accumulation of rounding errors to display rounded values (using %.0f);
 * these values are displayed using _print_int(), for all integral values passed
   to this function, there is no change in the output.

Example showing the minimization of rounding errors:
----------------------------------------------------
 -> The difference is visible when comparing the `priority' value with the sum
    (age + jobsize + partition - nice), rounding the factors ('after' result)
    improves the accuracy.

Before:
palu ~> sprio
  JOBID     USER   PRIORITY        AGE  FAIRSHARE    JOBSIZE  PARTITION        QOS   NICE
  11698  vondele      14526        113          0       4289      10000          0   -123
  11711  vondele      14495         81          0       4289      10000          0   -123
  11712   sukysj      11248         80          0        236      10000          0   -931
  11728 piccinal      20065          7          0         56      10000          0 -10000
  11740 piccinal      20122          7          0        113      10000          0 -10000
  11742 piccinal      20349          7          0        340      10000          0 -10000

After:
palu build> ./sprio  -l
  JOBID     USER   PRIORITY        AGE  FAIRSHARE    JOBSIZE  PARTITION        QOS   NICE
  11698  vondele      14526        113          0       4290      10000          0   -123
  11711  vondele      14495         82          0       4290      10000          0   -123
  11712   sukysj      11248         80          0        237      10000          0   -931
  11728 piccinal      20065          8          0         57      10000          0 -10000
  11740 piccinal      20122          8          0        114      10000          0 -10000
  11742 piccinal      20349          8          0        341      10000          0 -10000

Other changes:
--------------
 * declared _print_{int,norm} static, since only referenced in print.c.
parent 927f634d
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment