Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid
authorMartin Quinson <martin.quinson@loria.fr>
Tue, 17 Apr 2018 14:29:42 +0000 (16:29 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 17 Apr 2018 14:29:42 +0000 (16:29 +0200)
52 files changed:
TODO
examples/s4u/routing-get-clusters/s4u-routing-get-clusters.cpp
include/simgrid/jedule/jedule.hpp
include/simgrid/jedule/jedule_events.hpp
include/simgrid/jedule/jedule_platform.hpp
include/simgrid/kernel/routing/DragonflyZone.hpp
include/simgrid/kernel/routing/RoutedZone.hpp
include/simgrid/simix.hpp
src/bindings/java/jxbt_utilities.hpp
src/bindings/lua/lua_private.hpp
src/bindings/lua/lua_utils.hpp
src/include/instr/instr_interface.hpp [moved from src/include/instr/instr_interface.h with 79% similarity]
src/instr/instr_config.cpp
src/instr/instr_paje_containers.cpp
src/instr/instr_paje_events.cpp
src/instr/instr_paje_events.hpp
src/instr/instr_paje_types.cpp
src/instr/instr_paje_values.cpp
src/instr/instr_private.hpp
src/instr/instr_smpi.hpp
src/kernel/activity/ConditionVariableImpl.cpp
src/kernel/context/Context.hpp
src/kernel/context/ContextUnix.cpp
src/kernel/routing/DragonflyZone.cpp
src/kernel/routing/TorusZone.cpp
src/mc/mc_client_api.cpp
src/mc/mc_comm_pattern.hpp
src/mc/mc_ignore.hpp [moved from src/mc/mc_ignore.h with 72% similarity]
src/mc/mc_private.hpp
src/mc/mc_smx.hpp
src/mc/mc_snapshot.hpp
src/msg/msg_global.cpp
src/s4u/s4u_engine.cpp
src/simdag/sd_global.cpp
src/simdag/simdag_private.hpp
src/simgrid/sg_config.cpp
src/simix/ActorImpl.hpp
src/simix/popping_private.hpp
src/simix/smx_host_private.hpp
src/simix/smx_private.hpp
src/smpi/include/private.hpp
src/smpi/include/smpi_utils.hpp
src/smpi/internals/smpi_replay.cpp
src/surf/ns3/ns3_simulator.hpp
src/surf/plugins/host_dvfs.cpp
src/surf/surf_interface.cpp
src/surf/surf_private.hpp
src/surf/xml/platf.hpp
src/surf/xml/platf_private.hpp
src/surf/xml/surfxml_parseplatf.cpp
teshsuite/smpi/mpich3-test/rma/CMakeLists.txt
tools/cmake/DefinePackages.cmake

diff --git a/TODO b/TODO
index 6825a49..be9aa13 100644 (file)
--- a/TODO
+++ b/TODO
@@ -24,6 +24,3 @@
      to get the list of files to pack.
 
 * Replace XBT with the C++ standard library
-
-* Some XBT datacontainers seem to overlap. Kill some/all of them.
-    - replace set with SWAG
index 51843c1..602c222 100644 (file)
@@ -40,7 +40,7 @@ int main(int argc, char* argv[])
       XBT_INFO("%s' dragonfly topology:", d->get_cname());
       for (int i = 0; i < d->getHostCount(); i++) {
         unsigned int coords[4];
-        d->rankId_to_coords(i, &coords);
+        d->rankId_to_coords(i, coords);
         XBT_INFO("   %d: (%u, %u, %u, %u)", i, coords[0], coords[1], coords[2], coords[3]);
       }
     }
index dcc32d4..5381697 100644 (file)
@@ -32,9 +32,7 @@ public:
 }
 }
 
-extern "C" {
 typedef simgrid::jedule::Jedule *jedule_t;
-}
 #endif
 
 #endif /* JEDULE_HPP_ */
index 4362ffe..5ab0f8f 100644 (file)
@@ -40,10 +40,7 @@ private:
 }
 }
 
-extern "C" {
 typedef simgrid::jedule::Event* jed_event_t;
-}
-
 #endif
 
 #endif /* JEDULE_EVENTS_H_ */
index 9d02ade..e076f29 100644 (file)
@@ -51,11 +51,9 @@ public:
 
 }
 }
-extern "C" {
 typedef simgrid::jedule::Container * jed_container_t;
 typedef simgrid::jedule::Subset * jed_subset_t;
 void get_resource_selection_by_hosts(std::vector<jed_subset_t>* subset_list, std::vector<sg_host_t> *host_list);
-}
 
 #endif
 
index 2db8af0..d1efcd1 100644 (file)
@@ -71,7 +71,7 @@ public:
   void generateLinks();
   void createLink(const std::string& id, int numlinks, resource::LinkImpl** linkup, resource::LinkImpl** linkdown);
 
-  void rankId_to_coords(int rankId, unsigned int (*coords)[4]);
+  void rankId_to_coords(int rankId, unsigned int coords[4]);
 
 private:
   simgrid::s4u::Link::SharingPolicy sharing_policy_;
index 60bb1d5..443cd4e 100644 (file)
@@ -67,11 +67,9 @@ protected:
 } // namespace kernel
 } // namespace simgrid
 
-extern "C" {
 XBT_PRIVATE xbt_node_t new_xbt_graph_node(xbt_graph_t graph, const char* name,
                                           std::map<std::string, xbt_node_t>* nodes);
 XBT_PRIVATE xbt_edge_t new_xbt_graph_edge(xbt_graph_t graph, xbt_node_t s, xbt_node_t d,
                                           std::map<std::string, xbt_edge_t>* edges);
-}
 
 #endif /* SIMGRID_ROUTING_GENERIC_HPP_ */
index ac29c00..172ebe9 100644 (file)
@@ -83,7 +83,7 @@ XBT_PUBLIC void registerFunction(const char* name, ActorCodeFactory factory);
  *
  * If these functions manage to unlock some of the processes, then the deadlock will be avoided.
  */
-extern simgrid::xbt::signal<void()> onDeadlock;
+XBT_PUBLIC_DATA simgrid::xbt::signal<void()> onDeadlock;
 }
 }
 
@@ -105,7 +105,7 @@ typedef smx_actor_t (*smx_creation_func_t)(
     /* props */ std::map<std::string, std::string>*,
     /* parent_process */ smx_actor_t);
 
-extern "C" XBT_PUBLIC void SIMIX_function_register_process_create(smx_creation_func_t function);
+XBT_PUBLIC void SIMIX_function_register_process_create(smx_creation_func_t function);
 
 XBT_PUBLIC smx_actor_t simcall_process_create(const char* name, std::function<void()> code, void* data, sg_host_t host,
                                               std::map<std::string, std::string>* properties);
index 964d57a..3a9a64c 100644 (file)
@@ -12,8 +12,6 @@
 #include <jni.h>
 #include <string>
 
-extern "C" {
-
 /* Search a class and throw an exception if not found */
 jclass jxbt_get_class(JNIEnv* env, const char* name);
 
@@ -75,5 +73,5 @@ void jxbt_throw_time_out_failure(JNIEnv* env, std::string details);
 void jxbt_throw_task_cancelled(JNIEnv* env, std::string details);
 /** Thrown when looking for a storage from name does not lead to anything */
 void jxbt_throw_storage_not_found(JNIEnv* env, std::string invalid_name);
-}
+
 #endif
index 9b6110f..3243ec3 100644 (file)
 #include "simgrid/msg.h"
 #include "simgrid_lua.hpp"
 
-extern "C" {
-
 void sglua_register_host_functions(lua_State* L);
 msg_host_t sglua_check_host(lua_State* L, int index);
 
 void sglua_register_platf_functions(lua_State* L);
-}
 
 #define lua_ensure(...) _XBT_IF_ONE_ARG(_lua_ensure_ARG1, _lua_ensure_ARGN, __VA_ARGS__)(__VA_ARGS__)
 #define _lua_ensure_ARG1(cond) _lua_ensure_ARGN(cond, "Assertion %s failed", #cond)
index 11e0a89..5b23cfb 100644 (file)
@@ -8,8 +8,6 @@
 #ifndef LUA_UTILS_HPP
 #define LUA_UTILS_HPP
 
-extern "C" {
-
 #include <lua.h>
 
 /**
@@ -31,6 +29,5 @@ static int sglua_dump_table(lua_State* L);
 void* sglua_checkudata_debug(lua_State* L, int ud, const char* tname);
 const char* sglua_get_spaces(int length);
 int sglua_memory_writer(lua_State* L, const void* source, size_t size, void* userdata);
-}
 
 #endif
similarity index 79%
rename from src/include/instr/instr_interface.h
rename to src/include/instr/instr_interface.hpp
index e31aea6..e4cdb94 100644 (file)
@@ -3,18 +3,14 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#ifndef SIMGRID_INSTR_INTERFACE_H
-#define SIMGRID_INSTR_INTERFACE_H
+#ifndef SIMGRID_INSTR_INTERFACE_HPP
+#define SIMGRID_INSTR_INTERFACE_HPP
 
 #include "xbt.h"
 
-SG_BEGIN_DECL()
-
 XBT_PUBLIC int TRACE_start();
 XBT_PUBLIC int TRACE_end();
 XBT_PUBLIC void TRACE_global_init();
 XBT_PUBLIC void TRACE_help(int detailed);
 
-SG_END_DECL()
-
 #endif
index fb4d44d..5726f1f 100644 (file)
@@ -59,7 +59,7 @@ static bool trace_disable_power;
 static bool trace_configured = false;
 static bool trace_active     = false;
 
-instr_fmt_type_t instr_fmt_type = instr_fmt_paje;
+simgrid::instr::TraceFormat simgrid::instr::trace_format = simgrid::instr::TraceFormat::Paje;
 
 static void TRACE_getopts()
 {
@@ -102,7 +102,7 @@ int TRACE_start()
     if (format == "Paje") {
       TRACE_paje_start();
     } else if (format == "TI") {
-      instr_fmt_type = instr_fmt_TI;
+      simgrid::instr::trace_format = simgrid::instr::TraceFormat::Ti;
       TRACE_TI_start();
     }else{
       xbt_die("Unknown trace format :%s ", format.c_str());
index 68fadc0..23f44b3 100644 (file)
@@ -150,12 +150,12 @@ void Container::logCreation()
 
   XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, PAJE_CreateContainer, timestamp);
 
-  if (instr_fmt_type == instr_fmt_paje) {
+  if (trace_format == simgrid::instr::TraceFormat::Paje) {
     stream << std::fixed << std::setprecision(TRACE_precision()) << PAJE_CreateContainer << " ";
     stream << timestamp << " " << id_ << " " << type_->get_id() << " " << father_->id_ << " \"" << name_ << "\"";
     XBT_DEBUG("Dump %s", stream.str().c_str());
     fprintf(tracing_file, "%s\n", stream.str().c_str());
-  } else if (instr_fmt_type == instr_fmt_TI) {
+  } else if (trace_format == simgrid::instr::TraceFormat::Ti) {
     // if we are in the mode with only one file
     static FILE* ti_unique_file = nullptr;
 
@@ -189,12 +189,12 @@ void Container::logDestruction()
 
   XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, PAJE_DestroyContainer, timestamp);
 
-  if (instr_fmt_type == instr_fmt_paje) {
+  if (trace_format == simgrid::instr::TraceFormat::Paje) {
     stream << std::fixed << std::setprecision(TRACE_precision()) << PAJE_DestroyContainer << " ";
     stream << timestamp << " " << type_->get_id() << " " << id_;
     XBT_DEBUG("Dump %s", stream.str().c_str());
     fprintf(tracing_file, "%s\n", stream.str().c_str());
-  } else if (instr_fmt_type == instr_fmt_TI) {
+  } else if (trace_format == simgrid::instr::TraceFormat::Ti) {
     if (not xbt_cfg_get_boolean("tracing/smpi/format/ti-one-file") || tracing_files.size() == 1) {
       fclose(tracing_files.at(this));
     }
index c6f615c..4aacda9 100644 (file)
@@ -15,42 +15,16 @@ std::map<container_t, FILE*> tracing_files; // TI specific
 namespace simgrid {
 namespace instr {
 
-NewEvent::NewEvent(double timestamp, container_t container, Type* type, EntityValue* val)
-    : simgrid::instr::PajeEvent::PajeEvent(container, type, timestamp, PAJE_NewEvent), val(val)
+PajeEvent::PajeEvent(Container* container, Type* type, double timestamp, e_event_type eventType)
+    : container_(container), type_(type), timestamp_(timestamp), eventType_(eventType)
 {
-  XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, eventType_, timestamp_);
-  insertIntoBuffer();
-}
-
-LinkEvent::LinkEvent(container_t container, Type* type, e_event_type event_type, container_t endpoint,
-                     std::string value, std::string key)
-    : LinkEvent(container, type, event_type, endpoint, value, key, -1)
-{
-}
-
-LinkEvent::LinkEvent(container_t container, Type* type, e_event_type event_type, container_t endpoint,
-                     std::string value, std::string key, int size)
-    : PajeEvent(container, type, SIMIX_get_clock(), event_type)
-    , endpoint_(endpoint)
-    , value_(value)
-    , key_(key)
-    , size_(size)
-{
-  XBT_DEBUG("%s: event_type=%u, timestamp=%f, value:%s", __func__, eventType_, timestamp_, value_.c_str());
-  insertIntoBuffer();
-}
-
-VariableEvent::VariableEvent(double timestamp, Container* container, Type* type, e_event_type event_type, double value)
-    : PajeEvent::PajeEvent(container, type, timestamp, event_type), value(value)
-{
-  XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, eventType_, timestamp_);
+  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, eventType_, TRACE_precision(), timestamp_);
+  if (trace_format == simgrid::instr::TraceFormat::Paje) {
+    stream_ << std::fixed << std::setprecision(TRACE_precision());
+    stream_ << eventType_ << " " << timestamp_ << " " << type_->get_id() << " " << container_->get_id();
+  }
   insertIntoBuffer();
-}
-
-StateEvent::StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value)
-    : StateEvent(container, type, event_type, value, nullptr)
-{
-}
+};
 
 StateEvent::StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value, TIData* extra)
     : PajeEvent::PajeEvent(container, type, SIMIX_get_clock(), event_type), value(value), extra_(extra)
@@ -61,83 +35,63 @@ StateEvent::StateEvent(Container* container, Type* type, e_event_type event_type
     filename                        = loc->filename;
     linenumber                      = loc->linenumber;
   }
-#else
-  filename   = "(null)";
-  linenumber = -1;
 #endif
-
-  XBT_DEBUG("%s: event_type=%u, timestamp=%f", __func__, eventType_, timestamp_);
-  insertIntoBuffer();
-};
+}
 
 void NewEvent::print()
 {
-  std::stringstream stream;
-  stream << std::fixed << std::setprecision(TRACE_precision());
-  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, eventType_, TRACE_precision(), timestamp_);
-  if (instr_fmt_type != instr_fmt_paje)
+  if (trace_format != simgrid::instr::TraceFormat::Paje)
     return;
 
-  stream << eventType_ << " " << timestamp_ << " ";
-  stream << getType()->get_id() << " " << getContainer()->get_id() << " " << val->getId();
-  XBT_DEBUG("Dump %s", stream.str().c_str());
-  fprintf(tracing_file, "%s\n", stream.str().c_str());
+  stream_ << " " << value->getId();
+
+  XBT_DEBUG("Dump %s", stream_.str().c_str());
+  fprintf(tracing_file, "%s\n", stream_.str().c_str());
 }
 
 void LinkEvent::print()
 {
-  std::stringstream stream;
-  stream << std::fixed << std::setprecision(TRACE_precision());
-  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, eventType_, TRACE_precision(), timestamp_);
-  if (instr_fmt_type != instr_fmt_paje)
+  if (trace_format != simgrid::instr::TraceFormat::Paje)
     return;
-  stream << eventType_ << " " << timestamp_ << " " << getType()->get_id() << " " << getContainer()->get_id();
 
-  stream << " " << value_ << " " << endpoint_->get_id() << " " << key_;
+  stream_ << " " << value_ << " " << endpoint_->get_id() << " " << key_;
 
-  if (TRACE_display_sizes()) {
-    stream << " " << size_;
-  }
-  XBT_DEBUG("Dump %s", stream.str().c_str());
-  fprintf(tracing_file, "%s\n", stream.str().c_str());
+  if (TRACE_display_sizes())
+    stream_ << " " << size_;
+
+  XBT_DEBUG("Dump %s", stream_.str().c_str());
+  fprintf(tracing_file, "%s\n", stream_.str().c_str());
 }
 
 void VariableEvent::print()
 {
-  std::stringstream stream;
-  stream << std::fixed << std::setprecision(TRACE_precision());
-  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, eventType_, TRACE_precision(), timestamp_);
-  if (instr_fmt_type != instr_fmt_paje)
+  if (trace_format != simgrid::instr::TraceFormat::Paje)
     return;
 
-  stream << eventType_ << " " << timestamp_ << " ";
-  stream << getType()->get_id() << " " << getContainer()->get_id() << " " << value;
-  XBT_DEBUG("Dump %s", stream.str().c_str());
-  fprintf(tracing_file, "%s\n", stream.str().c_str());
+  stream_ << " " << value;
+
+  XBT_DEBUG("Dump %s", stream_.str().c_str());
+  fprintf(tracing_file, "%s\n", stream_.str().c_str());
 }
 
 void StateEvent::print()
 {
-  std::stringstream stream;
-  stream << std::fixed << std::setprecision(TRACE_precision());
-  XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, eventType_, TRACE_precision(), timestamp_);
-  if (instr_fmt_type == instr_fmt_paje) {
-    stream << eventType_ << " " << timestamp_ << " " << getType()->get_id() << " " << getContainer()->get_id();
+  if (trace_format == simgrid::instr::TraceFormat::Paje) {
 
     if (value != nullptr) // PAJE_PopState Event does not need to have a value
-      stream << " " << value->getId();
+      stream_ << " " << value->getId();
 
     if (TRACE_display_sizes())
-      stream << " " << ((extra_ != nullptr) ? extra_->display_size() : 0);
+      stream_ << " " << ((extra_ != nullptr) ? extra_->display_size() : 0);
 
 #if HAVE_SMPI
     if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
-      stream << " \"" << filename << "\" " << linenumber;
+      stream_ << " \"" << filename << "\" " << linenumber;
     }
 #endif
-    XBT_DEBUG("Dump %s", stream.str().c_str());
-    fprintf(tracing_file, "%s\n", stream.str().c_str());
-  } else if (instr_fmt_type == instr_fmt_TI) {
+    XBT_DEBUG("Dump %s", stream_.str().c_str());
+    fprintf(tracing_file, "%s\n", stream_.str().c_str());
+  } else if (trace_format == simgrid::instr::TraceFormat::Ti) {
     if (extra_ == nullptr)
       return;
 
@@ -145,12 +99,12 @@ void StateEvent::print()
 
     // FIXME: dirty extract "rank-" from the name, as we want the bare process id here
     if (getContainer()->get_name().find("rank-") != 0)
-      stream << getContainer()->get_name() << " " << extra_->print();
+      stream_ << getContainer()->get_name() << " " << extra_->print();
     else
       /* Subtract -1 because this is the process id and we transform it to the rank id */
-      stream << stoi(getContainer()->get_name().erase(0, 5)) - 1 << " " << extra_->print();
+      stream_ << stoi(getContainer()->get_name().erase(0, 5)) - 1 << " " << extra_->print();
 
-    fprintf(tracing_files.at(getContainer()), "%s\n", stream.str().c_str());
+    fprintf(tracing_files.at(getContainer()), "%s\n", stream_.str().c_str());
   } else {
     THROW_IMPOSSIBLE;
   }
index c3f43c3..a3a9522 100644 (file)
@@ -7,6 +7,7 @@
 #define INSTR_PAJE_EVENTS_HPP
 
 #include "src/instr/instr_private.hpp"
+#include <sstream>
 #include <string>
 
 namespace simgrid {
@@ -38,15 +39,14 @@ enum e_event_type : unsigned int {
 class PajeEvent {
   Container* container_;
   Type* type_;
-
 protected:
-  Type* getType() { return type_; }
   Container* getContainer() { return container_; }
 public:
   double timestamp_;
   e_event_type eventType_;
-  PajeEvent(Container* container, Type* type, double timestamp, e_event_type eventType)
-      : container_(container), type_(type), timestamp_(timestamp), eventType_(eventType){};
+  std::stringstream stream_;
+
+  PajeEvent(Container* container, Type* type, double timestamp, e_event_type eventType);
   virtual ~PajeEvent() = default;
   virtual void print() = 0;
   void insertIntoBuffer();
@@ -56,18 +56,20 @@ class VariableEvent : public PajeEvent {
   double value;
 
 public:
-  VariableEvent(double timestamp, Container* container, Type* type, e_event_type event_type, double value);
+  VariableEvent(double timestamp, Container* container, Type* type, e_event_type event_type, double value)
+      : PajeEvent::PajeEvent(container, type, timestamp, event_type), value(value)
+  {
+  }
   void print() override;
 };
 
 class StateEvent : public PajeEvent {
   EntityValue* value;
-  std::string filename;
-  int linenumber = 0;
-  TIData* extra_ = nullptr;
+  std::string filename = "(null)";
+  int linenumber       = -1;
+  TIData* extra_;
 
 public:
-  StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value);
   StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value, TIData* extra);
   void print() override;
 };
@@ -80,17 +82,25 @@ class LinkEvent : public PajeEvent {
 
 public:
   LinkEvent(Container* container, Type* type, e_event_type event_type, Container* sourceContainer, std::string value,
-            std::string key);
-  LinkEvent(Container* container, Type* type, e_event_type event_type, Container* sourceContainer, std::string value,
-            std::string key, int size);
+            std::string key, int size)
+      : PajeEvent(container, type, SIMIX_get_clock(), event_type)
+      , endpoint_(sourceContainer)
+      , value_(value)
+      , key_(key)
+      , size_(size)
+  {
+  }
   void print() override;
 };
 
 class NewEvent : public PajeEvent {
-  EntityValue* val;
+  EntityValue* value;
 
 public:
-  NewEvent(double timestamp, Container* container, Type* type, EntityValue* val);
+  NewEvent(double timestamp, Container* container, Type* type, EntityValue* value)
+      : simgrid::instr::PajeEvent::PajeEvent(container, type, timestamp, PAJE_NewEvent), value(value)
+  {
+  }
   void print() override;
 };
 }
index ac58b17..c77cef2 100644 (file)
@@ -62,7 +62,7 @@ StateType::~StateType()
 
 void StateType::setEvent(std::string value_name)
 {
-  events_.push_back(new StateEvent(issuer_, this, PAJE_SetState, getEntityValue(value_name)));
+  events_.push_back(new StateEvent(issuer_, this, PAJE_SetState, getEntityValue(value_name), nullptr));
 }
 
 void StateType::pushEvent(std::string value_name, TIData* extra)
@@ -72,12 +72,12 @@ void StateType::pushEvent(std::string value_name, TIData* extra)
 
 void StateType::pushEvent(std::string value_name)
 {
-  events_.push_back(new StateEvent(issuer_, this, PAJE_PushState, getEntityValue(value_name)));
+  events_.push_back(new StateEvent(issuer_, this, PAJE_PushState, getEntityValue(value_name), nullptr));
 }
 
 void StateType::popEvent()
 {
-  events_.push_back(new StateEvent(issuer_, this, PAJE_PopState, nullptr));
+  events_.push_back(new StateEvent(issuer_, this, PAJE_PopState, nullptr, nullptr));
 }
 
 VariableType::VariableType(std::string name, std::string color, Type* father) : Type(name, name, color, father)
@@ -121,12 +121,12 @@ void LinkType::startEvent(container_t startContainer, std::string value, std::st
 
 void LinkType::endEvent(container_t endContainer, std::string value, std::string key)
 {
-  new LinkEvent(issuer_, this, PAJE_EndLink, endContainer, value, key);
+  new LinkEvent(issuer_, this, PAJE_EndLink, endContainer, value, key, -1);
 }
 
 void Type::logDefinition(e_event_type event_type)
 {
-  if (instr_fmt_type != instr_fmt_paje)
+  if (trace_format != simgrid::instr::TraceFormat::Paje)
     return;
   std::stringstream stream;
   XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, event_type, TRACE_precision(), 0.);
@@ -141,7 +141,7 @@ void Type::logDefinition(e_event_type event_type)
 
 void Type::logDefinition(simgrid::instr::Type* source, simgrid::instr::Type* dest)
 {
-  if (instr_fmt_type != instr_fmt_paje)
+  if (trace_format != simgrid::instr::TraceFormat::Paje)
     return;
   std::stringstream stream;
   XBT_DEBUG("%s: event_type=%u, timestamp=%.*f", __func__, PAJE_DefineLinkType, TRACE_precision(), 0.);
index 63da7ee..27ef1e1 100644 (file)
@@ -17,7 +17,7 @@ EntityValue::EntityValue(std::string name, std::string color, Type* father)
 
 void EntityValue::print()
 {
-  if (instr_fmt_type != instr_fmt_paje)
+  if (trace_format != simgrid::instr::TraceFormat::Paje)
     return;
   std::stringstream stream;
   XBT_DEBUG("%s: event_type=%u", __func__, PAJE_DefineEntityValue);
index 5d6d12e..4245fbe 100644 (file)
@@ -8,7 +8,7 @@
 
 #include <xbt/base.h>
 
-#include "instr/instr_interface.h"
+#include "instr/instr_interface.hpp"
 #include "simgrid/instr.h"
 #include "simgrid_config.h"
 #include "src/instr/instr_paje_containers.hpp"
@@ -37,6 +37,15 @@ typedef simgrid::instr::Container* container_t;
 namespace simgrid {
 namespace instr {
 
+/* Format of TRACING output.
+ *   - paje is the regular format, that we all know
+ *   - TI is a trick to reuse the tracing functions to generate a time independent trace during the execution. Such
+ *     trace can easily be replayed with smpi_replay afterward. This trick should be removed and replaced by some code
+ *     using the signal that we will create to cleanup the TRACING
+ */
+enum class TraceFormat { Paje, /*TimeIndependent*/ Ti };
+extern TraceFormat trace_format;
+
 class TIData {
   std::string name_;
   double amount_ = 0;
@@ -192,8 +201,6 @@ public:
 
 XBT_PRIVATE std::string instr_pid(s4u_Actor* proc);
 
-extern "C" {
-
 extern XBT_PRIVATE std::set<std::string> created_categories;
 extern XBT_PRIVATE std::set<std::string> declared_marks;
 extern XBT_PRIVATE std::set<std::string> user_host_variables;
@@ -256,15 +263,6 @@ XBT_PRIVATE void TRACE_paje_dump_buffer(bool force);
 XBT_PRIVATE void dump_comment_file(std::string filename);
 XBT_PRIVATE void dump_comment(std::string comment);
 
-/* Format of TRACING output.
- *   - paje is the regular format, that we all know
- *   - TI is a trick to reuse the tracing functions to generate a time independent trace during the execution. Such
- *     trace can easily be replayed with smpi_replay afterward. This trick should be removed and replaced by some code
- *     using the signal that we will create to cleanup the TRACING
- */
-enum instr_fmt_type_t { instr_fmt_paje, instr_fmt_TI };
-extern instr_fmt_type_t instr_fmt_type;
-}
 XBT_PRIVATE std::string TRACE_get_comment();
 XBT_PRIVATE std::string TRACE_get_comment_file();
 XBT_PRIVATE std::string TRACE_get_filename();
index 6100097..9e3c1c4 100644 (file)
@@ -12,8 +12,6 @@
 
 XBT_PRIVATE container_t smpi_container(int rank);
 
-extern "C" {
-
 XBT_PRIVATE void TRACE_internal_smpi_set_category(const char* category);
 XBT_PRIVATE const char* TRACE_internal_smpi_get_category();
 XBT_PRIVATE void TRACE_smpi_computing_init(int rank);
@@ -46,6 +44,5 @@ public:
            std::to_string(linenumber);
   }
 };
-}
 
 #endif
index 80aaae6..e284d60 100644 (file)
@@ -108,14 +108,14 @@ void ConditionVariableImpl::signal()
 
     /* Now transform the cond wait simcall into a mutex lock one */
     smx_simcall_t simcall = &proc.simcall;
-    smx_mutex_t mutex;
+    smx_mutex_t simcall_mutex;
     if (simcall->call == SIMCALL_COND_WAIT)
-      mutex = simcall_cond_wait__get__mutex(simcall);
+      simcall_mutex = simcall_cond_wait__get__mutex(simcall);
     else
-      mutex = simcall_cond_wait_timeout__get__mutex(simcall);
+      simcall_mutex = simcall_cond_wait_timeout__get__mutex(simcall);
     simcall->call = SIMCALL_MUTEX_LOCK;
 
-    simcall_HANDLER_mutex_lock(simcall, mutex);
+    simcall_HANDLER_mutex_lock(simcall, simcall_mutex);
   }
   XBT_OUT();
 }
index 443aa52..5d2b69d 100644 (file)
@@ -6,7 +6,7 @@
 #ifndef SIMGRID_KERNEL_CONTEXT_CONTEXT_HPP
 #define SIMGRID_KERNEL_CONTEXT_CONTEXT_HPP
 
-#include "instr/instr_interface.h"
+#include "instr/instr_interface.hpp"
 #include "src/internal_config.h"
 #include "src/simix/smx_network_private.hpp"
 
@@ -108,8 +108,6 @@ XBT_PRIVATE ContextFactory* boost_factory();
 
 typedef simgrid::kernel::context::ContextFactory *smx_context_factory_t;
 
-extern "C" {
-
 XBT_PRIVATE void SIMIX_context_mod_init();
 XBT_PRIVATE void SIMIX_context_mod_exit();
 
@@ -144,7 +142,6 @@ XBT_PRIVATE smx_context_t SIMIX_context_get_current();
 XBT_PUBLIC int SIMIX_process_get_maxpid();
 
 XBT_PRIVATE void SIMIX_post_create_environment();
-}
 
 XBT_PRIVATE simgrid::simix::ActorCodeFactory& SIMIX_get_actor_code_factory(const char *name);
 
index 5b9cf2f..e3df168 100644 (file)
@@ -8,7 +8,7 @@
 #include "ContextUnix.hpp"
 
 #include "mc/mc.h"
-#include "src/mc/mc_ignore.h"
+#include "src/mc/mc_ignore.hpp"
 #include "src/simix/ActorImpl.hpp"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_context);
index af1f53b..9e23f69 100644 (file)
@@ -31,15 +31,15 @@ DragonflyZone::~DragonflyZone()
   }
 }
 
-void DragonflyZone::rankId_to_coords(int rankId, unsigned int (*coords)[4])
+void DragonflyZone::rankId_to_coords(int rankId, unsigned int coords[4])
 {
   // coords : group, chassis, blade, node
-  (*coords)[0] = rankId / (num_chassis_per_group_ * num_blades_per_chassis_ * num_nodes_per_blade_);
-  rankId       = rankId % (num_chassis_per_group_ * num_blades_per_chassis_ * num_nodes_per_blade_);
-  (*coords)[1] = rankId / (num_blades_per_chassis_ * num_nodes_per_blade_);
-  rankId       = rankId % (num_blades_per_chassis_ * num_nodes_per_blade_);
-  (*coords)[2] = rankId / num_nodes_per_blade_;
-  (*coords)[3] = rankId % num_nodes_per_blade_;
+  coords[0] = rankId / (num_chassis_per_group_ * num_blades_per_chassis_ * num_nodes_per_blade_);
+  rankId    = rankId % (num_chassis_per_group_ * num_blades_per_chassis_ * num_nodes_per_blade_);
+  coords[1] = rankId / (num_blades_per_chassis_ * num_nodes_per_blade_);
+  rankId    = rankId % (num_blades_per_chassis_ * num_nodes_per_blade_);
+  coords[2] = rankId / num_nodes_per_blade_;
+  coords[3] = rankId % num_nodes_per_blade_;
 }
 
 void DragonflyZone::parse_specific_arguments(ClusterCreationArgs* cluster)
@@ -285,9 +285,9 @@ void DragonflyZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationA
   }
 
   unsigned int myCoords[4];
-  rankId_to_coords(src->id(), &myCoords);
+  rankId_to_coords(src->id(), myCoords);
   unsigned int targetCoords[4];
-  rankId_to_coords(dst->id(), &targetCoords);
+  rankId_to_coords(dst->id(), targetCoords);
   XBT_DEBUG("src : %u group, %u chassis, %u blade, %u node", myCoords[0], myCoords[1], myCoords[2], myCoords[3]);
   XBT_DEBUG("dst : %u group, %u chassis, %u blade, %u node", targetCoords[0], targetCoords[1], targetCoords[2],
             targetCoords[3]);
index c718ac6..72d0298 100644 (file)
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route_cluster_torus, surf_route_cluster, "Torus Routing part of surf");
 
-inline void rankId_to_coords(int rankId, std::vector<unsigned int> dimensions, unsigned int (*coords)[4])
+inline void rankId_to_coords(int rankId, std::vector<unsigned int> dimensions, unsigned int* coords)
 {
   unsigned int dim_size_product = 1;
   unsigned int i = 0;
   for (auto const& cur_dim_size : dimensions) {
-    (*coords)[i] = (rankId / dim_size_product) % cur_dim_size;
+    coords[i] = (rankId / dim_size_product) % cur_dim_size;
     dim_size_product *= cur_dim_size;
     i++;
   }
@@ -120,10 +120,10 @@ void TorusZone::get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs*
    * Arrays that hold the coordinates of the current node andthe target; comparing the values at the i-th position of
    * both arrays, we can easily assess whether we need to route into this dimension or not.
    */
-  unsigned int myCoords[4];
-  rankId_to_coords(src->id(), dimensions_, &myCoords);
-  unsigned int targetCoords[4];
-  rankId_to_coords(dst->id(), dimensions_, &targetCoords);
+  unsigned int myCoords[dimensions_.size()];
+  rankId_to_coords(src->id(), dimensions_, myCoords);
+  unsigned int targetCoords[dimensions_.size()];
+  rankId_to_coords(dst->id(), dimensions_, targetCoords);
   /*
    * linkOffset describes the offset where the link we want to use is stored(+1 is added because each node has a link
    * from itself to itself, which can only be the case if src->m_id == dst->m_id -- see above for this special case)
index 8b2512d..68279a7 100644 (file)
@@ -9,7 +9,7 @@
 #include <simgrid/modelchecker.h>
 
 #include "src/mc/ModelChecker.hpp"
-#include "src/mc/mc_ignore.h"
+#include "src/mc/mc_ignore.hpp"
 #include "src/mc/mc_private.hpp"
 #include "src/mc/mc_record.hpp"
 #include "src/mc/remote/Client.hpp"
index 5512139..7a9b45f 100644 (file)
@@ -23,8 +23,6 @@ struct PatternCommunicationList {
 }
 }
 
-extern "C" {
-
 /**
  *  Type: `xbt_dynar_t<mc_list_comm_pattern_t>`
  */
@@ -77,6 +75,5 @@ XBT_PRIVATE void MC_restore_communications_pattern(simgrid::mc::State* state);
 
 XBT_PRIVATE void MC_state_copy_incomplete_communications_pattern(simgrid::mc::State* state);
 XBT_PRIVATE void MC_state_copy_index_communications_pattern(simgrid::mc::State* state);
-}
 
 #endif
similarity index 72%
rename from src/mc/mc_ignore.h
rename to src/mc/mc_ignore.hpp
index f146f50..595c04e 100644 (file)
@@ -3,17 +3,15 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#ifndef SIMGRID_MC_IGNORE_H
-#define SIMGRID_MC_IGNORE_H
+#ifndef SIMGRID_MC_IGNORE_HPP
+#define SIMGRID_MC_IGNORE_HPP
 
 #include "src/internal_config.h"
 
 #if HAVE_UCONTEXT_H
-#include <ucontext.h>           /* context relative declarations */
+#include <ucontext.h> /* context relative declarations */
 
-SG_BEGIN_DECL();
 XBT_PUBLIC void MC_register_stack_area(void* stack, smx_actor_t process, ucontext_t* context, size_t size);
-SG_END_DECL();
 
 #endif
 
index 7ddc1d6..b8d4f1b 100644 (file)
@@ -24,8 +24,6 @@ struct DerefAndCompareByActorsCountAndUsedHeap {
 }
 }
 
-extern "C" {
-
 /********************************* MC Global **********************************/
 
 XBT_PRIVATE void MC_init_dot_output();
@@ -40,8 +38,6 @@ XBT_PRIVATE void MC_show_deadlock(void);
 #define MC_VERBOSE 1
 
 /********************************** Miscellaneous **********************************/
-}
-
 namespace simgrid {
 namespace mc {
 
index 19e76fc..a2ac591 100644 (file)
@@ -28,8 +28,6 @@
  * MCed code.
  */
 
-extern "C" {
-
 /** Get the issuer of  a simcall (`req->issuer`)
  *
  *  In split-process mode, it does the black magic necessary to get an address
@@ -47,6 +45,5 @@ XBT_PRIVATE const char* MC_smx_actor_get_host_name(smx_actor_t p);
 XBT_PRIVATE int MC_smpi_process_count(void);
 
 XBT_PRIVATE unsigned long MC_smx_get_maxpid(void);
-}
 
 #endif
index d8d3b0c..62a18fe 100644 (file)
@@ -16,8 +16,6 @@
 #include "src/mc/mc_forward.hpp"
 #include "src/mc/mc_unw.hpp"
 
-extern "C" {
-
 // ***** Snapshot region
 
 XBT_PRIVATE void mc_region_restore_sparse(simgrid::mc::RemoteClient* process, mc_mem_region_t reg);
@@ -53,7 +51,6 @@ static XBT_ALWAYS_INLINE void* mc_translate_address_region(uintptr_t addr, mc_me
 
 XBT_PRIVATE mc_mem_region_t mc_get_snapshot_region(const void* addr, const simgrid::mc::Snapshot* snapshot,
                                                    int process_index);
-}
 
 // ***** MC Snapshot
 
@@ -131,8 +128,6 @@ public:
 }
 }
 
-extern "C" {
-
 static XBT_ALWAYS_INLINE mc_mem_region_t mc_get_region_hinted(void* addr, simgrid::mc::Snapshot* snapshot,
                                                               int process_index, mc_mem_region_t region)
 {
@@ -143,7 +138,6 @@ static XBT_ALWAYS_INLINE mc_mem_region_t mc_get_region_hinted(void* addr, simgri
 }
 
 static const void* mc_snapshot_get_heap_end(simgrid::mc::Snapshot* snapshot);
-}
 
 namespace simgrid {
 namespace mc {
@@ -153,8 +147,6 @@ XBT_PRIVATE void restore_snapshot(std::shared_ptr<simgrid::mc::Snapshot> snapsho
 }
 }
 
-extern "C" {
-
 XBT_PRIVATE void mc_restore_page_snapshot_region(simgrid::mc::RemoteClient* process, void* start_addr,
                                                  simgrid::mc::ChunkedData const& pagenos);
 
@@ -214,6 +206,5 @@ static XBT_ALWAYS_INLINE void* MC_region_read_pointer(mc_mem_region_t region, co
   void* res;
   return *(void**)MC_region_read(region, &res, addr, sizeof(void*));
 }
-}
 
 #endif
index 719640c..071d18a 100644 (file)
@@ -6,7 +6,7 @@
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
 
-#include "instr/instr_interface.h"
+#include "instr/instr_interface.hpp"
 #include "mc/mc.h"
 #include "src/msg/msg_private.hpp"
 
index ba75301..77c71e5 100644 (file)
@@ -5,7 +5,7 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "instr/instr_interface.h"
+#include "instr/instr_interface.hpp"
 #include "mc/mc.h"
 #include "simgrid/kernel/routing/NetPoint.hpp"
 #include "simgrid/kernel/routing/NetZoneImpl.hpp"
index aafbc55..7bcdaf7 100644 (file)
@@ -7,7 +7,7 @@
 #include "simgrid/kernel/resource/Action.hpp"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/sg_config.hpp"
-#include "src/include/instr/instr_interface.h"
+#include "src/include/instr/instr_interface.hpp"
 #include "src/surf/surf_interface.hpp"
 
 XBT_LOG_NEW_CATEGORY(sd, "Logging specific to SimDag");
index b18dc47..fc9403f 100644 (file)
@@ -35,7 +35,6 @@ std::set<SD_task_t>* simulate (double how_long);
 }
 }
 
-extern "C" {
 extern XBT_PRIVATE simgrid::sd::Global *sd_global;
 
 /* Task */
@@ -72,5 +71,4 @@ XBT_PRIVATE void SD_task_run(SD_task_t task);
 XBT_PRIVATE bool acyclic_graph_detail(xbt_dynar_t dag);
 XBT_PRIVATE void uniq_transfer_task_name(SD_task_t task);
 XBT_PRIVATE const char *__get_state_name(e_SD_task_state_t state);
-}
 #endif
index 602f2ae..0c7c8a8 100644 (file)
@@ -6,7 +6,7 @@
 /* sg_config: configuration infrastructure for the simulation world         */
 
 #include "simgrid/sg_config.hpp"
-#include "instr/instr_interface.h"
+#include "instr/instr_interface.hpp"
 #include "mc/mc.h"
 #include "simgrid/instr.h"
 #include "src/internal_config.h"
index f0fc0bc..16dca7c 100644 (file)
@@ -135,8 +135,6 @@ XBT_PUBLIC void create_maestro(std::function<void()> code);
 
 typedef simgrid::kernel::actor::ActorImpl* smx_actor_t;
 
-extern "C" {
-
 XBT_PRIVATE smx_actor_t SIMIX_process_create(const char* name, std::function<void()> code, void* data, sg_host_t host,
                                              std::map<std::string, std::string>* properties,
                                              smx_actor_t parent_process);
@@ -152,7 +150,6 @@ XBT_PRIVATE void SIMIX_process_change_host(smx_actor_t process, sg_host_t dest);
 XBT_PRIVATE void SIMIX_process_auto_restart_set(smx_actor_t process, int auto_restart);
 
 extern void (*SMPI_switch_data_segment)(simgrid::s4u::ActorPtr actor);
-}
 
 XBT_PRIVATE void SIMIX_process_sleep_destroy(smx_activity_t synchro);
 XBT_PRIVATE smx_activity_t SIMIX_process_join(smx_actor_t issuer, smx_actor_t process, double timeout);
index b83beb9..8561f7d 100644 (file)
@@ -15,8 +15,6 @@
 
 #include <boost/intrusive_ptr.hpp>
 
-extern "C" {
-
 /********************************* Simcalls *********************************/
 XBT_PUBLIC_DATA const char* simcall_names[]; /* Name of each simcall */
 
@@ -67,7 +65,6 @@ XBT_PRIVATE void SIMIX_simcall_exit(smx_activity_t synchro);
 XBT_PRIVATE const char* SIMIX_simcall_name(e_smx_simcall_t kind);
 XBT_PRIVATE void SIMIX_run_kernel(std::function<void()> const* code);
 XBT_PRIVATE void SIMIX_run_blocking(std::function<void()> const* code);
-}
 
 /* Defines the marshal/unmarshal functions for each type of parameters.
  *
index 9f1acbc..17a0a39 100644 (file)
@@ -38,7 +38,6 @@ public:
 }
 }
 
-extern "C" {
 XBT_PRIVATE void SIMIX_host_add_auto_restart_process(sg_host_t host, const char* name, std::function<void()> code,
                                                      void* data, double kill_time,
                                                      std::map<std::string, std::string>* properties, int auto_restart);
@@ -48,7 +47,6 @@ XBT_PRIVATE void SIMIX_host_autorestart(sg_host_t host);
 XBT_PRIVATE void SIMIX_execution_finish(smx_activity_t synchro);
 
 XBT_PRIVATE void SIMIX_set_category(smx_activity_t synchro, const char* category);
-}
 
 XBT_PRIVATE boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>
 SIMIX_execution_start(const char* name, double flops_amount, double priority, double bound, sg_host_t host);
index 3609c1f..d8c2e13 100644 (file)
@@ -63,8 +63,6 @@ public:
 }
 }
 
-extern "C" {
-
 XBT_PUBLIC_DATA std::unique_ptr<simgrid::simix::Global> simix_global;
 
 XBT_PUBLIC void SIMIX_clean();
@@ -80,6 +78,5 @@ XBT_PUBLIC void SIMIX_clean();
     _smx_throw_issuer->exception = std::make_exception_ptr(e);                                                         \
   } else                                                                                                               \
     ((void)0)
-}
 
 #endif
index 4792772..42ad749 100644 (file)
@@ -17,8 +17,6 @@
 #include <time.h>
 #endif
 
-extern "C" {
-
 #define PERSISTENT 0x1
 #define NON_PERSISTENT 0x2
 #define SEND 0x4
@@ -110,7 +108,9 @@ XBT_PRIVATE void* smpi_get_tmp_recvbuffer(int size);
 XBT_PRIVATE void smpi_free_tmp_buffer(void* buf);
 XBT_PRIVATE void smpi_free_replay_tmp_buffers();
 
+extern "C" {
 // f77 wrappers
+
 void mpi_init_(int* ierr);
 void mpi_finalize_(int* ierr);
 void mpi_abort_(int* comm, int* errorcode, int* ierr);
@@ -422,7 +422,7 @@ struct option;
 XBT_PUBLIC int smpi_getopt_long (int argc,  char *const *argv,  const char *options,  const struct option *long_options, int *opt_index);
 XBT_PUBLIC int smpi_getopt (int argc,  char *const *argv,  const char *options);
 
-// TODO, make this static and expose it more cleanly
+} // extern "C"
 
 struct s_smpi_privatization_region_t {
   void* address;
@@ -433,7 +433,6 @@ typedef s_smpi_privatization_region_t* smpi_privatization_region_t;
 extern XBT_PRIVATE int smpi_loaded_page;
 extern XBT_PRIVATE int smpi_universe_size;
 XBT_PRIVATE smpi_privatization_region_t smpi_init_global_memory_segment_process();
-}
 
 /**
  * Get the address of the beginning of the memory page where addr is located.
@@ -450,9 +449,7 @@ typedef std::vector<std::pair</* counter name */ std::string, /* counter value *
 extern std::unordered_map<std::string, double> location2speedup;
 
 /** @brief Returns the last call location (filename, linenumber). Process-specific. */
-extern "C" {
 XBT_PUBLIC smpi_trace_call_location_t* smpi_trace_get_call_location();
-}
 
 enum class SmpiPrivStrategies { None = 0, Mmap = 1, Dlopen = 2, Default = Dlopen };
 
index dca417d..b2c4e51 100644 (file)
 #include <string>
 #include <vector>
 
-extern "C" {
-
 // Methods used to parse and store the values for timing injections in smpi
 struct s_smpi_factor_t {
   size_t factor = 0;
   std::vector<double> values;
 };
-}
 
 XBT_PUBLIC std::vector<s_smpi_factor_t> parse_factor(std::string smpi_coef_string);
 
index 8ec3a36..e6fe8bc 100644 (file)
 #include <sstream>
 #include <vector>
 
-using simgrid::s4u::Actor;
-
 #include <tuple>
 // From https://stackoverflow.com/questions/7110301/generic-hash-for-tuples-in-unordered-map-unordered-set
 // This is all just to make std::unordered_map work with std::tuple. If we need this in other places,
 // this could go into a header file.
-namespace hash_tuple{
-    template <typename TT>
-    struct hash
-    {
-        size_t
-        operator()(TT const& tt) const
-        {
-            return std::hash<TT>()(tt);
-        }
-    };
+namespace hash_tuple {
+template <typename TT> class hash {
+public:
+  size_t operator()(TT const& tt) const { return std::hash<TT>()(tt); }
+};
 
-    template <class T>
-    inline void hash_combine(std::size_t& seed, T const& v)
-    {
-        seed ^= hash_tuple::hash<T>()(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
-    }
+template <class T> inline void hash_combine(std::size_t& seed, T const& v)
+{
+  seed ^= hash_tuple::hash<T>()(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
+}
 
-    // Recursive template code derived from Matthieu M.
-    template <class Tuple, size_t Index = std::tuple_size<Tuple>::value - 1>
-    struct HashValueImpl
-    {
-      static void apply(size_t& seed, Tuple const& tuple)
-      {
-        HashValueImpl<Tuple, Index-1>::apply(seed, tuple);
-        hash_combine(seed, std::get<Index>(tuple));
-      }
-    };
+// Recursive template code derived from Matthieu M.
+template <class Tuple, size_t Index = std::tuple_size<Tuple>::value - 1> class HashValueImpl {
+public:
+  static void apply(size_t& seed, Tuple const& tuple)
+  {
+    HashValueImpl<Tuple, Index - 1>::apply(seed, tuple);
+    hash_combine(seed, std::get<Index>(tuple));
+  }
+};
 
-    template <class Tuple>
-    struct HashValueImpl<Tuple,0>
-    {
-      static void apply(size_t& seed, Tuple const& tuple)
-      {
-        hash_combine(seed, std::get<0>(tuple));
-      }
-    };
+template <class Tuple> class HashValueImpl<Tuple, 0> {
+public:
+  static void apply(size_t& seed, Tuple const& tuple) { hash_combine(seed, std::get<0>(tuple)); }
+};
 
-    template <typename ... TT>
-    struct hash<std::tuple<TT...>>
-    {
-        size_t
-        operator()(std::tuple<TT...> const& tt) const
-        {
-            size_t seed = 0;
-            HashValueImpl<std::tuple<TT...> >::apply(seed, tt);
-            return seed;
-        }
-    };
+template <typename... TT> class hash<std::tuple<TT...>> {
+public:
+  size_t operator()(std::tuple<TT...> const& tt) const
+  {
+    size_t seed = 0;
+    HashValueImpl<std::tuple<TT...>>::apply(seed, tt);
+    return seed;
+  }
+};
 }
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_replay,smpi,"Trace Replay with SMPI");
@@ -518,13 +503,11 @@ public:
 template <class T> class ReplayAction {
 protected:
   const std::string name;
-  RequestStorage* req_storage; // Points to the right storage for this process, nullptr except for Send/Recv/Wait/Test actions.
   const int my_proc_id;
   T args;
 
 public:
-  explicit ReplayAction(std::string name, RequestStorage& storage) : name(name), req_storage(&storage), my_proc_id(simgrid::s4u::this_actor::get_pid()) {}
-  explicit ReplayAction(std::string name) : name(name), req_storage(nullptr), my_proc_id(simgrid::s4u::this_actor::get_pid()) {}
+  explicit ReplayAction(std::string name) : name(name), my_proc_id(simgrid::s4u::this_actor::get_pid()) {}
   virtual ~ReplayAction() = default;
 
   virtual void execute(simgrid::xbt::ReplayAction& action)
@@ -551,14 +534,17 @@ public:
 };
 
 class WaitAction : public ReplayAction<WaitTestParser> {
+private:
+  RequestStorage& req_storage;
+
 public:
-  WaitAction(RequestStorage& storage) : ReplayAction("Wait", storage) {}
+  explicit WaitAction(RequestStorage& storage) : ReplayAction("Wait"), req_storage(storage) {}
   void kernel(simgrid::xbt::ReplayAction& action) override
   {
     std::string s = boost::algorithm::join(action, " ");
-    xbt_assert(req_storage->size(), "action wait not preceded by any irecv or isend: %s", s.c_str());
-    MPI_Request request = req_storage->find(args.src, args.dst, args.tag);
-    req_storage->remove(request);
+    xbt_assert(req_storage.size(), "action wait not preceded by any irecv or isend: %s", s.c_str());
+    MPI_Request request = req_storage.find(args.src, args.dst, args.tag);
+    req_storage.remove(request);
 
     if (request == MPI_REQUEST_NULL) {
       /* Assume that the trace is well formed, meaning the comm might have been caught by a MPI_test. Then just
@@ -584,9 +570,11 @@ public:
 };
 
 class SendAction : public ReplayAction<SendRecvParser> {
+private:
+  RequestStorage& req_storage;
+
 public:
-  SendAction() = delete;
-  explicit SendAction(std::string name, RequestStorage& storage) : ReplayAction(name, storage) {}
+  explicit SendAction(std::string name, RequestStorage& storage) : ReplayAction(name), req_storage(storage) {}
   void kernel(simgrid::xbt::ReplayAction& action) override
   {
     int dst_traced = MPI_COMM_WORLD->group()->actor(args.partner)->get_pid();
@@ -600,7 +588,7 @@ public:
       Request::send(nullptr, args.size, args.datatype1, args.partner, args.tag, MPI_COMM_WORLD);
     } else if (name == "Isend") {
       MPI_Request request = Request::isend(nullptr, args.size, args.datatype1, args.partner, args.tag, MPI_COMM_WORLD);
-      req_storage->add(request);
+      req_storage.add(request);
     } else {
       xbt_die("Don't know this action, %s", name.c_str());
     }
@@ -610,9 +598,11 @@ public:
 };
 
 class RecvAction : public ReplayAction<SendRecvParser> {
+private:
+  RequestStorage& req_storage;
+
 public:
-  RecvAction() = delete;
-  explicit RecvAction(std::string name, RequestStorage& storage) : ReplayAction(name, storage) {}
+  explicit RecvAction(std::string name, RequestStorage& storage) : ReplayAction(name), req_storage(storage) {}
   void kernel(simgrid::xbt::ReplayAction& action) override
   {
     int src_traced = MPI_COMM_WORLD->group()->actor(args.partner)->get_pid();
@@ -631,7 +621,7 @@ public:
       Request::recv(nullptr, args.size, args.datatype1, args.partner, args.tag, MPI_COMM_WORLD, &status);
     } else if (name == "Irecv") {
       MPI_Request request = Request::irecv(nullptr, args.size, args.datatype1, args.partner, args.tag, MPI_COMM_WORLD);
-      req_storage->add(request);
+      req_storage.add(request);
     }
 
     TRACE_smpi_comm_out(my_proc_id);
@@ -654,12 +644,15 @@ public:
 };
 
 class TestAction : public ReplayAction<WaitTestParser> {
+private:
+  RequestStorage& req_storage;
+
 public:
-  TestAction(RequestStorage& storage) : ReplayAction("Test", storage) {}
+  explicit TestAction(RequestStorage& storage) : ReplayAction("Test"), req_storage(storage) {}
   void kernel(simgrid::xbt::ReplayAction& action) override
   {
-    MPI_Request request = req_storage->find(args.src, args.dst, args.tag);
-    req_storage->remove(request);
+    MPI_Request request = req_storage.find(args.src, args.dst, args.tag);
+    req_storage.remove(request);
     // if request is null here, this may mean that a previous test has succeeded
     // Different times in traced application and replayed version may lead to this
     // In this case, ignore the extra calls.
@@ -673,9 +666,9 @@ public:
       /* push back request in vector to be caught by a subsequent wait. if the test did succeed, the request is now
        * nullptr.*/
       if (request == MPI_REQUEST_NULL)
-        req_storage->addNullRequest(args.src, args.dst, args.tag);
+        req_storage.addNullRequest(args.src, args.dst, args.tag);
       else
-        req_storage->add(request);
+        req_storage.add(request);
 
       TRACE_smpi_testing_out(my_proc_id);
     }
@@ -703,17 +696,20 @@ public:
 };
 
 class WaitAllAction : public ReplayAction<ActionArgParser> {
+private:
+  RequestStorage& req_storage;
+
 public:
-  WaitAllAction(RequestStorage& storage) : ReplayAction("waitAll", storage) {}
+  explicit WaitAllAction(RequestStorage& storage) : ReplayAction("waitAll"), req_storage(storage) {}
   void kernel(simgrid::xbt::ReplayAction& action) override
   {
-    const unsigned int count_requests = req_storage->size();
+    const unsigned int count_requests = req_storage.size();
 
     if (count_requests > 0) {
       TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::Pt2PtTIData("waitAll", -1, count_requests, ""));
       std::vector<std::pair</*sender*/int,/*recv*/int>> sender_receiver;
       std::vector<MPI_Request> reqs;
-      req_storage->get_requests(reqs);
+      req_storage.get_requests(reqs);
       for (const auto& req : reqs) {
         if (req && (req->flags() & RECV)) {
           sender_receiver.push_back({req->src(), req->dst()});
@@ -721,7 +717,7 @@ public:
       }
       MPI_Status status[count_requests];
       Request::waitall(count_requests, &(reqs.data())[0], status);
-      req_storage->get_store().clear();
+      req_storage.get_store().clear();
 
       for (auto& pair : sender_receiver) {
         TRACE_smpi_recv(pair.first, pair.second, 0);
index db1236a..93ea87c 100644 (file)
@@ -24,11 +24,9 @@ public:
 };
 
 XBT_PUBLIC void ns3_initialize(std::string TcpProtocol);
-extern "C" {
 XBT_PUBLIC void ns3_simulator(double maxSeconds);
 XBT_PUBLIC void ns3_add_link(NetPointNs3* src, NetPointNs3* dst, double bw, double lat);
 XBT_PUBLIC void ns3_add_cluster(const char* id, double bw, double lat);
-}
 
 class XBT_PRIVATE SgFlow {
 public:
index 3daf923..510d21f 100644 (file)
@@ -27,18 +27,21 @@ namespace plugin {
 namespace dvfs {
 class Governor {
 
+private:
+  simgrid::s4u::Host* const host_;
+
 protected:
-  simgrid::s4u::Host* const host;
+  simgrid::s4u::Host* get_host() const { return host_; }
 
 public:
   double sampling_rate;
 
-  explicit Governor(simgrid::s4u::Host* ptr) : host(ptr) { init(); }
+  explicit Governor(simgrid::s4u::Host* ptr) : host_(ptr) { init(); }
   virtual ~Governor() = default;
 
   void init()
   {
-    const char* local_sampling_rate_config = host->getProperty(property_sampling_rate);
+    const char* local_sampling_rate_config = host_->getProperty(property_sampling_rate);
     double global_sampling_rate_config     = xbt_cfg_get_double(property_sampling_rate);
     if (local_sampling_rate_config != nullptr) {
       sampling_rate = std::stod(local_sampling_rate_config);
@@ -66,7 +69,7 @@ class Performance : public Governor {
 public:
   explicit Performance(simgrid::s4u::Host* ptr) : Governor(ptr) {}
 
-  void update() override { host->setPstate(0); }
+  void update() override { get_host()->setPstate(0); }
   std::string getName() override { return "Performance"; }
 };
 
@@ -84,7 +87,7 @@ class Powersave : public Governor {
 public:
   explicit Powersave(simgrid::s4u::Host* ptr) : Governor(ptr) {}
 
-  void update() override { host->setPstate(host->getPstatesCount() - 1); }
+  void update() override { get_host()->setPstate(get_host()->getPstatesCount() - 1); }
   std::string getName() override { return "Powersave"; }
 };
 
@@ -110,11 +113,11 @@ public:
   std::string getName() override { return "OnDemand"; }
   void update() override
   {
-    double load = host->getCoreCount() * sg_host_get_avg_load(host);
-    sg_host_load_reset(host); // Only consider the period between two calls to this method!
+    double load = get_host()->getCoreCount() * sg_host_get_avg_load(get_host());
+    sg_host_load_reset(get_host()); // Only consider the period between two calls to this method!
 
     if (load > freq_up_threshold) {
-      host->setPstate(0); /* Run at max. performance! */
+      get_host()->setPstate(0); /* Run at max. performance! */
       XBT_INFO("Load: %f > threshold: %f --> changed to pstate %i", load, freq_up_threshold, 0);
     } else {
       /* The actual implementation uses a formula here: (See Kernel file cpufreq_ondemand.c:158)
@@ -124,11 +127,11 @@ public:
        * So they assume that frequency increases by 100 MHz. We will just use
        * lowest_pstate - load*pstatesCount()
        */
-      int max_pstate = host->getPstatesCount() - 1;
+      int max_pstate = get_host()->getPstatesCount() - 1;
       // Load is now < freq_up_threshold; exclude pstate 0 (the fastest)
       // because pstate 0 can only be selected if load > freq_up_threshold
       int new_pstate = max_pstate - load * (max_pstate + 1);
-      host->setPstate(new_pstate);
+      get_host()->setPstate(new_pstate);
 
       XBT_DEBUG("Load: %f < threshold: %f --> changed to pstate %i", load, freq_up_threshold, new_pstate);
     }
@@ -157,22 +160,22 @@ public:
   virtual std::string getName() override { return "Conservative"; }
   virtual void update() override
   {
-    double load = host->getCoreCount() * sg_host_get_avg_load(host);
-    int pstate  = host->getPstate();
-    sg_host_load_reset(host); // Only consider the period between two calls to this method!
+    double load = get_host()->getCoreCount() * sg_host_get_avg_load(get_host());
+    int pstate  = get_host()->getPstate();
+    sg_host_load_reset(get_host()); // Only consider the period between two calls to this method!
 
     if (load > freq_up_threshold) {
       if (pstate != 0) {
-        host->setPstate(pstate - 1);
+        get_host()->setPstate(pstate - 1);
         XBT_INFO("Load: %f > threshold: %f -> increasing performance to pstate %d", load, freq_up_threshold, pstate - 1);
       }
       else {
         XBT_DEBUG("Load: %f > threshold: %f -> but cannot speed up even more, already in highest pstate %d", load, freq_up_threshold, pstate);
       }
     } else if (load < freq_down_threshold) {
-      int max_pstate = host->getPstatesCount() - 1;
+      int max_pstate = get_host()->getPstatesCount() - 1;
       if (pstate != max_pstate) { // Are we in the slowest pstate already?
-        host->setPstate(pstate + 1);
+        get_host()->setPstate(pstate + 1);
         XBT_INFO("Load: %f < threshold: %f -> slowing down to pstate %d", load, freq_down_threshold, pstate + 1);
       }
       else {
index 85296a9..2ed96e5 100644 (file)
@@ -4,7 +4,7 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "surf_interface.hpp"
-#include "instr/instr_interface.h" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals
+#include "instr/instr_interface.hpp" // TRACE_is_enabled(). FIXME: remove by subscribing tracing to the surf signals
 #include "mc/mc.h"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/sg_config.hpp"
index e45589f..7fb470d 100644 (file)
@@ -9,8 +9,6 @@
 #include "simgrid/forward.h"
 #include "xbt/sysdep.h"
 
-extern "C" {
-
 /* Generic functions common to all models */
 
 XBT_PRIVATE FILE* surf_fopen(const char* name, const char* mode);
@@ -30,6 +28,5 @@ XBT_PRIVATE void parse_after_config();
 /* from surf_instr.c */
 void TRACE_surf_host_set_speed(double date, const char* resource, double power);
 void TRACE_surf_link_set_bandwidth(double date, const char* resource, double bandwidth);
-}
 
 #endif
index c30139c..1e095b6 100644 (file)
@@ -8,8 +8,6 @@
 
 #include <xbt/signal.hpp>
 
-extern "C" {
-
 /* Module management functions */
 XBT_PUBLIC void sg_platf_init();
 XBT_PUBLIC void sg_platf_exit();
@@ -28,6 +26,5 @@ XBT_PUBLIC double surf_parse_get_bandwidth(const char* string, const char* entit
 XBT_PUBLIC double surf_parse_get_speed(const char* string, const char* entity_kind, std::string name);
 
 XBT_PUBLIC int surf_parse(); /* Entry-point to the parser */
-}
 
 #endif
index 0871cd4..b1c9fab 100644 (file)
@@ -181,8 +181,6 @@ public:
 };
 }}}
 
-extern "C" {
-
 /********** Routing **********/
 void routing_cluster_add_backbone(simgrid::kernel::resource::LinkImpl* bb);
 /*** END of the parsing cruft ***/
@@ -227,7 +225,6 @@ XBT_PUBLIC void surf_parse_set_out(FILE* out_str);
 XBT_PUBLIC int surf_parse_get_debug();
 XBT_PUBLIC void surf_parse_set_debug(int bdebug);
 XBT_PUBLIC int surf_parse_lex_destroy();
-}
 
 namespace simgrid {
 namespace surf {
index 87e1353..3edce86 100644 (file)
@@ -3,12 +3,12 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "instr/instr_interface.h" // TRACE_start(). FIXME: remove by subscribing tracing to the surf signals
+#include "surf/surf.hpp"
+#include "instr/instr_interface.hpp" // TRACE_start(). FIXME: remove by subscribing tracing to the surf signals
 #include "src/surf/cpu_interface.hpp"
 #include "src/surf/network_interface.hpp"
 #include "src/surf/surf_interface.hpp"
 #include "src/surf/xml/platf_private.hpp"
-#include "surf/surf.hpp"
 
 #include <vector>
 
index 3b4dcd3..9a7f022 100644 (file)
@@ -42,6 +42,9 @@ endif()
 if (enable_smpi_MPICH3_testsuite AND HAVE_RAW_CONTEXTS)
   ADD_TEST(test-smpi-mpich3-rma-raw       ${CMAKE_COMMAND} -E chdir ${CMAKE_BINARY_DIR}/teshsuite/smpi/mpich3-test/rma ${PERL_EXECUTABLE} ${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/runtests ${TESH_OPTION} -mpiexec=${CMAKE_BINARY_DIR}/smpi_script/bin/smpirun -srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite/smpi/mpich3-test/rma -tests=testlist -execarg=--cfg=contexts/factory:raw)
   SET_TESTS_PROPERTIES(test-smpi-mpich3-rma-raw PROPERTIES PASS_REGULAR_EXPRESSION "tests passed!")
+  if (enable_thread_sanitizer)
+    SET_TESTS_PROPERTIES(test-smpi-mpich3-rma-raw PROPERTIES TIMEOUT 1500)
+  endif()
 endif()
 
 foreach(file accfence1 accfence2_am accfence2 accpscw1 allocmem epochtest getfence1 getgroup manyrma3 nullpscw
index 69ba68b..19a3eaa 100644 (file)
@@ -2,7 +2,7 @@
 
 set(EXTRA_DIST
   src/bindings/java/MANIFEST.in
-  src/include/instr/instr_interface.h
+  src/include/instr/instr_interface.hpp
   src/include/mc/datatypes.h
   src/include/mc/mc.h
   src/include/simgrid/sg_config.hpp
@@ -634,7 +634,7 @@ set(MC_SRC
   src/mc/mc_dwarf_tagnames.cpp
   src/mc/mc_hash.hpp
   src/mc/mc_hash.cpp
-  src/mc/mc_ignore.h
+  src/mc/mc_ignore.hpp
   src/mc/LocationList.hpp
   src/mc/LocationList.cpp
   src/mc/mc_record.cpp