{
double start_time = this->last_updated_;
double finish_time = surf_get_clock();
-
+ //
+ // We may have start == finish if the past consumption was updated since the simcall was started
+ // for example if 2 actors requested to update the same host's consumption in a given scheduling round.
+ //
+ // Even in this case, we need to save the pstate for the next call (after this if),
+ // which may have changed since that recent update.
if (start_time < finish_time) {
double previous_energy = this->total_energy_;
double current_speed = host_->get_speed();
double cpu_load;
- // We may have start == finish if the past consumption was updated since the simcall was started
- // for example if 2 actors requested to update the same host's consumption in a given scheduling round.
- //
- // Even in this case, we need to save the pstate for the next call (after this big if),
- // which may have changed since that recent update.
if (current_speed <= 0)
// Some users declare a pstate of speed 0 flops (e.g., to model boot time).
#if HAVE_PAPI
typedef std::vector<std::pair</* counter name */ std::string, /* counter value */ long long>> papi_counter_t;
+struct papi_process_data {
+ papi_counter_t counter_data;
+ int event_set;
+};
+extern std::map</* computation unit name */ std::string, papi_process_data> units2papi_setup;
#endif
extern std::unordered_map<std::string, double> location2speedup;
TRACE_smpi_setup_container(rank, sg_host_self());
#if HAVE_PAPI
- container_t container = simgrid::instr::Container::by_name(str);
+ container_t container = smpi_container(rank);
papi_counter_t counters = smpi_process()->papi_counters();
for (auto const& it : counters) {
* Check whether this variable already exists or not. Otherwise, it will be created
* multiple times but only the last one would be used...
*/
- if (s_type::getOrNull(it.first.c_str(), container->type_) == nullptr) {
- Type::variableNew(it.first.c_str(), "", container->type_);
- }
+ container->type_->by_name_or_create(it.first, "");
}
#endif
}
* An MPI function has been called and now is the right time to update
* our PAPI counters for this process.
*/
- if (simgrid::config::get_value<std::string>("smpi/papi-events")[0] != '\0') {
+ if (not simgrid::config::get_value<std::string>("smpi/papi-events").empty()) {
papi_counter_t& counter_data = smpi_process()->papi_counters();
int event_set = smpi_process()->papi_event_set();
std::vector<long long> event_values = std::vector<long long>(counter_data.size());
}
#if HAVE_PAPI
- if (simgrid::config::get_value<std::string>("smpi/papi-events")[0] != '\0' && TRACE_smpi_is_enabled()) {
+ if (not simgrid::config::get_value<std::string>("smpi/papi-events").empty() && TRACE_smpi_is_enabled()) {
container_t container =
- new simgrid::instr::Container(std::string("rank-") + std::to_string(simgrid::s4u::this_actor::get_pid()));
+ simgrid::instr::Container::by_name(std::string("rank-") + std::to_string(simgrid::s4u::this_actor::get_pid()));
papi_counter_t& counter_data = smpi_process()->papi_counters();
for (auto const& pair : counter_data) {
- new simgrid::instr::SetVariableEvent(
- surf_get_clock(), container, PJ_type_get(/* countername */ pair.first.c_str(), container->type), pair.second);
+ simgrid::instr::VariableType* variable = static_cast<simgrid::instr::VariableType*>(container->type_->by_name(pair.first));
+ variable->set_event(surf_get_clock(), pair.second);
}
}
#endif
#if HAVE_PAPI
#include "papi.h"
-const char* papi_default_config_name = "default";
-
-struct papi_process_data {
- papi_counter_t counter_data;
- int event_set;
-};
+std::string papi_default_config_name = "default";
+std::map</* computation unit name */ std::string, papi_process_data> units2papi_setup;
#endif
using simgrid::s4u::Actor;
// This map holds for each computation unit (such as "default" or "process1" etc.)
// the configuration as given by the user (counter data as a pair of (counter_name, counter_counter))
// and the (computed) event_set.
- std::map</* computation unit name */ std::string, papi_process_data> units2papi_setup;
if (not simgrid::config::get_value<std::string>("smpi/papi-events").empty()) {
if (PAPI_library_init(PAPI_VER_CURRENT) != PAPI_VER_CURRENT)
XBT_ERROR("Could not initialize PAPI library; is it correctly installed and linked?"
- " Expected version is %i",
- PAPI_VER_CURRENT);
+ " Expected version is %u", PAPI_VER_CURRENT);
typedef boost::tokenizer<boost::char_separator<char>> Tokenizer;
boost::char_separator<char> separator_units(";");
#include "src/msg/msg_private.hpp"
#include "src/simix/smx_private.hpp"
+#if HAVE_PAPI
+#include "papi.h"
+extern std::string papi_default_config_name;
+#endif
+
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_process, smpi, "Logging specific to SMPI (kernel)");
namespace simgrid{
MC_ignore_heap(timer_, xbt_os_timer_size());
#if HAVE_PAPI
- if (simgrid::config::get_value<std::string>("smpi/papi-events")[0] != '\0') {
+ if (not simgrid::config::get_value<std::string>("smpi/papi-events").empty()) {
// TODO: Implement host/process/thread based counters. This implementation
// just always takes the values passed via "default", like this:
// "default:COUNTER1:COUNTER2:COUNTER3;".
if (it != units2papi_setup.end()) {
papi_event_set_ = it->second.event_set;
papi_counter_data_ = it->second.counter_data;
- XBT_DEBUG("Setting PAPI set for process %i", i);
+ XBT_DEBUG("Setting PAPI set for process %li", actor->get_pid());
} else {
papi_event_set_ = PAPI_NULL;
- XBT_DEBUG("No PAPI set for process %i", i);
+ XBT_DEBUG("No PAPI set for process %li", actor->get_pid());
}
}
#endif
std::set<std::string> watched_hosts;
extern std::map<std::string, simgrid::surf::StorageType*> storage_types;
+#include <simgrid/plugins/dvfs.h> // FIXME: this plug-in should not be linked to the core
#include <simgrid/plugins/energy.h> // FIXME: this plug-in should not be linked to the core
#include <simgrid/plugins/load.h> // FIXME: this plug-in should not be linked to the core
s_surf_model_description_t surf_plugin_description[] = {
{"host_energy", "Cpu energy consumption.", &sg_host_energy_plugin_init},
{"link_energy", "Link energy consumption.", &sg_link_energy_plugin_init},
+ {"host_dvfs", "Dvfs support", &sg_host_dvfs_plugin_init},
{"host_load", "Cpu load.", &sg_host_load_plugin_init},
{nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
};
option(enable_jedule "Jedule output of SimDAG." off)
if(WIN32)
- option(enable_smpi "Whether SMPI in included in library." off)
+ option(enable_smpi "Whether SMPI is included in the library." off)
option(enable_smpi_MPICH3_testsuite "Whether the test suite form MPICH 3 should be built" off)
else()
- option(enable_smpi "Whether SMPI in included in library." on)
+ option(enable_smpi "Whether SMPI is included in the library." on)
# PAPI does not support windows (they did in 3.7, but not anymore in 5.x)
# See http://icl.cs.utk.edu/papi/custom/index.html?lid=62&slid=96
option(enable_smpi_papi "Whether SMPI supports PAPI bindings." off)
-Denable_compile_optimizations=OFF -Denable_compile_warnings=ON \
-Denable_jedule=ON -Denable_mallocators=ON \
-Denable_smpi=ON -Denable_smpi_MPICH3_testsuite=ON -Denable_model-checking=ON \
+ -Denable_smpi_papi=ON \
-Denable_memcheck=OFF -Denable_memcheck_xml=OFF -Denable_smpi_ISP_testsuite=ON -Denable_coverage=ON $WORKSPACE
make -j$NUMPROC