From: Frederic Suter Date: Thu, 5 Jul 2018 13:08:51 +0000 (+0200) Subject: Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid X-Git-Tag: v3_21~560 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/1bd7cbc6f7c9069a69935f33ab7867de949babe7?hp=d8e688dbb6900e672d3d36acea16bb421ea1a50b Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid --- diff --git a/src/plugins/host_energy.cpp b/src/plugins/host_energy.cpp index 734f5ea174..1e7bdb7b46 100644 --- a/src/plugins/host_energy.cpp +++ b/src/plugins/host_energy.cpp @@ -157,7 +157,12 @@ void HostEnergy::update() { 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_; @@ -224,11 +229,6 @@ double HostEnergy::get_current_watts_value() 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). diff --git a/src/smpi/include/private.hpp b/src/smpi/include/private.hpp index 68a8108e00..502cee5ce7 100644 --- a/src/smpi/include/private.hpp +++ b/src/smpi/include/private.hpp @@ -427,6 +427,11 @@ XBT_PRIVATE smpi_privatization_region_t smpi_init_global_memory_segment_process( #if HAVE_PAPI typedef std::vector> papi_counter_t; +struct papi_process_data { + papi_counter_t counter_data; + int event_set; +}; +extern std::map units2papi_setup; #endif extern std::unordered_map location2speedup; diff --git a/src/smpi/internals/instr_smpi.cpp b/src/smpi/internals/instr_smpi.cpp index 57ac211726..504f43c835 100644 --- a/src/smpi/internals/instr_smpi.cpp +++ b/src/smpi/internals/instr_smpi.cpp @@ -187,7 +187,7 @@ void TRACE_smpi_init(int rank) 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) { @@ -195,9 +195,7 @@ void TRACE_smpi_init(int rank) * 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 } diff --git a/src/smpi/internals/smpi_bench.cpp b/src/smpi/internals/smpi_bench.cpp index 56b211e352..ac7f78ca32 100644 --- a/src/smpi/internals/smpi_bench.cpp +++ b/src/smpi/internals/smpi_bench.cpp @@ -119,7 +119,7 @@ void smpi_bench_end() * 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("smpi/papi-events")[0] != '\0') { + if (not simgrid::config::get_value("smpi/papi-events").empty()) { papi_counter_t& counter_data = smpi_process()->papi_counters(); int event_set = smpi_process()->papi_event_set(); std::vector event_values = std::vector(counter_data.size()); @@ -159,14 +159,14 @@ void smpi_bench_end() } #if HAVE_PAPI - if (simgrid::config::get_value("smpi/papi-events")[0] != '\0' && TRACE_smpi_is_enabled()) { + if (not simgrid::config::get_value("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(container->type_->by_name(pair.first)); + variable->set_event(surf_get_clock(), pair.second); } } #endif diff --git a/src/smpi/internals/smpi_global.cpp b/src/smpi/internals/smpi_global.cpp index 9518a17884..3ce72e12f4 100644 --- a/src/smpi/internals/smpi_global.cpp +++ b/src/smpi/internals/smpi_global.cpp @@ -51,12 +51,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_kernel, smpi, "Logging specific to SMPI (ke #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 units2papi_setup; #endif using simgrid::s4u::Actor; @@ -279,13 +275,11 @@ void smpi_global_init() // 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 units2papi_setup; if (not simgrid::config::get_value("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> Tokenizer; boost::char_separator separator_units(";"); diff --git a/src/smpi/internals/smpi_process.cpp b/src/smpi/internals/smpi_process.cpp index 2bf2d1166e..996fc71c24 100644 --- a/src/smpi/internals/smpi_process.cpp +++ b/src/smpi/internals/smpi_process.cpp @@ -10,6 +10,11 @@ #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{ @@ -30,7 +35,7 @@ Process::Process(ActorPtr actor, simgrid::s4u::Barrier* finalization_barrier) MC_ignore_heap(timer_, xbt_os_timer_size()); #if HAVE_PAPI - if (simgrid::config::get_value("smpi/papi-events")[0] != '\0') { + if (not simgrid::config::get_value("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;". @@ -38,10 +43,10 @@ Process::Process(ActorPtr actor, simgrid::s4u::Barrier* finalization_barrier) 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 diff --git a/src/surf/surf_interface.cpp b/src/surf/surf_interface.cpp index a569bcdcbd..db2ad1fb11 100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@ -36,12 +36,14 @@ std::vector host_that_restart; std::set watched_hosts; extern std::map storage_types; +#include // FIXME: this plug-in should not be linked to the core #include // FIXME: this plug-in should not be linked to the core #include // 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 */ }; diff --git a/tools/cmake/Option.cmake b/tools/cmake/Option.cmake index d3f789998e..32a5b24eb8 100644 --- a/tools/cmake/Option.cmake +++ b/tools/cmake/Option.cmake @@ -34,10 +34,10 @@ option(enable_model-checking "Turn this on to experiment with our prototype of m 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) diff --git a/tools/jenkins/Coverage.sh b/tools/jenkins/Coverage.sh index b301313be2..07e40d778b 100755 --- a/tools/jenkins/Coverage.sh +++ b/tools/jenkins/Coverage.sh @@ -54,6 +54,7 @@ cmake -Denable_documentation=OFF -Denable_lua=ON -Denable_java=ON \ -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