Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[Energy] Fix the power_slope in the energy plugin
authorChristian Heinrich <franz-christian.heinrich@inria.fr>
Sun, 9 Oct 2016 21:39:30 +0000 (23:39 +0200)
committerChristian Heinrich <franz-christian.heinrich@inria.fr>
Sun, 9 Oct 2016 21:40:08 +0000 (23:40 +0200)
Since the consumption for one core is now explicitly given,
the slope needs to be computed differently, since we must not add
energy for the first core again.

examples/msg/energy-consumption/energy-consumption.tesh
examples/msg/energy-ptask/energy-ptask.tesh
examples/msg/energy-vm/energy-vm.tesh
src/surf/plugins/energy.cpp

index 3666ed1..8977b21 100644 (file)
@@ -8,15 +8,15 @@ $ $SG_TEST_EXENV energy-consumption/energy-consumption$EXEEXT ${srcdir:=.}/../pl
 > [  0.000000] (1:dvfs_test@MyHost1) Sleep for 10 seconds
 > [ 10.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 10.00 s). Current peak speed=1E+08; Energy dissipated=1000.00 J
 > [ 10.000000] (1:dvfs_test@MyHost1) Run a task of 1E+08 flops
-> [ 11.000000] (1:dvfs_test@MyHost1) Task done (duration: 1.00 s). Current peak speed=1E+08 flop/s; Current consumption: from 120W to 200W depending on load; Energy dissipated=1200 J
+> [ 11.000000] (1:dvfs_test@MyHost1) Task done (duration: 1.00 s). Current peak speed=1E+08 flop/s; Current consumption: from 120W to 200W depending on load; Energy dissipated=1120 J
 > [ 11.000000] (1:dvfs_test@MyHost1) ========= Requesting pstate 2 (speed should be of 2E+07 flop/s and is of 2E+07 flop/s)
 > [ 11.000000] (1:dvfs_test@MyHost1) Run a task of 1E+08 flops
-> [ 16.000000] (1:dvfs_test@MyHost1) Task done (duration: 5.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=1950 J
+> [ 16.000000] (1:dvfs_test@MyHost1) Task done (duration: 5.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=1645 J
 > [ 16.000000] (1:dvfs_test@MyHost1) Sleep for 4 seconds
-> [ 20.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 4.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=2310 J
+> [ 20.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 4.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=2005 J
 > [ 20.000000] (1:dvfs_test@MyHost1) Turning MyHost2 off, and sleeping another 10 seconds. MyHost2 dissipated 2000 J so far.
-> [ 30.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 10.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=3210 J
+> [ 30.000000] (1:dvfs_test@MyHost1) Done sleeping (duration: 10.00 s). Current peak speed=2E+07 flop/s; Energy dissipated=2905 J
 > [ 30.000000] (0:maestro@) Total simulation time: 30.00
-> [ 30.000000] (0:maestro@) Total energy of host MyHost1: 3210.000000 Joules
+> [ 30.000000] (0:maestro@) Total energy of host MyHost1: 2905.000000 Joules
 > [ 30.000000] (0:maestro@) Total energy of host MyHost2: 2100.000000 Joules
 > [ 30.000000] (0:maestro@) Total energy of host MyHost3: 3000.000000 Joules
index ffbc944..2bfd392 100644 (file)
@@ -8,6 +8,6 @@ $ $SG_TEST_EXENV energy-ptask/energy-ptask$EXEEXT ${srcdir:=.}/../platforms/ener
 > [310.000000] (1:test@MyHost1) Finally, trick the ptask to do a 'remote execution', on host MyHost2
 > [320.000000] (1:test@MyHost1) Goodbye now!
 > [320.000000] (0:maestro@) Simulation done.
-> [320.000000] (0:maestro@) Total energy of host MyHost1: 39800.000000 Joules
-> [320.000000] (0:maestro@) Total energy of host MyHost2: 40800.000000 Joules
-> [320.000000] (0:maestro@) Total energy of host MyHost3: 39800.000000 Joules
+> [320.000000] (0:maestro@) Total energy of host MyHost1: 38200.000000 Joules
+> [320.000000] (0:maestro@) Total energy of host MyHost2: 38400.000000 Joules
+> [320.000000] (0:maestro@) Total energy of host MyHost3: 38200.000000 Joules
index 314ce3a..ab2e86b 100644 (file)
@@ -16,6 +16,6 @@ $ $SG_TEST_EXENV energy-vm/energy-vm$EXEEXT ${srcdir:=.}/../platforms/energy_pla
 > [  6.000000] (6:p31@vm_host3) This worker is done.
 > [  6.000000] (7:p32@vm_host3) This worker is done.
 > [ 10.000000] (0:maestro@) Total simulation time: 10.00; All hosts must have the exact same energy consumption.
-> [ 10.000000] (0:maestro@) Total energy of host MyHost1: 1600.000000 Joules
-> [ 10.000000] (0:maestro@) Total energy of host MyHost2: 1600.000000 Joules
-> [ 10.000000] (0:maestro@) Total energy of host MyHost3: 1600.000000 Joules
+> [ 10.000000] (0:maestro@) Total energy of host MyHost1: 1120.000000 Joules
+> [ 10.000000] (0:maestro@) Total energy of host MyHost2: 1120.000000 Joules
+> [ 10.000000] (0:maestro@) Total energy of host MyHost3: 1120.000000 Joules
index 9a8879c..45ba186 100644 (file)
@@ -153,8 +153,25 @@ double HostEnergy::getCurrentWattsValue(double cpu_load)
   if (cpu_load > 0) { /* Something is going on, the machine is not idle */
     double min_power = range.min;
     double max_power = range.max;
-    double power_slope = max_power - min_power;
-    current_power = min_power + cpu_load * power_slope;
+
+    /**
+     * The min_power states how much we consume when only one single
+     * core is working. This means that when cpu_load == 1/coreCount, then
+     * current_power == min_power.
+     *
+     * The maximum must be reached when all cores are working (but 1 core was
+     * already accounted for by min_power)
+     * i.e., we need min_power + (maxCpuLoad-1/coreCount)*power_slope == max_power
+     * (maxCpuLoad is by definition 1)
+     */
+    double power_slope;
+    int coreCount = host->coresCount();
+    if (coreCount > 1)
+      power_slope = (max_power - min_power) / (1 - 1 / coreCount);
+    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;
   }
   else { /* Our machine is idle, take the dedicated value! */
     current_power = range.idle;