From: Christian Heinrich Date: Tue, 6 Feb 2018 15:50:52 +0000 (+0100) Subject: [ENERGY] The energy now depends on the HostLoad plugin. X-Git-Tag: v3.19~215 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5014a33c445bb3b94e34453892aebccc0251e783?ds=sidebyside [ENERGY] The energy now depends on the HostLoad plugin. When a pstate is changed, the energy plugin will update a timestamp for that host even if that host is never used; this means that we cannot rely on this to determine if a host has been idle or not. The HostLoad plugin allows us to do that. This commit also updates several tesh files as some hosts were reported as active in the past although they have not computed anything. These hosts were hence idle and should be reported as such; a machine that only boots or shuts down is in this case also regarded as unused. --- diff --git a/examples/s4u/energy-boot/s4u-energy-boot.tesh b/examples/s4u/energy-boot/s4u-energy-boot.tesh index 15f1848d6e..9c6a7ad0f2 100644 --- a/examples/s4u/energy-boot/s4u-energy-boot.tesh +++ b/examples/s4u/energy-boot/s4u-energy-boot.tesh @@ -18,7 +18,7 @@ $ ${bindir:=.}/s4u-energy-boot$EXEEXT ${srcdir:=.}/platform_boot.xml "--log=root > [ 27.000000] (1:Boot Monitor@MyHost2) Wait 150s to simulate the boot time. > [177.000000] (1:Boot Monitor@MyHost2) The host is now up and running. Switch back to previous pstate 0 > [177.000000] (1:Boot Monitor@MyHost2) Host1 is now ON again. Current pstate: 0; Energy dissipated so far: 19820.00 J -> [177.000000] (0:maestro@) Total energy consumption: 37520.000000 Joules (used hosts: 37520.000000 Joules; unused/idle hosts: 0.000000) +> [177.000000] (0:maestro@) Total energy consumption: 37520.000000 Joules (used hosts: 0.000000 Joules; unused/idle hosts: 37520.000000) > [177.000000] (0:maestro@) End of simulation. > [177.000000] (0:maestro@) Energy consumption of host MyHost1: 19820.000000 Joules > [177.000000] (0:maestro@) Energy consumption of host MyHost2: 17700.000000 Joules @@ -41,7 +41,7 @@ $ ${bindir:=.}/s4u-energy-boot$EXEEXT ${srcdir:=.}/platform_boot.xml "--log=root > [ 27.000000] (1:Boot Monitor@MyHost2) Wait 150s to simulate the boot time. > [177.000000] (1:Boot Monitor@MyHost2) The host is now up and running. Switch back to previous pstate 0 > [177.000000] (1:Boot Monitor@MyHost2) Host1 is now ON again. Current pstate: 0; Energy dissipated so far: 19820.00 J -> [177.000000] (0:maestro@) Total energy consumption: 37520.000000 Joules (used hosts: 37520.000000 Joules; unused/idle hosts: 0.000000) +> [177.000000] (0:maestro@) Total energy consumption: 37520.000000 Joules (used hosts: 0.000000 Joules; unused/idle hosts: 37520.000000) > [177.000000] (0:maestro@) End of simulation. > [177.000000] (0:maestro@) Energy consumption of host MyHost1: 19820.000000 Joules > [177.000000] (0:maestro@) Energy consumption of host MyHost2: 17700.000000 Joules diff --git a/examples/s4u/energy-exec/s4u-energy-exec.tesh b/examples/s4u/energy-exec/s4u-energy-exec.tesh index d1b5705692..ab583ae84b 100644 --- a/examples/s4u/energy-exec/s4u-energy-exec.tesh +++ b/examples/s4u/energy-exec/s4u-energy-exec.tesh @@ -16,7 +16,7 @@ $ ${bindir:=.}/s4u-energy-exec$EXEEXT ${platfdir}/energy_platform.xml "--log=roo > [ 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=2905 J -> [ 30.000000] (0:maestro@) Total energy consumption: 8005.000000 Joules (used hosts: 5005.000000 Joules; unused/idle hosts: 3000.000000) +> [ 30.000000] (0:maestro@) Total energy consumption: 8005.000000 Joules (used hosts: 2905.000000 Joules; unused/idle hosts: 5100.000000) > [ 30.000000] (0:maestro@) End of simulation. > [ 30.000000] (0:maestro@) Energy consumption of host MyHost1: 2905.000000 Joules > [ 30.000000] (0:maestro@) Energy consumption of host MyHost2: 2100.000000 Joules @@ -38,7 +38,7 @@ $ ${bindir:=.}/s4u-energy-exec$EXEEXT ${platfdir}/energy_cluster.xml "--log=root > [ 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=2905 J -> [ 30.000000] (0:maestro@) Total energy consumption: 5005.000000 Joules (used hosts: 5005.000000 Joules; unused/idle hosts: 0.000000) +> [ 30.000000] (0:maestro@) Total energy consumption: 5005.000000 Joules (used hosts: 2905.000000 Joules; unused/idle hosts: 2100.000000) > [ 30.000000] (0:maestro@) End of simulation. > [ 30.000000] (0:maestro@) Energy consumption of host MyHost1: 2905.000000 Joules > [ 30.000000] (0:maestro@) Energy consumption of host MyHost2: 2100.000000 Joules diff --git a/src/surf/plugins/host_energy.cpp b/src/surf/plugins/host_energy.cpp index 7074846e53..171f6b7dcc 100644 --- a/src/surf/plugins/host_energy.cpp +++ b/src/surf/plugins/host_energy.cpp @@ -4,6 +4,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "simgrid/plugins/energy.h" +#include "simgrid/plugins/load.h" #include "simgrid/simix.hpp" #include "src/plugins/vm/VirtualMachineImpl.hpp" #include "src/surf/cpu_interface.hpp" @@ -438,7 +439,7 @@ static void onSimulationEnd() for (int i = 0; i < host_count; i++) { if (dynamic_cast(host_list[i]) == nullptr) { // Ignore virtual machines - bool host_was_used = (host_list[i]->extension()->last_updated != 0); + bool host_was_used = (sg_host_get_computed_flops(host_list[i]) != 0); double energy = host_list[i]->extension()->getConsumedEnergy(); total_energy += energy; if (host_was_used) @@ -462,6 +463,8 @@ void sg_host_energy_plugin_init() if (HostEnergy::EXTENSION_ID.valid()) return; + sg_host_load_plugin_init(); + HostEnergy::EXTENSION_ID = simgrid::s4u::Host::extension_create(); simgrid::s4u::Host::onCreation.connect(&onCreation); diff --git a/teshsuite/msg/energy-consumption/energy-consumption.tesh b/teshsuite/msg/energy-consumption/energy-consumption.tesh index 58259d26f7..bcb9f7f012 100644 --- a/teshsuite/msg/energy-consumption/energy-consumption.tesh +++ b/teshsuite/msg/energy-consumption/energy-consumption.tesh @@ -16,7 +16,7 @@ $ ${bindir:=.}/energy-consumption$EXEEXT ${platfdir}/energy_platform.xml "--log= > [ 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=2905 J -> [ 30.000000] (0:maestro@) Total energy consumption: 8005.000000 Joules (used hosts: 5005.000000 Joules; unused/idle hosts: 3000.000000) +> [ 30.000000] (0:maestro@) Total energy consumption: 8005.000000 Joules (used hosts: 2905.000000 Joules; unused/idle hosts: 5100.000000) > [ 30.000000] (0:maestro@) Total simulation time: 30.00 > [ 30.000000] (0:maestro@) Energy consumption of host MyHost1: 2905.000000 Joules > [ 30.000000] (0:maestro@) Energy consumption of host MyHost2: 2100.000000 Joules @@ -38,7 +38,7 @@ $ ${bindir:=.}/energy-consumption$EXEEXT ${platfdir}/energy_cluster.xml "--log=r > [ 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=2905 J -> [ 30.000000] (0:maestro@) Total energy consumption: 5005.000000 Joules (used hosts: 5005.000000 Joules; unused/idle hosts: 0.000000) +> [ 30.000000] (0:maestro@) Total energy consumption: 5005.000000 Joules (used hosts: 2905.000000 Joules; unused/idle hosts: 2100.000000) > [ 30.000000] (0:maestro@) Total simulation time: 30.00 > [ 30.000000] (0:maestro@) Energy consumption of host MyHost1: 2905.000000 Joules > [ 30.000000] (0:maestro@) Energy consumption of host MyHost2: 2100.000000 Joules