Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'smpi_cpp'
authordegomme <augustin.degomme@unibas.ch>
Mon, 6 Mar 2017 13:10:23 +0000 (14:10 +0100)
committerdegomme <augustin.degomme@unibas.ch>
Mon, 6 Mar 2017 13:10:23 +0000 (14:10 +0100)
examples/msg/energy-consumption/energy-consumption.tesh
examples/msg/energy-onoff/energy-onoff.tesh
examples/msg/energy-ptask/energy-ptask.tesh
examples/msg/energy-vm/energy-vm.tesh
examples/smpi/energy/energy.tesh
examples/smpi/energy/f77/energy.tesh
examples/smpi/energy/f90/energy.tesh
src/smpi/smpi_base.cpp
src/surf/plugins/host_energy.cpp

index ae07b57..cea5657 100644 (file)
@@ -16,6 +16,7 @@ $ ${bindir:=.}/energy-consumption/energy-consumption$EXEEXT ${srcdir:=.}/../plat
 > [ 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@) Summed energy consumption: 8005.000000 Joules; used hosts consumed: 5005.000000 Joules; unused (idle) hosts consumed: 3000.000000
 > [ 30.000000] (0:maestro@) Total simulation time: 30.00
 > [ 30.000000] (0:maestro@) Total energy of host MyHost1: 2905.000000 Joules
 > [ 30.000000] (0:maestro@) Total energy of host MyHost2: 2100.000000 Joules
index 1dc58bb..d51c44a 100644 (file)
@@ -18,6 +18,7 @@ $ ${bindir:=.}/energy-onoff/energy-onoff$EXEEXT ${srcdir:=.}/energy-onoff/platfo
 > [ 26.997901] (1:onoff_test@MyHost2) Switch to virtual pstate 3, that encodes the shutting down state in the XML file of that example
 > [ 26.997901] (1:onoff_test@MyHost2) Actually start the host
 > [ 26.997901] (1:onoff_test@MyHost2) Simulate the boot up by executing one flop on that host
+> [176.997893] (0:maestro@) Summed energy consumption: 37519.557482 Joules; used hosts consumed: 37519.557482 Joules; unused (idle) hosts consumed: 0.000000
 > [176.997893] (0:maestro@) Total simulation time: 177.00
 > [176.997893] (0:maestro@) Total energy of host MyHost1: 19819.768169 Joules
 > [176.997893] (0:maestro@) Total energy of host MyHost2: 17699.789313 Joules
index 19069e7..7dde4e6 100644 (file)
@@ -8,6 +8,7 @@ $ ${bindir:=.}/energy-ptask/energy-ptask$EXEEXT ${srcdir:=.}/../platforms/energy
 > [311.000000] (1:test@MyHost1) Then, build a parallel task with no computation nor communication (synchro only)
 > [311.000000] (1:test@MyHost1) Finally, trick the ptask to do a 'remote execution', on host MyHost2
 > [321.000000] (1:test@MyHost1) Goodbye now!
+> [321.000000] (0:maestro@) Summed energy consumption: 115160.000000 Joules; used hosts consumed: 115160.000000 Joules; unused (idle) hosts consumed: 0.000000
 > [321.000000] (0:maestro@) Simulation done.
 > [321.000000] (0:maestro@) Total energy of host MyHost1: 38320.000000 Joules
 > [321.000000] (0:maestro@) Total energy of host MyHost2: 38520.000000 Joules
index 3d82954..2225e3b 100644 (file)
@@ -15,6 +15,7 @@ $ ${bindir:=.}/energy-vm/energy-vm$EXEEXT ${srcdir:=.}/../platforms/energy_platf
 > [  6.000000] (2:p11@vm_host1) This worker is done.
 > [  6.000000] (6:p31@vm_host3) This worker is done.
 > [  6.000000] (7:p32@vm_host3) This worker is done.
+> [ 10.000000] (0:maestro@) Summed energy consumption: 3360.000000 Joules; used hosts consumed: 3360.000000 Joules; unused (idle) hosts consumed: 0.000000
 > [ 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: 1120.000000 Joules
 > [ 10.000000] (0:maestro@) Total energy of host MyHost2: 1120.000000 Joules
index b546246..3dd7c0d 100644 (file)
@@ -19,6 +19,7 @@ $ ../../../smpi_script/bin/smpirun -np 2 -hostfile ${srcdir:=.}/hostfile  -platf
 > [30.000000] [rank 1] Current pstate: 2; Current power: 20000000
 > [80.000000] [rank 0] Energy consumed: 8650 Joules.
 > [80.000000] [rank 1] Energy consumed: 8650 Joules.
+> [80.000000] [surf_energy/INFO] Summed energy consumption: 25300.000000 Joules; used hosts consumed: 17300.000000 Joules; unused (idle) hosts consumed: 8000.000000
 > [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 e6a588f..185cbd1 100644 (file)
@@ -26,6 +26,7 @@ $ ../../../smpi_script/bin/smpirun -np 2 -hostfile ${srcdir:=.}/hostfile  -platf
 >  [   30.000000000000000      ] [rank            1 ] Current pstate:            2 ; Current power:    20000000.000000000     
 >  [   80.000000000000000      ] [rank            0 ] Energy consumed (Joules):    8650.0000000000000     
 >  [   80.000000000000000      ] [rank            1 ] Energy consumed (Joules):    8650.0000000000000     
+> [80.000000] [surf_energy/INFO] Summed energy consumption: 25300.000000 Joules; used hosts consumed: 17300.000000 Joules; unused (idle) hosts consumed: 8000.000000
 > [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 14b0275..b1f395a 100644 (file)
@@ -26,6 +26,7 @@ $ ../../../smpi_script/bin/smpirun -np 2 -hostfile ${srcdir:=.}/hostfile  -platf
 >  [   30.000000000000000      ] [rank            1 ] Current pstate:            2 ; Current power:    20000000.000000000     
 >  [   80.000000000000000      ] [rank            0 ] Energy consumed (Joules):    8650.0000000000000     
 >  [   80.000000000000000      ] [rank            1 ] Energy consumed (Joules):    8650.0000000000000     
+> [80.000000] [surf_energy/INFO] Summed energy consumption: 25300.000000 Joules; used hosts consumed: 17300.000000 Joules; unused (idle) hosts consumed: 8000.000000
 > [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 524c998..7201d37 100644 (file)
@@ -779,7 +779,8 @@ void smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status*
 
   // to avoid deadlock, we have to sleep some time here, or the timer won't advance and we will only do iprobe simcalls
   // (especially when used as a break condition, such as while(MPI_Iprobe(...)) ... )
-  // multiplier to the sleeptime, to increase speed of execution, each failed iprobe will increase it
+  // nsleeps is a multiplier to the sleeptime, to increase speed of execution, each failed iprobe will increase it
+  // (This can speed up the execution of certain applications by an order of magnitude, such as HPL)
   static int nsleeps = 1;
   double speed       = simgrid::s4u::Actor::self()->host()->speed();
   double maxrate = xbt_cfg_get_double("smpi/iprobe-cpu-usage");
index 9317b7b..08ab4df 100644 (file)
@@ -7,6 +7,7 @@
 #include "simgrid/simix.hpp"
 #include "src/plugins/vm/VirtualMachineImpl.hpp"
 #include "src/surf/cpu_interface.hpp"
+#include <simgrid/s4u/engine.hpp>
 #include <utility>
 
 /** @addtogroup SURF_plugin_energy
@@ -169,7 +170,7 @@ double HostEnergy::getCurrentWattsValue(double cpu_load)
 {
   xbt_assert(!power_range_watts_list.empty(), "No power range properties specified for host %s", host->cname());
 
-  /* min_power corresponds to the idle power (cpu load = 0) */
+  /* min_power corresponds to the power consumed when only one core is active */
   /* max_power is the power consumed at 100% cpu load       */
   auto range           = power_range_watts_list.at(host->pstate());
   double current_power = 0;
@@ -307,6 +308,24 @@ static void onHostDestruction(simgrid::s4u::Host& host)
   XBT_INFO("Total energy of host %s: %f Joules", host.cname(), host_energy->getConsumedEnergy());
 }
 
+static void onSimulationEnd()
+{
+  sg_host_t* host_list     = sg_host_list();
+  int host_count           = sg_host_count();
+  double total_energy      = 0.0; // Total energy consumption (whole plattform)
+  double used_hosts_energy = 0.0; // Energy consumed by hosts that computed something
+  for (int i = 0; i < host_count; i++) {
+    bool host_was_used = (host_list[i]->extension<HostEnergy>()->last_updated != 0);
+    double energy      = 0.0;
+    energy             = host_list[i]->extension<HostEnergy>()->getConsumedEnergy();
+    total_energy      += energy;
+    if (host_was_used)
+      used_hosts_energy += energy;
+  }
+  XBT_INFO("Summed energy consumption: %f Joules; used hosts consumed: %f Joules; unused (idle) hosts consumed: %f",
+           total_energy, used_hosts_energy, total_energy - used_hosts_energy);
+}
+
 /* **************************** Public interface *************************** */
 SG_BEGIN_DECL()
 
@@ -325,6 +344,7 @@ void sg_host_energy_plugin_init()
   simgrid::s4u::Host::onStateChange.connect(&onHostChange);
   simgrid::s4u::Host::onSpeedChange.connect(&onHostChange);
   simgrid::s4u::Host::onDestruction.connect(&onHostDestruction);
+  simgrid::s4u::onSimulationEnd.connect(&onSimulationEnd);
   simgrid::surf::CpuAction::onStateChange.connect(&onActionStateChange);
 }