Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[ENERGY] Fixed a bug (division of integers)
authorChristian Heinrich <franz-christian.heinrich@inria.fr>
Mon, 10 Oct 2016 14:08:00 +0000 (16:08 +0200)
committerChristian Heinrich <franz-christian.heinrich@inria.fr>
Mon, 10 Oct 2016 14:36:49 +0000 (16:36 +0200)
Well, that should've been a division of doubles.
I also fixed the tesh tests.

examples/smpi/energy/energy.tesh
examples/smpi/energy/f77/energy.tesh
examples/smpi/energy/f90/energy.tesh
src/surf/plugins/energy.cpp

index bf48442..b546246 100644 (file)
@@ -9,16 +9,16 @@ $ ../../../smpi_script/bin/smpirun -np 2 -hostfile ${srcdir:=.}/hostfile  -platf
 > [0.000000] [rank 1] Pstates: 3; Powers: 100000000, 50000000, 20000000
 > [0.000000] [rank 0] Current pstate: 0; Current power: 100000000
 > [0.000000] [rank 1] Current pstate: 0; Current power: 100000000
-> [10.000000] [rank 0] Energy consumed: 2000 Joules.
-> [10.000000] [rank 1] Energy consumed: 2000 Joules.
+> [10.000000] [rank 0] Energy consumed: 1200 Joules.
+> [10.000000] [rank 1] Energy consumed: 1200 Joules.
 > [10.000000] [rank 0] Current pstate: 1; Current power: 50000000
 > [10.000000] [rank 1] Current pstate: 1; Current power: 50000000
-> [30.000000] [rank 0] Energy consumed: 5400 Joules.
-> [30.000000] [rank 1] Energy consumed: 5400 Joules.
+> [30.000000] [rank 0] Energy consumed: 3400 Joules.
+> [30.000000] [rank 1] Energy consumed: 3400 Joules.
 > [30.000000] [rank 0] Current pstate: 2; Current power: 20000000
 > [30.000000] [rank 1] Current pstate: 2; Current power: 20000000
-> [80.000000] [rank 0] Energy consumed: 12900 Joules.
-> [80.000000] [rank 1] Energy consumed: 12900 Joules.
-> [80.000000] [surf_energy/INFO] Total energy of host MyHost1: 12900.000000 Joules
-> [80.000000] [surf_energy/INFO] Total energy of host MyHost2: 12900.000000 Joules
+> [80.000000] [rank 0] Energy consumed: 8650 Joules.
+> [80.000000] [rank 1] Energy consumed: 8650 Joules.
+> [80.000000] [surf_energy/INFO] Total energy of host MyHost1: 8650.000000 Joules
+> [80.000000] [surf_energy/INFO] Total energy of host MyHost2: 8650.000000 Joules
 > [80.000000] [surf_energy/INFO] Total energy of host MyHost3: 8000.000000 Joules
index a6668aa..e6a588f 100644 (file)
@@ -16,16 +16,16 @@ $ ../../../smpi_script/bin/smpirun -np 2 -hostfile ${srcdir:=.}/hostfile  -platf
 >  [   0.0000000000000000      ] [rank            1 ] Power:    20000000.000000000     
 >  [   0.0000000000000000      ] [rank            0 ] Current pstate:            0 ; Current power:    100000000.00000000     
 >  [   0.0000000000000000      ] [rank            1 ] Current pstate:            0 ; Current power:    100000000.00000000     
->  [   10.000000000000000      ] [rank            0 ] Energy consumed (Joules):    2000.0000000000000     
->  [   10.000000000000000      ] [rank            1 ] Energy consumed (Joules):    2000.0000000000000     
+>  [   10.000000000000000      ] [rank            0 ] Energy consumed (Joules):    1200.0000000000000     
+>  [   10.000000000000000      ] [rank            1 ] Energy consumed (Joules):    1200.0000000000000     
 >  [   10.000000000000000      ] [rank            0 ] Current pstate:            1 ; Current power:    50000000.000000000     
 >  [   10.000000000000000      ] [rank            1 ] Current pstate:            1 ; Current power:    50000000.000000000     
->  [   30.000000000000000      ] [rank            0 ] Energy consumed (Joules):    5400.0000000000000     
->  [   30.000000000000000      ] [rank            1 ] Energy consumed (Joules):    5400.0000000000000     
+>  [   30.000000000000000      ] [rank            0 ] Energy consumed (Joules):    3400.0000000000000     
+>  [   30.000000000000000      ] [rank            1 ] Energy consumed (Joules):    3400.0000000000000     
 >  [   30.000000000000000      ] [rank            0 ] Current pstate:            2 ; Current power:    20000000.000000000     
 >  [   30.000000000000000      ] [rank            1 ] Current pstate:            2 ; Current power:    20000000.000000000     
->  [   80.000000000000000      ] [rank            0 ] Energy consumed (Joules):    12900.000000000000     
->  [   80.000000000000000      ] [rank            1 ] Energy consumed (Joules):    12900.000000000000     
-> [80.000000] [surf_energy/INFO] Total energy of host MyHost1: 12900.000000 Joules
-> [80.000000] [surf_energy/INFO] Total energy of host MyHost2: 12900.000000 Joules
+>  [   80.000000000000000      ] [rank            0 ] Energy consumed (Joules):    8650.0000000000000     
+>  [   80.000000000000000      ] [rank            1 ] Energy consumed (Joules):    8650.0000000000000     
+> [80.000000] [surf_energy/INFO] Total energy of host MyHost1: 8650.000000 Joules
+> [80.000000] [surf_energy/INFO] Total energy of host MyHost2: 8650.000000 Joules
 > [80.000000] [surf_energy/INFO] Total energy of host MyHost3: 8000.000000 Joules
index c66b898..14b0275 100644 (file)
@@ -16,16 +16,16 @@ $ ../../../smpi_script/bin/smpirun -np 2 -hostfile ${srcdir:=.}/hostfile  -platf
 >  [   0.0000000000000000      ] [rank            1 ] Power:    20000000.000000000     
 >  [   0.0000000000000000      ] [rank            0 ] Current pstate:            0 ; Current power:    100000000.00000000     
 >  [   0.0000000000000000      ] [rank            1 ] Current pstate:            0 ; Current power:    100000000.00000000     
->  [   10.000000000000000      ] [rank            0 ] Energy consumed (Joules):    2000.0000000000000     
->  [   10.000000000000000      ] [rank            1 ] Energy consumed (Joules):    2000.0000000000000     
+>  [   10.000000000000000      ] [rank            0 ] Energy consumed (Joules):    1200.0000000000000     
+>  [   10.000000000000000      ] [rank            1 ] Energy consumed (Joules):    1200.0000000000000     
 >  [   10.000000000000000      ] [rank            0 ] Current pstate:            1 ; Current power:    50000000.000000000     
 >  [   10.000000000000000      ] [rank            1 ] Current pstate:            1 ; Current power:    50000000.000000000     
->  [   30.000000000000000      ] [rank            0 ] Energy consumed (Joules):    5400.0000000000000     
->  [   30.000000000000000      ] [rank            1 ] Energy consumed (Joules):    5400.0000000000000     
+>  [   30.000000000000000      ] [rank            0 ] Energy consumed (Joules):    3400.0000000000000     
+>  [   30.000000000000000      ] [rank            1 ] Energy consumed (Joules):    3400.0000000000000     
 >  [   30.000000000000000      ] [rank            0 ] Current pstate:            2 ; Current power:    20000000.000000000     
 >  [   30.000000000000000      ] [rank            1 ] Current pstate:            2 ; Current power:    20000000.000000000     
->  [   80.000000000000000      ] [rank            0 ] Energy consumed (Joules):    12900.000000000000     
->  [   80.000000000000000      ] [rank            1 ] Energy consumed (Joules):    12900.000000000000     
-> [80.000000] [surf_energy/INFO] Total energy of host MyHost1: 12900.000000 Joules
-> [80.000000] [surf_energy/INFO] Total energy of host MyHost2: 12900.000000 Joules
+>  [   80.000000000000000      ] [rank            0 ] Energy consumed (Joules):    8650.0000000000000     
+>  [   80.000000000000000      ] [rank            1 ] Energy consumed (Joules):    8650.0000000000000     
+> [80.000000] [surf_energy/INFO] Total energy of host MyHost1: 8650.000000 Joules
+> [80.000000] [surf_energy/INFO] Total energy of host MyHost2: 8650.000000 Joules
 > [80.000000] [surf_energy/INFO] Total energy of host MyHost3: 8000.000000 Joules
index 82248cd..4808523 100644 (file)
@@ -166,12 +166,13 @@ double HostEnergy::getCurrentWattsValue(double cpu_load)
      */
     double power_slope;
     int coreCount = host->coreCount();
+    double coreReciprocal = static_cast<double>(1) / static_cast<double>(coreCount);
     if (coreCount > 1)
-      power_slope = (max_power - min_power) / (1 - 1 / coreCount);
+      power_slope = (max_power - min_power) / (1 - coreReciprocal);
     else
       power_slope = 0; // Should be 0, since max_power == min_power (in this case)
 
-    current_power = min_power + (cpu_load - (1 / coreCount)) * power_slope;
+    current_power = min_power + (cpu_load - coreReciprocal) * power_slope;
   }
   else { /* Our machine is idle, take the dedicated value! */
     current_power = range.idle;