Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Drop s4u::Host::getPstateSpeedCurrent() which dupplicates Host::speed()
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 13 Mar 2017 22:53:10 +0000 (23:53 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 13 Mar 2017 23:15:51 +0000 (00:15 +0100)
Also revalidate 2 tesh files because s4u::Host::getPstateSpeedCurrent
was a simcall where getters don't have to. Switching to speed() fixes
this, but it changes the events order.

12 files changed:
ChangeLog
examples/java/energy/pstate/energy_pstate.tesh
examples/msg/energy-pstate/energy-pstate.tesh
include/simgrid/msg.h
include/simgrid/s4u/host.hpp
src/msg/msg_host.cpp
src/s4u/s4u_host.cpp
src/smpi/smpi_dvfs.cpp
src/surf/cpu_interface.cpp
src/surf/cpu_interface.hpp
src/surf/instr_routing.cpp
src/surf/plugins/host_energy.cpp

index 037b902..d7bfa97 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,7 @@ SimGrid (3.15) UNRELEASED; urgency=low
  - New: MSG_process_ref/unref(). Fiddle with the process refcounting.
  - Renamed MSG_energy_plugin_init() -> MSG_host_energy_plugin_init()
    to make room for the upcoming network energy plugin.
+ - Drop MSG_host_get_current_power_peak: dupplicates MSG_host_get_speed
 
  Java
  - Ensure that an actor can kill itself with Process::exit()
@@ -31,6 +32,7 @@ SimGrid (3.15) UNRELEASED; urgency=low
    - s4u::Host::onSpeedChange: when the pstate is changed, or when an
      event from the availability_file changes the avail speed.
  - Links are now usable from s4u
+ - Drop Host::getPstateSpeedCurrent() which dupplicates Host::speed()
 
  SimDag
  - Backwards Compatibility breaks
index 036c4ee..7830de7 100644 (file)
@@ -14,9 +14,9 @@ $ java -classpath ${classpath:=.} energy/pstate/Main ${srcdir:=.}/../platforms/e
 > [MyHost2:dvfs_test:(3) 1.000000] [java/INFO] Current power peak=2.0E7
 > [MyHost1:dvfs_test:(2) 6.000000] [java/INFO] Task2 simulation time: 5.0
 > [MyHost1:dvfs_test:(2) 6.000000] [java/INFO] Count of Processor states=3
+> [MyHost1:dvfs_test:(2) 6.000000] [java/INFO] Current power peak=2.0E7
 > [MyHost2:dvfs_test:(3) 6.000000] [java/INFO] Task2 simulation time: 5.0
 > [MyHost2:dvfs_test:(3) 6.000000] [java/INFO] Count of Processor states=3
-> [MyHost1:dvfs_test:(2) 6.000000] [java/INFO] Current power peak=2.0E7
 > [MyHost2:dvfs_test:(3) 6.000000] [java/INFO] Current power peak=2.0E7
 > [6.000000] [surf_energy/INFO] Total energy consumption: 1890.000000 Joules (used hosts: 1290.000000 Joules; unused/idle hosts: 600.000000)
 > [6.000000] [java/INFO] MSG_main finished; Cleaning up the simulation...
index 6628264..48a3f1a 100644 (file)
@@ -4,8 +4,8 @@ p Testing the DVFS-related functions
 
 $ ${bindir:=.}/energy-pstate/energy-pstate$EXEEXT ${srcdir:=.}/../platforms/energy_platform.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.000000] (1:dvfs_test@MyHost1) Count of Processor states=3
-> [  0.000000] (2:dvfs_test@MyHost2) Count of Processor states=3
 > [  0.000000] (1:dvfs_test@MyHost1) Current power peak=100000000.000000
+> [  0.000000] (2:dvfs_test@MyHost2) Count of Processor states=3
 > [  0.000000] (2:dvfs_test@MyHost2) Current power peak=100000000.000000
 > [  1.000000] (1:dvfs_test@MyHost1) Task1 simulation time: 1.000000e+00
 > [  1.000000] (2:dvfs_test@MyHost2) Task1 simulation time: 1.000000e+00
@@ -15,16 +15,16 @@ $ ${bindir:=.}/energy-pstate/energy-pstate$EXEEXT ${srcdir:=.}/../platforms/ener
 > [  1.000000] (2:dvfs_test@MyHost2) Current power peak=20000000.000000
 > [  6.000000] (1:dvfs_test@MyHost1) Task2 simulation time: 5.000000e+00
 > [  6.000000] (1:dvfs_test@MyHost1) Count of Processor states=3
+> [  6.000000] (1:dvfs_test@MyHost1) Current power peak=20000000.000000
 > [  6.000000] (2:dvfs_test@MyHost2) Task2 simulation time: 5.000000e+00
 > [  6.000000] (2:dvfs_test@MyHost2) Count of Processor states=3
-> [  6.000000] (1:dvfs_test@MyHost1) Current power peak=20000000.000000
 > [  6.000000] (2:dvfs_test@MyHost2) Current power peak=20000000.000000
 > [  6.000000] (0:maestro@) Total simulation time: 6.000000e+00
 
 $ ${bindir:=.}/energy-pstate/energy-pstate$EXEEXT ${srcdir:=.}/../platforms/energy_cluster.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
 > [  0.000000] (1:dvfs_test@MyHost1) Count of Processor states=3
-> [  0.000000] (2:dvfs_test@MyHost2) Count of Processor states=3
 > [  0.000000] (1:dvfs_test@MyHost1) Current power peak=100000000.000000
+> [  0.000000] (2:dvfs_test@MyHost2) Count of Processor states=3
 > [  0.000000] (2:dvfs_test@MyHost2) Current power peak=100000000.000000
 > [  1.000000] (1:dvfs_test@MyHost1) Task1 simulation time: 1.000000e+00
 > [  1.000000] (2:dvfs_test@MyHost2) Task1 simulation time: 1.000000e+00
@@ -34,8 +34,8 @@ $ ${bindir:=.}/energy-pstate/energy-pstate$EXEEXT ${srcdir:=.}/../platforms/ener
 > [  1.000000] (2:dvfs_test@MyHost2) Current power peak=20000000.000000
 > [  6.000000] (1:dvfs_test@MyHost1) Task2 simulation time: 5.000000e+00
 > [  6.000000] (1:dvfs_test@MyHost1) Count of Processor states=3
+> [  6.000000] (1:dvfs_test@MyHost1) Current power peak=20000000.000000
 > [  6.000000] (2:dvfs_test@MyHost2) Task2 simulation time: 5.000000e+00
 > [  6.000000] (2:dvfs_test@MyHost2) Count of Processor states=3
-> [  6.000000] (1:dvfs_test@MyHost1) Current power peak=20000000.000000
 > [  6.000000] (2:dvfs_test@MyHost2) Current power peak=20000000.000000
 > [  6.000000] (0:maestro@) Total simulation time: 6.000000e+00
index 0c0a6bb..d431064 100644 (file)
@@ -245,15 +245,13 @@ XBT_PUBLIC(void) MSG_host_get_process_list(msg_host_t h, xbt_dynar_t whereto);
 XBT_PUBLIC(int) MSG_host_is_on(msg_host_t h);
 XBT_PUBLIC(int) MSG_host_is_off(msg_host_t h);
 
-// deprecated
-XBT_PUBLIC(double) MSG_get_host_speed(msg_host_t h);
-
+XBT_PUBLIC(double) MSG_get_host_speed(msg_host_t h); /* deprecated */
 
 XBT_PUBLIC(double) MSG_host_get_power_peak_at(msg_host_t h, int pstate);
-XBT_PUBLIC(double) MSG_host_get_current_power_peak(msg_host_t h);
+#define MSG_host_get_current_power_peak(h) MSG_host_get_speed(h) /* deprecated */
 XBT_PUBLIC(int)    MSG_host_get_nb_pstates(msg_host_t h);
-#define MSG_host_get_pstate(h)         sg_host_get_pstate(h)
-#define MSG_host_set_pstate(h, pstate) sg_host_set_pstate(h, pstate)
+#define MSG_host_get_pstate(h)         sg_host_get_pstate(h)         /* deprecated */
+#define MSG_host_set_pstate(h, pstate) sg_host_set_pstate(h, pstate) /* deprecated */
 XBT_PUBLIC(xbt_dynar_t) MSG_hosts_as_dynar();
 XBT_PUBLIC(int) MSG_get_host_number();
 XBT_PUBLIC(xbt_dict_t) MSG_host_get_mounted_storage_list(msg_host_t host);
index 77c4a7b..e2eb92c 100644 (file)
@@ -88,7 +88,6 @@ public:
   const char*property(const char*key);
   void setProperty(const char*key, const char *value);
   xbt_swag_t processes();
-  double getPstateSpeedCurrent();
   double getPstateSpeed(int pstate_index);
   int pstatesCount() const;
   void setPstate(int pstate_index);
index 968ae5d..7bef21b 100644 (file)
@@ -223,17 +223,6 @@ double MSG_host_get_power_peak_at(msg_host_t host, int pstate_index) {
   return host->getPstateSpeed(pstate_index);
 }
 
-/** \ingroup m_host_management
- * \brief Return the current speed of the processor (in flop/s)
- *
- * \param  host host to test
- * \return Returns the current processor speed
- */
-double MSG_host_get_current_power_peak(msg_host_t host) {
-  xbt_assert((host != nullptr), "Invalid parameters (host is nullptr)");
-  return host->getPstateSpeedCurrent();
-}
-
 /** \ingroup m_host_management
  * \brief Return the total count of pstates defined for a host. See also @ref SURF_plugin_energy.
  *
index 284d0d6..f792b9c 100644 (file)
@@ -202,15 +202,7 @@ xbt_swag_t Host::processes()
   });
 }
 
-/** Get the peak power of a host */
-double Host::getPstateSpeedCurrent()
-{
-  return simgrid::simix::kernelImmediate([this] {
-    return this->pimpl_cpu->getPstateSpeedCurrent();
-  });
-}
-
-/** Get one power peak (in flops/s) of a host at a given pstate */
+/** @brief Get the peak processor speed (in flops/s), at the specified pstate  */
 double Host::getPstateSpeed(int pstate_index)
 {
   return simgrid::simix::kernelImmediate([this, pstate_index] {
@@ -218,10 +210,11 @@ double Host::getPstateSpeed(int pstate_index)
   });
 }
 
-/** @brief Get the speed of the cpu associated to a host */
+/** @brief Get the peak processor speed (in flops/s), at the current pstate */
 double Host::speed() {
   return pimpl_cpu->getSpeed(1.0);
 }
+
 /** @brief Returns the number of core of the processor. */
 int Host::coreCount() {
   return pimpl_cpu->coreCount();
index efd24c3..6088ab5 100644 (file)
@@ -35,7 +35,7 @@ double smpi_get_host_power_peak_at(int pstate_index)
  */
 double smpi_get_host_current_power_peak()
 {
-  return SIMIX_host_self()->getPstateSpeedCurrent();
+  return SIMIX_host_self()->speed();
 }
 
 /**
index 6c724d2..040472e 100644 (file)
@@ -119,12 +119,6 @@ Cpu::Cpu(Model* model, simgrid::s4u::Host* host, lmm_constraint_t constraint, st
 
 Cpu::~Cpu() = default;
 
-/** @brief The amount of flop per second that this CPU can compute at its current DVFS level */
-double Cpu::getPstateSpeedCurrent()
-{
-  return speed_.peak;
-}
-
 int Cpu::getNbPStates()
 {
   return speedPerPstate_.size();
index c369f3a..ed0aa26 100644 (file)
@@ -105,7 +105,6 @@ public:
   virtual double getAvailableSpeed();
 
   /** @brief Get the current Cpu computational speed */
-  virtual double getPstateSpeedCurrent();
   virtual double getPstateSpeed(int pstate_index);
 
   virtual int getNbPStates();
index 8ec4394..8386f55 100644 (file)
@@ -245,7 +245,7 @@ void sg_instr_new_host(simgrid::s4u::Host& host)
       speed = PJ_type_variable_new ("power", nullptr, container->type);
     }
 
-    double current_speed_state = host.getPstateSpeedCurrent();
+    double current_speed_state = host.speed();
     new_pajeSetVariable (0, container, speed, current_speed_state);
   }
   if (TRACE_uncategorized()){
index a604f3c..8d701b7 100644 (file)
@@ -111,7 +111,7 @@ void HostEnergy::update()
   double start_time  = this->last_updated;
   double finish_time = surf_get_clock();
   double cpu_load;
-  double current_speed = host->pimpl_cpu->getPstateSpeedCurrent();
+  double current_speed = host->speed();
   if (current_speed <= 0)
     // Some users declare a pstate of speed 0 flops (e.g., to model boot time).
     // We consider that the machine is then fully loaded. That's arbitrary but it avoids a NaN