Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 5 Jul 2018 13:08:51 +0000 (15:08 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 5 Jul 2018 13:08:51 +0000 (15:08 +0200)
src/plugins/host_energy.cpp
src/smpi/include/private.hpp
src/smpi/internals/instr_smpi.cpp
src/smpi/internals/smpi_bench.cpp
src/smpi/internals/smpi_global.cpp
src/smpi/internals/smpi_process.cpp
src/surf/surf_interface.cpp
tools/cmake/Option.cmake
tools/jenkins/Coverage.sh

index 734f5ea..1e7bdb7 100644 (file)
@@ -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).
index 68a8108..502cee5 100644 (file)
@@ -427,6 +427,11 @@ XBT_PRIVATE smpi_privatization_region_t smpi_init_global_memory_segment_process(
 
 #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;
index 57ac211..504f43c 100644 (file)
@@ -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
 }
index 56b211e..ac7f78c 100644 (file)
@@ -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<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());
@@ -159,14 +159,14 @@ void smpi_bench_end()
   }
 
 #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
index 9518a17..3ce72e1 100644 (file)
@@ -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</* computation unit name */ std::string, papi_process_data> 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</* 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(";");
index 2bf2d11..996fc71 100644 (file)
 #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<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;".
@@ -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
index a569bcd..db2ad1f 100644 (file)
@@ -36,12 +36,14 @@ std::vector<simgrid::s4u::Host*> host_that_restart;
 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 */
 };
index d3f7899..32a5b24 100644 (file)
@@ -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)
index b301313..07e40d7 100755 (executable)
@@ -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