From 4b8feb2f921bf25aa725cc7ea0b306195b55bb1b Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Mon, 13 Mar 2017 23:53:10 +0100 Subject: [PATCH] Drop s4u::Host::getPstateSpeedCurrent() which dupplicates Host::speed() 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. --- ChangeLog | 2 ++ examples/java/energy/pstate/energy_pstate.tesh | 2 +- examples/msg/energy-pstate/energy-pstate.tesh | 8 ++++---- include/simgrid/msg.h | 10 ++++------ include/simgrid/s4u/host.hpp | 1 - src/msg/msg_host.cpp | 11 ----------- src/s4u/s4u_host.cpp | 13 +++---------- src/smpi/smpi_dvfs.cpp | 2 +- src/surf/cpu_interface.cpp | 6 ------ src/surf/cpu_interface.hpp | 1 - src/surf/instr_routing.cpp | 2 +- src/surf/plugins/host_energy.cpp | 2 +- 12 files changed, 17 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index 037b902301..d7bfa97605 100644 --- 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 diff --git a/examples/java/energy/pstate/energy_pstate.tesh b/examples/java/energy/pstate/energy_pstate.tesh index 036c4ee27d..7830de7b16 100644 --- a/examples/java/energy/pstate/energy_pstate.tesh +++ b/examples/java/energy/pstate/energy_pstate.tesh @@ -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... diff --git a/examples/msg/energy-pstate/energy-pstate.tesh b/examples/msg/energy-pstate/energy-pstate.tesh index 66282649d0..48a3f1a5f8 100644 --- a/examples/msg/energy-pstate/energy-pstate.tesh +++ b/examples/msg/energy-pstate/energy-pstate.tesh @@ -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 diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index 0c0a6bb386..d431064bcd 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -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); diff --git a/include/simgrid/s4u/host.hpp b/include/simgrid/s4u/host.hpp index 77c4a7be32..e2eb92cd8a 100644 --- a/include/simgrid/s4u/host.hpp +++ b/include/simgrid/s4u/host.hpp @@ -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); diff --git a/src/msg/msg_host.cpp b/src/msg/msg_host.cpp index 968ae5d882..7bef21b2f5 100644 --- a/src/msg/msg_host.cpp +++ b/src/msg/msg_host.cpp @@ -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. * diff --git a/src/s4u/s4u_host.cpp b/src/s4u/s4u_host.cpp index 284d0d69be..f792b9c951 100644 --- a/src/s4u/s4u_host.cpp +++ b/src/s4u/s4u_host.cpp @@ -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(); diff --git a/src/smpi/smpi_dvfs.cpp b/src/smpi/smpi_dvfs.cpp index efd24c3f32..6088ab5a9c 100644 --- a/src/smpi/smpi_dvfs.cpp +++ b/src/smpi/smpi_dvfs.cpp @@ -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(); } /** diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index 6c724d2d29..040472e35d 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -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(); diff --git a/src/surf/cpu_interface.hpp b/src/surf/cpu_interface.hpp index c369f3af86..ed0aa26a70 100644 --- a/src/surf/cpu_interface.hpp +++ b/src/surf/cpu_interface.hpp @@ -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(); diff --git a/src/surf/instr_routing.cpp b/src/surf/instr_routing.cpp index 8ec439459d..8386f557fb 100644 --- a/src/surf/instr_routing.cpp +++ b/src/surf/instr_routing.cpp @@ -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()){ diff --git a/src/surf/plugins/host_energy.cpp b/src/surf/plugins/host_energy.cpp index a604f3c4a8..8d701b7493 100644 --- a/src/surf/plugins/host_energy.cpp +++ b/src/surf/plugins/host_energy.cpp @@ -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 -- 2.20.1