Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Massive change in SMPI+instr
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 8 Nov 2017 15:03:19 +0000 (16:03 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 8 Nov 2017 15:03:19 +0000 (16:03 +0100)
 - Use classes not enums \o/
Pros
 - 2 more actions can be replayed (scatter and scatterV)
 - the tracing/smpi/display-sizes option should display what it has to
Cons
 - SendRecv is currently not fully trace (Send and Recv are, not the
   surrounding state. This prevents a replay that wasn't possible anyway)
 - some workarounds have been used out of laziness
 - Most of the MPI calls for which we can produce a Time-Independent
   Action are not tested.
 - Cleaning and polishing may be required

12 files changed:
src/instr/instr_paje_events.cpp
src/instr/instr_paje_events.hpp
src/instr/instr_paje_types.cpp
src/instr/instr_paje_types.hpp
src/instr/instr_private.hpp
src/instr/instr_smpi.hpp
src/smpi/bindings/smpi_pmpi.cpp
src/smpi/bindings/smpi_pmpi_coll.cpp
src/smpi/bindings/smpi_pmpi_request.cpp
src/smpi/internals/instr_smpi.cpp
src/smpi/internals/smpi_bench.cpp
src/smpi/internals/smpi_replay.cpp

index e10c4fc..2a6ef0c 100644 (file)
@@ -52,7 +52,7 @@ StateEvent::StateEvent(Container* container, Type* type, e_event_type event_type
 {
 }
 
-StateEvent::StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value, void* extra)
+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)
 {
 #if HAVE_SMPI
@@ -136,14 +136,9 @@ void StateEvent::print()
     if (value != nullptr) // PAJE_PopState Event does not need to have a value
       stream << " " << value->getId();
 
-    if (TRACE_display_sizes()) {
-      stream << " ";
-      if (extra_ != nullptr) {
-        stream << static_cast<instr_extra_data>(extra_)->send_size;
-      } else {
-        stream << 0;
-      }
-    }
+    if (TRACE_display_sizes())
+      stream << " " << (extra_ != nullptr) ? extra_->display_size() : 0;
+
 #if HAVE_SMPI
     if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
       stream << " \"" << filename << "\" " << linenumber;
@@ -151,134 +146,24 @@ void StateEvent::print()
 #endif
     XBT_DEBUG("Dump %s", stream.str().c_str());
     fprintf(tracing_file, "%s\n", stream.str().c_str());
-
-    if (extra_ != nullptr) {
-      if (static_cast<instr_extra_data>(extra_)->sendcounts != nullptr)
-        delete[](static_cast<instr_extra_data>(extra_)->sendcounts);
-      if (static_cast<instr_extra_data>(extra_)->recvcounts != nullptr)
-        delete[](static_cast<instr_extra_data>(extra_)->recvcounts);
-      xbt_free(extra_);
-    }
   } else if (instr_fmt_type == instr_fmt_TI) {
     if (extra_ == nullptr)
       return;
-    instr_extra_data extra = (instr_extra_data)extra_;
+
+    /* Unimplemented calls are: WAITANY, SENDRECV, SCAN, EXSCAN, SSEND, and ISSEND. */
 
     // FIXME: dirty extract "rank-" from the name, as we want the bare process id here
     if (getContainer()->getName().find("rank-") != 0)
-      stream << getContainer()->getName() << " ";
+      stream << getContainer()->getName() << " " << extra_->print();
     else
-      stream << getContainer()->getName().erase(0, 5) << " ";
-
-    FILE* trace_file = tracing_files.at(getContainer());
-
-    switch (extra->type) {
-      case TRACING_INIT:
-        stream << "init";
-        break;
-      case TRACING_FINALIZE:
-        stream << "finalize";
-        break;
-      case TRACING_SEND:
-        stream << "send " << extra->dst << " " << extra->send_size << " " << extra->datatype1;
-        break;
-      case TRACING_ISEND:
-        stream << "Isend " << extra->dst << " " << extra->send_size << " " << extra->datatype1;
-        break;
-      case TRACING_RECV:
-        stream << "recv " << extra->src << " " << extra->send_size << " " << extra->datatype1;
-        break;
-      case TRACING_IRECV:
-        stream << "Irecv " << extra->src << " " << extra->send_size << " " << extra->datatype1;
-        break;
-      case TRACING_TEST:
-        stream << "test";
-        break;
-      case TRACING_WAIT:
-        stream << "wait";
-        break;
-      case TRACING_WAITALL:
-        stream << "waitAll";
-        break;
-      case TRACING_BARRIER:
-        stream << "barrier";
-        break;
-      case TRACING_BCAST: // rank bcast size (root) (datatype)
-        stream << "bcast " << extra->send_size;
-        if (extra->root != 0 || (extra->datatype1 && strcmp(extra->datatype1, "")))
-          stream << " " << extra->root << " " << extra->datatype1;
-        break;
-      case TRACING_REDUCE: // rank reduce comm_size comp_size (root) (datatype)
-        stream << "reduce " << extra->send_size << " " << extra->comp_size;
-        if (extra->root != 0 || (extra->datatype1 && strcmp(extra->datatype1, "")))
-          stream << " " << extra->root << " " << extra->datatype1;
-        break;
-      case TRACING_ALLREDUCE: // rank allreduce comm_size comp_size (datatype)
-        stream << "allReduce " << extra->send_size << " " << extra->comp_size << " " << extra->datatype1;
-        break;
-      case TRACING_ALLTOALL: // rank alltoall send_size recv_size (sendtype) (recvtype)
-        stream << "allToAll " << extra->send_size << " " << extra->recv_size << " " << extra->datatype1 << " ";
-        stream << extra->datatype2;
-        break;
-      case TRACING_ALLTOALLV: // rank alltoallv send_size [sendcounts] recv_size [recvcounts] (sendtype) (recvtype)
-        stream << "allToAllV " << extra->send_size << " ";
-        for (int i = 0; i < extra->num_processes; i++)
-          stream << extra->sendcounts[i] << " ";
-        stream << extra->recv_size << " ";
-        for (int i = 0; i < extra->num_processes; i++)
-          stream << extra->recvcounts[i] << " ";
-        stream << extra->datatype1 << " " << extra->datatype2;
-        break;
-      case TRACING_GATHER: // rank gather send_size recv_size root (sendtype) (recvtype)
-        stream << "gather " << extra->send_size << " " << extra->recv_size << " " << extra->datatype1 << " ";
-        stream << extra->datatype2;
-        break;
-      case TRACING_ALLGATHERV: // rank allgatherv send_size [recvcounts] (sendtype) (recvtype)
-        stream << "allGatherV " << extra->send_size;
-        for (int i = 0; i < extra->num_processes; i++)
-          stream << extra->recvcounts[i] << " ";
-        stream << extra->datatype1 << " " << extra->datatype2;
-        break;
-      case TRACING_REDUCE_SCATTER: // rank reducescatter [recvcounts] comp_size (sendtype)
-        stream << "reduceScatter ";
-        for (int i = 0; i < extra->num_processes; i++)
-          stream << extra->recvcounts[i] << " ";
-        stream << extra->comp_size << " " << extra->datatype1;
-        break;
-      case TRACING_COMPUTING:
-        stream << "compute " << extra->comp_size;
-        break;
-      case TRACING_SLEEPING:
-        stream << "sleep " << extra->sleep_duration;
-        break;
-      case TRACING_GATHERV: // rank gatherv send_size [recvcounts] root (sendtype) (recvtype)
-        stream << "gatherV " << extra->send_size;
-        for (int i = 0; i < extra->num_processes; i++)
-          stream << extra->recvcounts[i] << " ";
-        stream << extra->root << " " << extra->datatype1 << " " << extra->datatype2;
-        break;
-      case TRACING_ALLGATHER: // rank allgather sendcount recvcounts (sendtype) (recvtype)
-        stream << "allGather " << extra->send_size << " " << extra->recv_size << " " << extra->datatype1 << " ";
-        stream << extra->datatype2;
-        break;
-      default:
-        /* Unimplemented calls are: WAITANY, SENDRECV, SCATTER, SCATTERV, SCAN, EXSCAN, COMM_SIZE, COMM_SPLIT, COMM_DUP,
-         * SSEND, and ISSEND.
-         */
-        XBT_WARN("Call from %s impossible to translate into replay command : Not implemented (yet)", value->getCname());
-        break;
-    }
-    fprintf(trace_file, "%s\n", stream.str().c_str());
-
-    if (extra->recvcounts != nullptr)
-      delete[] extra->recvcounts;
-    if (extra->sendcounts != nullptr)
-      delete[] extra->sendcounts;
-    xbt_free(extra);
+      stream << getContainer()->getName().erase(0, 5) << " " << extra_->print();
 
+    fprintf(tracing_files.at(getContainer()), "%s\n", stream.str().c_str());
   } else {
     THROW_IMPOSSIBLE;
   }
+
+  delete extra_;
 }
 }
 }
index 3c2fc02..a4afdb0 100644 (file)
@@ -12,6 +12,7 @@
 namespace simgrid {
 namespace instr {
 class EntityValue;
+class TIData;
 
 enum e_event_type : unsigned int {
   PAJE_DefineContainerType,
@@ -63,11 +64,11 @@ class StateEvent : public PajeEvent {
   EntityValue* value;
   std::string filename;
   int linenumber;
-  void* extra_ = nullptr;
+  TIData* extra_ = nullptr;
 
 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, void* extra);
+  StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value, TIData* extra);
   void print() override;
 };
 
index 314bc86..3f87707 100644 (file)
@@ -65,7 +65,7 @@ void StateType::setEvent(std::string value_name)
   events_.push_back(new StateEvent(issuer_, this, PAJE_SetState, getEntityValue(value_name)));
 }
 
-void StateType::pushEvent(std::string value_name, void* extra)
+void StateType::pushEvent(std::string value_name, TIData* extra)
 {
   events_.push_back(new StateEvent(issuer_, this, PAJE_PushState, getEntityValue(value_name), extra));
 }
index ab5b97a..03ec6de 100644 (file)
@@ -14,6 +14,7 @@ namespace simgrid {
 namespace instr {
 class ContainerType;
 class EventType;
+class TIData;
 
 class Type {
   long long int id_;
@@ -93,7 +94,7 @@ public:
   ~StateType();
   void setEvent(std::string value_name);
   void pushEvent(std::string value_name);
-  void pushEvent(std::string value_name, void* extra);
+  void pushEvent(std::string value_name, TIData* extra);
   void popEvent();
 };
 }
index 56d6089..77392a8 100644 (file)
 
 typedef simgrid::instr::Container* container_t;
 
+namespace simgrid {
+namespace instr {
+
+class TIData {
+  std::string name_;
+  double amount_ = 0;
+
+public:
+  int endpoint                 = 0;
+  int send_size                = 0;
+  std::vector<int>* sendcounts = nullptr;
+  int recv_size                = 0;
+  std::vector<int>* recvcounts = nullptr;
+  std::string send_type        = "";
+  std::string recv_type        = "";
+  ;
+
+  // NoOpTI: init, finalize, test, wait, barrier
+  TIData(std::string name) : name_(name){};
+  // CPuTI: compute, sleep (+ waitAny and waitAll out of laziness)
+  TIData(std::string name, double amount) : name_(name), amount_(amount){};
+  // Pt2PtTI: send, isend, sssend, issend, recv, irecv
+  TIData(std::string name, int endpoint, int size, std::string datatype)
+      : name_(name), endpoint(endpoint), send_size(size), send_type(datatype){};
+  // CollTI: bcast, reduce, allReduce, gather, scatter, allGather, allToAll
+  TIData(std::string name, int root, double amount, int send_size, int recv_size, std::string send_type,
+         std::string recv_type)
+      : name_(name)
+      , amount_(amount)
+      , endpoint(root)
+      , send_size(send_size)
+      , recv_size(recv_size)
+      , send_type(send_type)
+      , recv_type(recv_type){};
+  // VarCollTI: gatherV, scatterV, allGatherV, allToAllV (+ reduceScatter out of laziness)
+  TIData(std::string name, int root, int send_size, std::vector<int>* sendcounts, int recv_size,
+         std::vector<int>* recvcounts, std::string send_type, std::string recv_type)
+      : name_(name)
+      , endpoint(root)
+      , send_size(send_size)
+      , sendcounts(sendcounts)
+      , recv_size(recv_size)
+      , recvcounts(recvcounts)
+      , send_type(send_type)
+      , recv_type(recv_type){};
+
+  virtual ~TIData()
+  {
+    delete sendcounts;
+    delete recvcounts;
+  }
+
+  std::string getName() { return name_; }
+  double getAmount() { return amount_; }
+  virtual std::string print()        = 0;
+  virtual std::string display_size() = 0;
+};
+
+class NoOpTIData : public TIData {
+public:
+  NoOpTIData(std::string name) : TIData(name){};
+  std::string print() override { return getName(); }
+  std::string display_size() override { return ""; }
+};
+
+class CpuTIData : public TIData {
+public:
+  CpuTIData(std::string name, double amount) : TIData(name, amount){};
+  std::string print() override
+  {
+    std::stringstream stream;
+    stream << getName() << " " << getAmount();
+    return stream.str();
+  }
+  std::string display_size() override { return std::to_string(getAmount()); }
+};
+
+class Pt2PtTIData : public TIData {
+public:
+  Pt2PtTIData(std::string name, int endpoint, int size, std::string datatype)
+      : TIData(name, endpoint, size, datatype){};
+  std::string print() override
+  {
+    std::stringstream stream;
+    stream << getName() << " ";
+    if (endpoint >= 0)
+      stream << endpoint << " ";
+    stream << send_size << " " << send_type;
+    return stream.str();
+  }
+  std::string display_size() override { return std::to_string(send_size); }
+};
+
+class CollTIData : public TIData {
+public:
+  CollTIData(std::string name, int root, double amount, int send_size, int recv_size, std::string send_type,
+             std::string recv_type)
+      : TIData(name, root, amount, send_size, recv_size, send_type, recv_type){};
+  std::string print() override
+  {
+    std::stringstream stream;
+    stream << getName() << " " << send_size << " ";
+    if (recv_size >= 0)
+      stream << recv_size << " ";
+    if (getAmount() >= 0.0)
+      stream << getAmount() << " ";
+    if (endpoint > 0 || (endpoint == 0 && not send_type.empty()))
+      stream << endpoint << " ";
+    stream << send_type << " " << recv_type;
+
+    return stream.str();
+  }
+  std::string display_size() override { return std::to_string(send_size); }
+};
+
+class VarCollTIData : public TIData {
+public:
+  VarCollTIData(std::string name, int root, int send_size, std::vector<int>* sendcounts, int recv_size,
+                std::vector<int>* recvcounts, std::string send_type, std::string recv_type)
+      : TIData(name, root, send_size, sendcounts, recv_size, recvcounts, send_type, recv_type){};
+  std::string print() override
+  {
+    std::stringstream stream;
+    stream << getName() << " ";
+    if (send_size >= 0)
+      stream << send_size << " ";
+    if (sendcounts != nullptr)
+      for (auto count : *sendcounts)
+        stream << count << " ";
+    if (recv_size >= 0)
+      stream << recv_size << " ";
+    if (recvcounts != nullptr)
+      for (auto count : *recvcounts)
+        stream << count << " ";
+    if (endpoint > 0 || (endpoint == 0 && not send_type.empty()))
+      stream << endpoint << " ";
+    stream << send_type << " " << recv_type;
+
+    return stream.str();
+  }
+  std::string display_size() override { return std::to_string(send_size > 0 ? send_size : recv_size); }
+};
+}
+}
+
 extern "C" {
 
 extern XBT_PRIVATE std::set<std::string> created_categories;
@@ -102,60 +247,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);
 
-enum e_caller_type {
-  TRACING_INIT,
-  TRACING_FINALIZE,
-  TRACING_COMM_SIZE,
-  TRACING_COMM_SPLIT,
-  TRACING_COMM_DUP,
-  TRACING_SEND,
-  TRACING_ISEND,
-  TRACING_SSEND,
-  TRACING_ISSEND,
-  TRACING_RECV,
-  TRACING_IRECV,
-  TRACING_SENDRECV,
-  TRACING_TEST,
-  TRACING_WAIT,
-  TRACING_WAITALL,
-  TRACING_WAITANY,
-  TRACING_BARRIER,
-  TRACING_BCAST,
-  TRACING_REDUCE,
-  TRACING_ALLREDUCE,
-  TRACING_ALLTOALL,
-  TRACING_ALLTOALLV,
-  TRACING_GATHER,
-  TRACING_GATHERV,
-  TRACING_SCATTER,
-  TRACING_SCATTERV,
-  TRACING_ALLGATHER,
-  TRACING_ALLGATHERV,
-  TRACING_REDUCE_SCATTER,
-  TRACING_COMPUTING,
-  TRACING_SLEEPING,
-  TRACING_SCAN,
-  TRACING_EXSCAN
-};
-
-struct s_instr_extra_data_t {
-  e_caller_type type;
-  int send_size;
-  int recv_size;
-  double comp_size;
-  double sleep_duration;
-  int src;
-  int dst;
-  int root;
-  const char* datatype1;
-  const char* datatype2;
-  int* sendcounts;
-  int* recvcounts;
-  int num_processes;
-};
-
-typedef s_instr_extra_data_t* instr_extra_data;
-
 /* 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
index 78dec32..def907b 100644 (file)
@@ -18,15 +18,15 @@ 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);
 XBT_PRIVATE void TRACE_smpi_computing_out(int rank);
-XBT_PRIVATE void TRACE_smpi_computing_in(int rank, instr_extra_data extra);
+XBT_PRIVATE void TRACE_smpi_computing_in(int rank, double amount);
 XBT_PRIVATE void TRACE_smpi_sleeping_init(int rank);
 XBT_PRIVATE void TRACE_smpi_sleeping_out(int rank);
-XBT_PRIVATE void TRACE_smpi_sleeping_in(int rank, instr_extra_data extra);
+XBT_PRIVATE void TRACE_smpi_sleeping_in(int rank, double duration);
 XBT_PRIVATE void TRACE_smpi_testing_out(int rank);
-XBT_PRIVATE void TRACE_smpi_testing_in(int rank, instr_extra_data extra);
+XBT_PRIVATE void TRACE_smpi_testing_in(int rank);
 XBT_PRIVATE void TRACE_smpi_alloc();
 XBT_PRIVATE void TRACE_smpi_release();
-XBT_PRIVATE void TRACE_smpi_comm_in(int rank, const char* operation, instr_extra_data extra);
+XBT_PRIVATE void TRACE_smpi_comm_in(int rank, const char* operation, simgrid::instr::TIData* extra);
 XBT_PRIVATE void TRACE_smpi_comm_out(int rank);
 XBT_PRIVATE void TRACE_smpi_send(int rank, int src, int dst, int tag, int size);
 XBT_PRIVATE void TRACE_smpi_recv(int src, int dst, int tag);
index 52bb7c6..d76cad3 100644 (file)
@@ -39,11 +39,9 @@ int PMPI_Init(int *argc, char ***argv)
     smpi_process()->mark_as_initialized();
     int rank = smpi_process()->index();
     TRACE_smpi_init(rank);
-    TRACE_smpi_computing_init(rank);
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-    extra->type = TRACING_INIT;
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+    TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::NoOpTIData("init"));
     TRACE_smpi_comm_out(rank);
+    TRACE_smpi_computing_init(rank);
     smpi_bench_begin();
   }
 
@@ -56,14 +54,12 @@ int PMPI_Finalize()
 {
   smpi_bench_end();
   int rank = smpi_process()->index();
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type = TRACING_FINALIZE;
-  TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+  TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::NoOpTIData("finalize"));
 
   smpi_process()->finalize();
 
   TRACE_smpi_comm_out(rank);
-  TRACE_smpi_finalize(smpi_process()->index());
+  TRACE_smpi_finalize(rank);
   return MPI_SUCCESS;
 }
 
index f71f6c6..aaf32c3 100644 (file)
@@ -27,14 +27,10 @@ int PMPI_Bcast(void *buf, int count, MPI_Datatype datatype, int root, MPI_Comm c
     retval = MPI_ERR_ARG;
   } else {
     int rank        = smpi_process()->index();
-    int root_traced = comm->group()->index(root);
-
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
-    extra->type            = TRACING_BCAST;
-    extra->root            = root_traced;
-    extra->datatype1       = encode_datatype(datatype);
-    extra->send_size       = datatype->is_basic() ? count : count * datatype->size();
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+    TRACE_smpi_comm_in(rank, __FUNCTION__,
+                       new simgrid::instr::CollTIData("bcast", comm->group()->index(root), -1.0,
+                                                      datatype->is_basic() ? count : count * datatype->size(), -1,
+                                                      encode_datatype(datatype), ""));
     if (comm->size() > 1)
       simgrid::smpi::Colls::bcast(buf, count, datatype, root, comm);
     retval = MPI_SUCCESS;
@@ -54,10 +50,8 @@ int PMPI_Barrier(MPI_Comm comm)
   if (comm == MPI_COMM_NULL) {
     retval = MPI_ERR_COMM;
   } else {
-    int rank               = smpi_process()->index();
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
-    extra->type            = TRACING_BARRIER;
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+    int rank = smpi_process()->index();
+    TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::NoOpTIData("barrier"));
 
     simgrid::smpi::Colls::barrier(comm);
 
@@ -97,17 +91,13 @@ int PMPI_Gather(void *sendbuf, int sendcount, MPI_Datatype sendtype,void *recvbu
       sendtmptype=recvtype;
     }
     int rank               = smpi_process()->index();
-    int root_traced        = comm->group()->index(root);
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
-    extra->type            = TRACING_GATHER;
-    extra->root            = root_traced;
-
-    extra->datatype1 = encode_datatype(sendtmptype);
-    extra->send_size = sendtmptype->is_basic() ? sendtmpcount : sendtmpcount * sendtmptype->size();
-    extra->datatype2 = encode_datatype(recvtype);
-    extra->recv_size = (comm->rank() != root || recvtype->is_basic()) ? recvcount : recvcount * recvtype->size();
 
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+    TRACE_smpi_comm_in(rank, __FUNCTION__,
+                       new simgrid::instr::CollTIData(
+                           "gather", comm->group()->index(root), -1.0,
+                           sendtmptype->is_basic() ? sendtmpcount : sendtmpcount * sendtmptype->size(),
+                           (comm->rank() != root || recvtype->is_basic()) ? recvcount : recvcount * recvtype->size(),
+                           encode_datatype(sendtmptype), encode_datatype(recvtype)));
 
     simgrid::smpi::Colls::gather(sendtmpbuf, sendtmpcount, sendtmptype, recvbuf, recvcount, recvtype, root, comm);
 
@@ -144,24 +134,21 @@ int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recv
       sendtmptype=recvtype;
     }
 
-    int rank               = smpi_process()->index();
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
-    extra->type            = TRACING_GATHERV;
-    extra->num_processes   = comm->size();
-    extra->root            = comm->group()->index(root);
-
-    extra->datatype1 = encode_datatype(sendtmptype);
-    extra->send_size = sendtmptype->is_basic() ? sendtmpcount : sendtmpcount * sendtmptype->size();
-    extra->datatype2 = encode_datatype(recvtype);
+    int rank         = smpi_process()->index();
     int dt_size_recv = recvtype->is_basic() ? 1 : recvtype->size();
 
+    std::vector<int>* trace_recvcounts = new std::vector<int>;
     if (comm->rank() == root) {
-      extra->recvcounts = new int[extra->num_processes];
-      for (int i             = 0; i < extra->num_processes; i++) // copy data to avoid bad free
-        extra->recvcounts[i] = recvcounts[i] * dt_size_recv;
+      for (int i = 0; i < comm->size(); i++) // copy data to avoid bad free
+        trace_recvcounts->push_back(recvcounts[i] * dt_size_recv);
     }
 
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+    TRACE_smpi_comm_in(rank, __FUNCTION__,
+                       new simgrid::instr::VarCollTIData(
+                           "gatherV", comm->group()->index(root),
+                           sendtmptype->is_basic() ? sendtmpcount : sendtmpcount * sendtmptype->size(), nullptr,
+                           dt_size_recv, trace_recvcounts, encode_datatype(sendtmptype), encode_datatype(recvtype)));
+
     retval = simgrid::smpi::Colls::gatherv(sendtmpbuf, sendtmpcount, sendtmptype, recvbuf, recvcounts, displs, recvtype, root, comm);
     TRACE_smpi_comm_out(rank);
   }
@@ -173,7 +160,7 @@ int PMPI_Gatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recv
 int PMPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
                    void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm)
 {
-  int retval = 0;
+  int retval = MPI_SUCCESS;
 
   smpi_bench_end();
 
@@ -192,18 +179,14 @@ int PMPI_Allgather(void *sendbuf, int sendcount, MPI_Datatype sendtype,
       sendtype=recvtype;
     }
     int rank               = smpi_process()->index();
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
-    extra->type            = TRACING_ALLGATHER;
 
-    extra->datatype1 = encode_datatype(sendtype);
-    extra->send_size = sendtype->is_basic() ? sendcount : sendcount * sendtype->size();
-    extra->datatype2 = encode_datatype(recvtype);
-    extra->recv_size = recvtype->is_basic() ? recvcount : recvcount * recvtype->size();
-
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+    TRACE_smpi_comm_in(rank, __FUNCTION__,
+                       new simgrid::instr::CollTIData("allGather", -1, -1.0,
+                                                      sendtype->is_basic() ? sendcount : sendcount * sendtype->size(),
+                                                      recvtype->is_basic() ? recvcount : recvcount * recvtype->size(),
+                                                      encode_datatype(sendtype), encode_datatype(recvtype)));
 
     simgrid::smpi::Colls::allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm);
-    retval = MPI_SUCCESS;
     TRACE_smpi_comm_out(rank);
   }
   smpi_bench_begin();
@@ -233,19 +216,16 @@ int PMPI_Allgatherv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
       sendtype=recvtype;
     }
     int rank               = smpi_process()->index();
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
-    extra->type            = TRACING_ALLGATHERV;
-    extra->num_processes   = comm->size();
-    extra->datatype1       = encode_datatype(sendtype);
-    extra->send_size       = sendtype->is_basic() ? sendcount : sendcount * sendtype->size();
-    extra->datatype2       = encode_datatype(recvtype);
     int dt_size_recv       = recvtype->is_basic() ? 1 : recvtype->size();
 
-    extra->recvcounts = new int[extra->num_processes];
-    for (int i             = 0; i < extra->num_processes; i++) // copy data to avoid bad free
-      extra->recvcounts[i] = recvcounts[i] * dt_size_recv;
+    std::vector<int>* trace_recvcounts = new std::vector<int>;
+    for (int i = 0; i < comm->size(); i++) // copy data to avoid bad free
+      trace_recvcounts->push_back(recvcounts[i] * dt_size_recv);
 
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+    TRACE_smpi_comm_in(rank, __FUNCTION__,
+                       new simgrid::instr::VarCollTIData(
+                           "allGatherV", -1, sendtype->is_basic() ? sendcount : sendcount * sendtype->size(), nullptr,
+                           dt_size_recv, trace_recvcounts, encode_datatype(sendtype), encode_datatype(recvtype)));
 
     simgrid::smpi::Colls::allgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm);
     retval = MPI_SUCCESS;
@@ -278,17 +258,13 @@ int PMPI_Scatter(void *sendbuf, int sendcount, MPI_Datatype sendtype,
       recvcount = sendcount;
     }
     int rank               = smpi_process()->index();
-    int root_traced        = comm->group()->index(root);
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
-    extra->type            = TRACING_SCATTER;
-    extra->root            = root_traced;
-
-    extra->datatype1 = encode_datatype(sendtype);
-    extra->send_size = (comm->rank() != root || sendtype->is_basic()) ? sendcount : sendcount * sendtype->size();
-    extra->datatype2 = encode_datatype(recvtype);
-    extra->recv_size = recvtype->is_basic() ? recvcount : recvcount * recvtype->size();
 
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+    TRACE_smpi_comm_in(rank, __FUNCTION__,
+                       new simgrid::instr::CollTIData(
+                           "scatter", comm->group()->index(root), -1.0,
+                           (comm->rank() != root || sendtype->is_basic()) ? sendcount : sendcount * sendtype->size(),
+                           recvtype->is_basic() ? recvcount : recvcount * recvtype->size(), encode_datatype(sendtype),
+                           encode_datatype(recvtype)));
 
     simgrid::smpi::Colls::scatter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm);
     retval = MPI_SUCCESS;
@@ -319,21 +295,18 @@ int PMPI_Scatterv(void *sendbuf, int *sendcounts, int *displs,
       recvcount = sendcounts[comm->rank()];
     }
     int rank               = smpi_process()->index();
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
-    extra->type            = TRACING_SCATTERV;
-    extra->num_processes   = comm->size();
-    extra->root            = comm->group()->index(root);
-    extra->datatype1       = encode_datatype(sendtype);
-    extra->datatype2       = encode_datatype(recvtype);
     int dt_size_send       = sendtype->is_basic() ? 1 : sendtype->size();
-    extra->recv_size       = recvtype->is_basic() ? recvcount : recvcount * recvtype->size();
+
+    std::vector<int>* trace_sendcounts = new std::vector<int>;
     if (comm->rank() == root) {
-      extra->sendcounts = new int[extra->num_processes];
-      for (int i             = 0; i < extra->num_processes; i++) // copy data to avoid bad free
-        extra->sendcounts[i] = sendcounts[i] * dt_size_send;
+      for (int i = 0; i < comm->size(); i++) // copy data to avoid bad free
+        trace_sendcounts->push_back(sendcounts[i] * dt_size_send);
     }
 
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+    TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::VarCollTIData(
+                                               "scatterV", comm->group()->index(root), dt_size_send, trace_sendcounts,
+                                               recvtype->is_basic() ? recvcount : recvcount * recvtype->size(), nullptr,
+                                               encode_datatype(sendtype), encode_datatype(recvtype)));
 
     retval = simgrid::smpi::Colls::scatterv(sendbuf, sendcounts, displs, sendtype, recvbuf, recvcount, recvtype, root, comm);
 
@@ -357,13 +330,10 @@ int PMPI_Reduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
   } else {
     int rank               = smpi_process()->index();
 
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
-    extra->root            = comm->group()->index(root);
-    extra->type            = TRACING_REDUCE;
-    extra->datatype1       = encode_datatype(datatype);
-    extra->send_size       = datatype->is_basic() ? count : count * datatype->size();
-
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+    TRACE_smpi_comm_in(rank, __FUNCTION__,
+                       new simgrid::instr::CollTIData("reduce", comm->group()->index(root), 0,
+                                                      datatype->is_basic() ? count : count * datatype->size(), -1,
+                                                      encode_datatype(datatype), ""));
 
     simgrid::smpi::Colls::reduce(sendbuf, recvbuf, count, datatype, op, root, comm);
 
@@ -409,13 +379,11 @@ int PMPI_Allreduce(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatyp
       simgrid::smpi::Datatype::copy(recvbuf, count, datatype,sendtmpbuf, count, datatype);
     }
     int rank               = smpi_process()->index();
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
-    extra->type            = TRACING_ALLREDUCE;
 
-    extra->datatype1 = encode_datatype(datatype);
-    extra->send_size = datatype->is_basic() ? count : count * datatype->size();
-
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+    TRACE_smpi_comm_in(rank, __FUNCTION__,
+                       new simgrid::instr::CollTIData("allReduce", -1, 0,
+                                                      datatype->is_basic() ? count : count * datatype->size(), -1,
+                                                      encode_datatype(datatype), ""));
 
     simgrid::smpi::Colls::allreduce(sendtmpbuf, recvbuf, count, datatype, op, comm);
 
@@ -444,13 +412,10 @@ int PMPI_Scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MP
     retval = MPI_ERR_OP;
   } else {
     int rank               = smpi_process()->index();
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
-    extra->type            = TRACING_SCAN;
-
-    extra->datatype1 = encode_datatype(datatype);
-    extra->send_size = datatype->is_basic() ? count : count * datatype->size();
 
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+    TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::Pt2PtTIData(
+                                               "scan", -1, datatype->is_basic() ? count : count * datatype->size(),
+                                               encode_datatype(datatype)));
 
     retval = simgrid::smpi::Colls::scan(sendbuf, recvbuf, count, datatype, op, comm);
 
@@ -474,16 +439,15 @@ int PMPI_Exscan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
     retval = MPI_ERR_OP;
   } else {
     int rank               = smpi_process()->index();
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
-    extra->type            = TRACING_EXSCAN;
-    extra->datatype1       = encode_datatype(datatype);
-    extra->send_size       = datatype->is_basic() ? count : count * datatype->size();
     void* sendtmpbuf = sendbuf;
     if (sendbuf == MPI_IN_PLACE) {
       sendtmpbuf = static_cast<void*>(xbt_malloc(count * datatype->size()));
       memcpy(sendtmpbuf, recvbuf, count * datatype->size());
     }
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+
+    TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::Pt2PtTIData(
+                                               "exscan", -1, datatype->is_basic() ? count : count * datatype->size(),
+                                               encode_datatype(datatype)));
 
     retval = simgrid::smpi::Colls::exscan(sendtmpbuf, recvbuf, count, datatype, op, comm);
 
@@ -511,27 +475,24 @@ int PMPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts, MPI_Datat
     retval = MPI_ERR_ARG;
   } else {
     int rank               = smpi_process()->index();
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
-    extra->type            = TRACING_REDUCE_SCATTER;
-    extra->num_processes   = comm->size();
-    ;
-    extra->type            = TRACING_EXSCAN;
-    extra->datatype1       = encode_datatype(datatype);
-    extra->send_size       = datatype->is_basic() ? 1 : datatype->size();
-
-    extra->recvcounts = new int[extra->num_processes];
+    std::vector<int>* trace_recvcounts = new std::vector<int>;
+    int dt_send_size                   = datatype->is_basic() ? 1 : datatype->size();
     int totalcount    = 0;
-    for (int i = 0; i < extra->num_processes; i++) { // copy data to avoid bad free
-      extra->recvcounts[i] = recvcounts[i] * extra->send_size;
+
+    for (int i = 0; i < comm->size(); i++) { // copy data to avoid bad free
+      trace_recvcounts->push_back(recvcounts[i] * dt_send_size);
       totalcount += recvcounts[i];
     }
+
     void* sendtmpbuf = sendbuf;
     if (sendbuf == MPI_IN_PLACE) {
       sendtmpbuf = static_cast<void*>(xbt_malloc(totalcount * datatype->size()));
       memcpy(sendtmpbuf, recvbuf, totalcount * datatype->size());
     }
 
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+    TRACE_smpi_comm_in(rank, __FUNCTION__,
+                       new simgrid::instr::VarCollTIData("reduceScatter", -1, dt_send_size, nullptr, -1,
+                                                         trace_recvcounts, encode_datatype(datatype), ""));
 
     simgrid::smpi::Colls::reduce_scatter(sendtmpbuf, recvbuf, recvcounts, datatype, op, comm);
     retval = MPI_SUCCESS;
@@ -563,22 +524,18 @@ int PMPI_Reduce_scatter_block(void *sendbuf, void *recvbuf, int recvcount,
     int count = comm->size();
 
     int rank               = smpi_process()->index();
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
-    extra->type            = TRACING_REDUCE_SCATTER;
-    extra->num_processes   = count;
-    extra->datatype1       = encode_datatype(datatype);
-    int dt_size_send       = datatype->is_basic() ? 1 : datatype->size();
-    extra->send_size       = 0;
-    extra->recvcounts      = new int[extra->num_processes];
-    for (int i             = 0; i < extra->num_processes; i++) // copy data to avoid bad free
-      extra->recvcounts[i] = recvcount * dt_size_send;
+    int dt_send_size                   = datatype->is_basic() ? 1 : datatype->size();
+    std::vector<int>* trace_recvcounts = new std::vector<int>(recvcount * dt_send_size); // copy data to avoid bad free
+
     void* sendtmpbuf       = sendbuf;
     if (sendbuf == MPI_IN_PLACE) {
       sendtmpbuf = static_cast<void*>(xbt_malloc(recvcount * count * datatype->size()));
       memcpy(sendtmpbuf, recvbuf, recvcount * count * datatype->size());
     }
 
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+    TRACE_smpi_comm_in(rank, __FUNCTION__,
+                       new simgrid::instr::VarCollTIData("reduceScatter", -1, 0, nullptr, -1, trace_recvcounts,
+                                                         encode_datatype(datatype), ""));
 
     int* recvcounts = new int[count];
     for (int i      = 0; i < count; i++)
@@ -609,9 +566,6 @@ int PMPI_Alltoall(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* rec
     retval = MPI_ERR_TYPE;
   } else {
     int rank               = smpi_process()->index();
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
-    extra->type            = TRACING_ALLTOALL;
-
     void* sendtmpbuf         = static_cast<char*>(sendbuf);
     int sendtmpcount         = sendcount;
     MPI_Datatype sendtmptype = sendtype;
@@ -622,12 +576,12 @@ int PMPI_Alltoall(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* rec
       sendtmptype  = recvtype;
     }
 
-    extra->datatype1 = encode_datatype(sendtmptype);
-    extra->send_size = sendtmptype->is_basic() ? sendtmpcount : sendtmpcount * sendtmptype->size();
-    extra->datatype2 = encode_datatype(recvtype);
-    extra->recv_size = recvtype->is_basic() ? recvcount : recvcount * recvtype->size();
-
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+    TRACE_smpi_comm_in(
+        rank, __FUNCTION__,
+        new simgrid::instr::CollTIData("allToAll", -1, -1.0,
+                                       sendtmptype->is_basic() ? sendtmpcount : sendtmpcount * sendtmptype->size(),
+                                       recvtype->is_basic() ? recvcount : recvcount * recvtype->size(),
+                                       encode_datatype(sendtmptype), encode_datatype(recvtype)));
 
     retval = simgrid::smpi::Colls::alltoall(sendtmpbuf, sendtmpcount, sendtmptype, recvbuf, recvcount, recvtype, comm);
 
@@ -657,15 +611,11 @@ int PMPI_Alltoallv(void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype
     retval = MPI_ERR_ARG;
   } else {
     int rank               = smpi_process()->index();
-    int i                  = 0;
     int size               = comm->size();
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
-    extra->type            = TRACING_ALLTOALLV;
-    extra->send_size       = 0;
-    extra->recv_size       = 0;
-    extra->recvcounts      = new int[size];
-    extra->sendcounts      = new int[size];
-    extra->datatype2       = encode_datatype(recvtype);
+    int send_size                      = 0;
+    int recv_size                      = 0;
+    std::vector<int>* trace_sendcounts = new std::vector<int>;
+    std::vector<int>* trace_recvcounts = new std::vector<int>;
     int dt_size_recv       = recvtype->size();
 
     void* sendtmpbuf         = static_cast<char*>(sendbuf);
@@ -673,9 +623,9 @@ int PMPI_Alltoallv(void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype
     int* sendtmpdisps        = senddisps;
     MPI_Datatype sendtmptype = sendtype;
     int maxsize              = 0;
-    for (i = 0; i < size; i++) { // copy data to avoid bad free
-      extra->recv_size += recvcounts[i] * dt_size_recv;
-      extra->recvcounts[i] = recvcounts[i] * dt_size_recv;
+    for (int i = 0; i < size; i++) { // copy data to avoid bad free
+      recv_size += recvcounts[i] * dt_size_recv;
+      trace_recvcounts->push_back(recvcounts[i] * dt_size_recv);
       if (((recvdisps[i] + recvcounts[i]) * dt_size_recv) > maxsize)
         maxsize = (recvdisps[i] + recvcounts[i]) * dt_size_recv;
     }
@@ -690,15 +640,17 @@ int PMPI_Alltoallv(void* sendbuf, int* sendcounts, int* senddisps, MPI_Datatype
       sendtmptype = recvtype;
     }
 
-    extra->datatype1 = encode_datatype(sendtmptype);
     int dt_size_send = sendtmptype->size();
 
-    for (i = 0; i < size; i++) { // copy data to avoid bad free
-      extra->send_size += sendtmpcounts[i] * dt_size_send;
-      extra->sendcounts[i] = sendtmpcounts[i] * dt_size_send;
+    for (int i = 0; i < size; i++) { // copy data to avoid bad free
+      send_size += sendtmpcounts[i] * dt_size_send;
+      trace_sendcounts->push_back(sendtmpcounts[i] * dt_size_send);
     }
-    extra->num_processes = size;
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+
+    TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::VarCollTIData(
+                                               "allToAllV", -1, send_size, trace_sendcounts, recv_size,
+                                               trace_recvcounts, encode_datatype(sendtype), encode_datatype(recvtype)));
+
     retval = simgrid::smpi::Colls::alltoallv(sendtmpbuf, sendtmpcounts, sendtmpdisps, sendtmptype, recvbuf, recvcounts,
                                     recvdisps, recvtype, comm);
     TRACE_smpi_comm_out(rank);
index 0e85db4..53bd024 100644 (file)
@@ -159,13 +159,10 @@ int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MP
 
     int rank       = smpi_process()->index();
 
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-    extra->type            = TRACING_IRECV;
-    extra->src             = comm->group()->index(src);
-    extra->dst             = rank;
-    extra->datatype1       = encode_datatype(datatype);
-    extra->send_size       = datatype->is_basic() ? count : count * datatype->size();
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+    TRACE_smpi_comm_in(rank, __FUNCTION__,
+                       new simgrid::instr::Pt2PtTIData("Irecv", comm->group()->index(src),
+                                                       datatype->is_basic() ? count : count * datatype->size(),
+                                                       encode_datatype(datatype)));
 
     *request = simgrid::smpi::Request::irecv(buf, count, datatype, src, tag, comm);
     retval = MPI_SUCCESS;
@@ -201,16 +198,14 @@ int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MP
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
   } else {
-    int rank               = smpi_process()->index();
-    int dst_traced = comm->group()->index(dst);
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-    extra->type = TRACING_ISEND;
-    extra->src = rank;
-    extra->dst = dst_traced;
-    extra->datatype1       = encode_datatype(datatype);
-    extra->send_size       = datatype->is_basic() ? count : count * datatype->size();
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
-    TRACE_smpi_send(rank, rank, dst_traced, tag, count*datatype->size());
+    int rank      = smpi_process()->index();
+    int trace_dst = comm->group()->index(dst);
+    TRACE_smpi_comm_in(rank, __FUNCTION__,
+                       new simgrid::instr::Pt2PtTIData("Isend", trace_dst,
+                                                       datatype->is_basic() ? count : count * datatype->size(),
+                                                       encode_datatype(datatype)));
+
+    TRACE_smpi_send(rank, rank, trace_dst, tag, count * datatype->size());
 
     *request = simgrid::smpi::Request::isend(buf, count, datatype, dst, tag, comm);
     retval = MPI_SUCCESS;
@@ -245,16 +240,13 @@ int PMPI_Issend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, M
   } else if(tag<0 && tag !=  MPI_ANY_TAG){
     retval = MPI_ERR_TAG;
   } else {
-    int rank               = smpi_process()->index();
-    int dst_traced = comm->group()->index(dst);
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-    extra->type = TRACING_ISSEND;
-    extra->src = rank;
-    extra->dst = dst_traced;
-    extra->datatype1       = encode_datatype(datatype);
-    extra->send_size       = datatype->is_basic() ? count : count * datatype->size();
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
-    TRACE_smpi_send(rank, rank, dst_traced, tag, count*datatype->size());
+    int rank      = smpi_process()->index();
+    int trace_dst = comm->group()->index(dst);
+    TRACE_smpi_comm_in(rank, __FUNCTION__,
+                       new simgrid::instr::Pt2PtTIData("ISsend", trace_dst,
+                                                       datatype->is_basic() ? count : count * datatype->size(),
+                                                       encode_datatype(datatype)));
+    TRACE_smpi_send(rank, rank, trace_dst, tag, count * datatype->size());
 
     *request = simgrid::smpi::Request::issend(buf, count, datatype, dst, tag, comm);
     retval = MPI_SUCCESS;
@@ -290,13 +282,10 @@ int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI
   } else {
     int rank               = smpi_process()->index();
     int src_traced         = comm->group()->index(src);
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
-    extra->type            = TRACING_RECV;
-    extra->src             = src_traced;
-    extra->dst             = rank;
-    extra->datatype1       = encode_datatype(datatype);
-    extra->send_size       = datatype->is_basic() ? count : count * datatype->size();
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+    TRACE_smpi_comm_in(rank, __FUNCTION__,
+                       new simgrid::instr::Pt2PtTIData("recv", src_traced,
+                                                       datatype->is_basic() ? count : count * datatype->size(),
+                                                       encode_datatype(datatype)));
 
     simgrid::smpi::Request::recv(buf, count, datatype, src, tag, comm, status);
     retval = MPI_SUCCESS;
@@ -336,13 +325,10 @@ int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI
   } else {
     int rank               = smpi_process()->index();
     int dst_traced         = comm->group()->index(dst);
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-    extra->type            = TRACING_SEND;
-    extra->src             = rank;
-    extra->dst             = dst_traced;
-    extra->datatype1       = encode_datatype(datatype);
-    extra->send_size       = datatype->is_basic() ? count : count * datatype->size();
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+    TRACE_smpi_comm_in(rank, __FUNCTION__,
+                       new simgrid::instr::Pt2PtTIData("send", dst_traced,
+                                                       datatype->is_basic() ? count : count * datatype->size(),
+                                                       encode_datatype(datatype)));
     if (not TRACE_smpi_view_internals()) {
       TRACE_smpi_send(rank, rank, dst_traced, tag,count*datatype->size());
     }
@@ -377,14 +363,10 @@ int PMPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MP
   } else {
     int rank               = smpi_process()->index();
     int dst_traced         = comm->group()->index(dst);
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-    extra->type            = TRACING_SSEND;
-    extra->src             = rank;
-    extra->dst             = dst_traced;
-    extra->datatype1       = encode_datatype(datatype);
-    extra->send_size       = datatype->is_basic() ? count : count * datatype->size();
-
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+    TRACE_smpi_comm_in(rank, __FUNCTION__,
+                       new simgrid::instr::Pt2PtTIData("Ssend", dst_traced,
+                                                       datatype->is_basic() ? count : count * datatype->size(),
+                                                       encode_datatype(datatype)));
     TRACE_smpi_send(rank, rank, dst_traced, tag, count * datatype->size());
 
     simgrid::smpi::Request::ssend(buf, count, datatype, dst, tag, comm);
@@ -424,24 +406,22 @@ int PMPI_Sendrecv(void* sendbuf, int sendcount, MPI_Datatype sendtype, int dst,
     int rank               = smpi_process()->index();
     int dst_traced         = comm->group()->index(dst);
     int src_traced         = comm->group()->index(src);
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t, 1);
-    extra->type            = TRACING_SENDRECV;
-    extra->src             = src_traced;
-    extra->dst             = dst_traced;
-    extra->datatype1       = encode_datatype(sendtype);
-    extra->send_size       = sendtype->is_basic() ? sendcount : sendcount * sendtype->size();
-    extra->datatype2       = encode_datatype(recvtype);
-    extra->recv_size       = recvtype->is_basic() ? recvcount : recvcount * recvtype->size();
-
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+    //    extra->src             = src_traced;
+    //    extra->dst             = dst_traced;
+    //    extra->send_size       = sendtype->is_basic() ? sendcount : sendcount * sendtype->size();
+    //    extra->recv_size       = recvtype->is_basic() ? recvcount : recvcount * recvtype->size();
+    //    extra->datatype1       = encode_datatype(sendtype);
+    //    extra->datatype2       = encode_datatype(recvtype);
+
+    // TODO TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
     TRACE_smpi_send(rank, rank, dst_traced, sendtag, sendcount * sendtype->size());
 
     simgrid::smpi::Request::sendrecv(sendbuf, sendcount, sendtype, dst, sendtag, recvbuf, recvcount, recvtype, src,
                                      recvtag, comm, status);
     retval = MPI_SUCCESS;
 
-    TRACE_smpi_comm_out(rank);
     TRACE_smpi_recv(src_traced, rank, recvtag);
+    TRACE_smpi_comm_out(rank);
   }
 
   smpi_bench_begin();
@@ -482,9 +462,7 @@ int PMPI_Test(MPI_Request * request, int *flag, MPI_Status * status)
   } else {
     int rank = ((*request)->comm() != MPI_COMM_NULL) ? smpi_process()->index() : -1;
 
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-    extra->type = TRACING_TEST;
-    TRACE_smpi_testing_in(rank, extra);
+    TRACE_smpi_testing_in(rank);
 
     *flag = simgrid::smpi::Request::test(request,status);
 
@@ -586,9 +564,7 @@ int PMPI_Wait(MPI_Request * request, MPI_Status * status)
     int tag_traced= (*request)->tag();
     MPI_Comm comm = (*request)->comm();
     int is_wait_for_receive = ((*request)->flags() & RECV);
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-    extra->type = TRACING_WAIT;
-    TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+    TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::NoOpTIData("wait"));
 
     simgrid::smpi::Request::wait(request, status);
     retval = MPI_SUCCESS;
@@ -632,10 +608,7 @@ int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * sta
     }
   }
   int rank_traced = smpi_process()->index();
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type = TRACING_WAITANY;
-  extra->send_size=count;
-  TRACE_smpi_comm_in(rank_traced, __FUNCTION__, extra);
+  TRACE_smpi_comm_in(rank_traced, __FUNCTION__, new simgrid::instr::CpuTIData("waitAny", static_cast<double>(count)));
 
   *index = simgrid::smpi::Request::waitany(count, requests, status);
 
@@ -681,10 +654,7 @@ int PMPI_Waitall(int count, MPI_Request requests[], MPI_Status status[])
     }
   }
   int rank_traced = smpi_process()->index();
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type = TRACING_WAITALL;
-  extra->send_size=count;
-  TRACE_smpi_comm_in(rank_traced, __FUNCTION__, extra);
+  TRACE_smpi_comm_in(rank_traced, __FUNCTION__, new simgrid::instr::CpuTIData("waitAll", static_cast<double>(count)));
 
   int retval = simgrid::smpi::Request::waitall(count, requests, status);
 
index 2d5e975..1651843 100644 (file)
@@ -105,16 +105,6 @@ static std::string TRACE_smpi_get_key(int src, int dst, int tag, int send)
 
 static std::unordered_map<smx_actor_t, std::string> process_category;
 
-static void cleanup_extra_data (instr_extra_data extra){
-  if(extra!=nullptr){
-    if(extra->sendcounts!=nullptr)
-      delete[] extra->sendcounts;
-    if(extra->recvcounts!=nullptr)
-      delete[] extra->recvcounts;
-    xbt_free(extra);
-  }
-}
-
 void TRACE_internal_smpi_set_category (const char *category)
 {
   if (not TRACE_smpi_is_enabled())
@@ -193,70 +183,54 @@ void TRACE_smpi_finalize(int rank)
 void TRACE_smpi_computing_init(int rank)
 {
  //first use, initialize the color in the trace
- if (not TRACE_smpi_is_enabled() || not TRACE_smpi_is_computing())
-   return;
-
- smpi_container(rank)->getState("MPI_STATE")->addEntityValue("computing", instr_find_color("computing"));
+ if (TRACE_smpi_is_enabled() && TRACE_smpi_is_computing())
+   smpi_container(rank)->getState("MPI_STATE")->addEntityValue("computing", instr_find_color("computing"));
 }
 
-void TRACE_smpi_computing_in(int rank, instr_extra_data extra)
+void TRACE_smpi_computing_in(int rank, double amount)
 {
-  //do not forget to set the color first, otherwise this will explode
-  if (not TRACE_smpi_is_enabled() || not TRACE_smpi_is_computing()) {
-    cleanup_extra_data(extra);
-    return;
-  }
-
-  smpi_container(rank)->getState("MPI_STATE")->pushEvent("computing", static_cast<void*>(extra));
+  if (TRACE_smpi_is_enabled() && TRACE_smpi_is_computing())
+    smpi_container(rank)
+        ->getState("MPI_STATE")
+        ->pushEvent("computing", new simgrid::instr::CpuTIData("compute", amount));
 }
 
 void TRACE_smpi_computing_out(int rank)
 {
-  if (not TRACE_smpi_is_enabled() || not TRACE_smpi_is_computing())
-    return;
-
-  smpi_container(rank)->getState("MPI_STATE")->popEvent();
+  if (TRACE_smpi_is_enabled() && TRACE_smpi_is_computing())
+    smpi_container(rank)->getState("MPI_STATE")->popEvent();
 }
 
 void TRACE_smpi_sleeping_init(int rank)
 {
   //first use, initialize the color in the trace
-  if (not TRACE_smpi_is_enabled() || not TRACE_smpi_is_sleeping())
-    return;
-
-  smpi_container(rank)->getState("MPI_STATE")->addEntityValue("sleeping", instr_find_color("sleeping"));
+  if (TRACE_smpi_is_enabled() && TRACE_smpi_is_sleeping())
+    smpi_container(rank)->getState("MPI_STATE")->addEntityValue("sleeping", instr_find_color("sleeping"));
 }
 
-void TRACE_smpi_sleeping_in(int rank, instr_extra_data extra)
+void TRACE_smpi_sleeping_in(int rank, double duration)
 {
-  //do not forget to set the color first, otherwise this will explode
-  if (not TRACE_smpi_is_enabled() || not TRACE_smpi_is_sleeping()) {
-    cleanup_extra_data(extra);
-    return;
-  }
-
-  smpi_container(rank)->getState("MPI_STATE")->pushEvent("sleeping", static_cast<void*>(extra));
+  if (TRACE_smpi_is_enabled() && TRACE_smpi_is_sleeping())
+    smpi_container(rank)
+        ->getState("MPI_STATE")
+        ->pushEvent("sleeping", new simgrid::instr::CpuTIData("sleep", duration));
 }
 
 void TRACE_smpi_sleeping_out(int rank)
 {
-  if (not TRACE_smpi_is_enabled() || not TRACE_smpi_is_sleeping())
-    return;
-
-  smpi_container(rank)->getState("MPI_STATE")->popEvent();
+  if (TRACE_smpi_is_enabled() && not TRACE_smpi_is_sleeping())
+    smpi_container(rank)->getState("MPI_STATE")->popEvent();
 }
 
-void TRACE_smpi_testing_in(int rank, instr_extra_data extra)
+void TRACE_smpi_testing_in(int rank)
 {
   //do not forget to set the color first, otherwise this will explode
-  if (not TRACE_smpi_is_enabled()) {
-    cleanup_extra_data(extra);
+  if (not TRACE_smpi_is_enabled())
     return;
-  }
 
   simgrid::instr::StateType* state = smpi_container(rank)->getState("MPI_STATE");
   state->addEntityValue("test");
-  state->pushEvent("test", static_cast<void*>(extra));
+  state->pushEvent("test", new simgrid::instr::NoOpTIData("test"));
 }
 
 void TRACE_smpi_testing_out(int rank)
@@ -265,16 +239,16 @@ void TRACE_smpi_testing_out(int rank)
     smpi_container(rank)->getState("MPI_STATE")->popEvent();
 }
 
-void TRACE_smpi_comm_in(int rank, const char* operation, instr_extra_data extra)
+void TRACE_smpi_comm_in(int rank, const char* operation, simgrid::instr::TIData* extra)
 {
   if (not TRACE_smpi_is_enabled()) {
-    cleanup_extra_data(extra);
+    delete extra;
     return;
   }
 
   simgrid::instr::StateType* state = smpi_container(rank)->getState("MPI_STATE");
   state->addEntityValue(operation, instr_find_color(operation));
-  state->pushEvent(operation, static_cast<void*>(extra));
+  state->pushEvent(operation, extra);
 }
 
 void TRACE_smpi_comm_out(int rank)
index 3b78d57..795521e 100644 (file)
@@ -54,10 +54,7 @@ void smpi_execute(double duration)
     XBT_DEBUG("Sleep for %g to handle real computation time", duration);
     double flops = duration * smpi_host_speed;
     int rank = smpi_process()->index();
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-    extra->type=TRACING_COMPUTING;
-    extra->comp_size=flops;
-    TRACE_smpi_computing_in(rank, extra);
+    TRACE_smpi_computing_in(rank, flops);
 
     smpi_execute_flops(flops);
 
@@ -177,10 +174,7 @@ static unsigned int private_sleep(double secs)
 
   XBT_DEBUG("Sleep for: %lf secs", secs);
   int rank = MPI_COMM_WORLD->rank();
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type=TRACING_SLEEPING;
-  extra->sleep_duration=secs;
-  TRACE_smpi_sleeping_in(rank, extra);
+  TRACE_smpi_sleeping_in(rank, secs);
 
   simcall_process_sleep(secs);
 
index 6377489..8e02386 100644 (file)
@@ -197,14 +197,11 @@ static void action_compute(const char *const *action)
   double clock = smpi_process()->simulated_elapsed();
   double flops= parse_double(action[2]);
   int rank = smpi_process()->index();
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type=TRACING_COMPUTING;
-  extra->comp_size=flops;
-  TRACE_smpi_computing_in(rank, extra);
 
+  TRACE_smpi_computing_in(rank, flops);
   smpi_execute_flops(flops);
-
   TRACE_smpi_computing_out(rank);
+
   log_timed_action (action, clock);
 }
 
@@ -221,23 +218,18 @@ static void action_send(const char *const *action)
     MPI_CURRENT_TYPE= MPI_DEFAULT_TYPE;
 
   int rank = smpi_process()->index();
-
   int dst_traced = MPI_COMM_WORLD->group()->rank(to);
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type = TRACING_SEND;
-  extra->send_size = size;
-  extra->src = rank;
-  extra->dst = dst_traced;
-  extra->datatype1       = encode_datatype(MPI_CURRENT_TYPE);
-  TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+
+  TRACE_smpi_comm_in(rank, __FUNCTION__,
+                     new simgrid::instr::Pt2PtTIData("send", dst_traced, size, encode_datatype(MPI_CURRENT_TYPE)));
   if (not TRACE_smpi_view_internals())
     TRACE_smpi_send(rank, rank, dst_traced, 0, size*MPI_CURRENT_TYPE->size());
 
   Request::send(nullptr, size, MPI_CURRENT_TYPE, to , 0, MPI_COMM_WORLD);
 
-  log_timed_action (action, clock);
-
   TRACE_smpi_comm_out(rank);
+
+  log_timed_action(action, clock);
 }
 
 static void action_Isend(const char *const *action)
@@ -254,13 +246,8 @@ static void action_Isend(const char *const *action)
 
   int rank = smpi_process()->index();
   int dst_traced = MPI_COMM_WORLD->group()->rank(to);
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type = TRACING_ISEND;
-  extra->send_size = size;
-  extra->src = rank;
-  extra->dst = dst_traced;
-  extra->datatype1       = encode_datatype(MPI_CURRENT_TYPE);
-  TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+  TRACE_smpi_comm_in(rank, __FUNCTION__,
+                     new simgrid::instr::Pt2PtTIData("Isend", dst_traced, size, encode_datatype(MPI_CURRENT_TYPE)));
   if (not TRACE_smpi_view_internals())
     TRACE_smpi_send(rank, rank, dst_traced, 0, size*MPI_CURRENT_TYPE->size());
 
@@ -288,16 +275,11 @@ static void action_recv(const char *const *action) {
   int rank = smpi_process()->index();
   int src_traced = MPI_COMM_WORLD->group()->rank(from);
 
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type = TRACING_RECV;
-  extra->send_size = size;
-  extra->src = src_traced;
-  extra->dst = rank;
-  extra->datatype1       = encode_datatype(MPI_CURRENT_TYPE);
-  TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+  TRACE_smpi_comm_in(rank, __FUNCTION__,
+                     new simgrid::instr::Pt2PtTIData("recv", src_traced, size, encode_datatype(MPI_CURRENT_TYPE)));
 
   //unknown size from the receiver point of view
-  if(size<=0.0){
+  if (size <= 0.0) {
     Request::probe(from, 0, MPI_COMM_WORLD, &status);
     size=status.count;
   }
@@ -326,18 +308,13 @@ static void action_Irecv(const char *const *action)
 
   int rank = smpi_process()->index();
   int src_traced = MPI_COMM_WORLD->group()->rank(from);
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type = TRACING_IRECV;
-  extra->send_size = size;
-  extra->src = src_traced;
-  extra->dst = rank;
-  extra->datatype1       = encode_datatype(MPI_CURRENT_TYPE);
-  TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+  TRACE_smpi_comm_in(rank, __FUNCTION__,
+                     new simgrid::instr::Pt2PtTIData("Irecv", src_traced, size, encode_datatype(MPI_CURRENT_TYPE)));
   MPI_Status status;
   //unknow size from the receiver pov
-  if(size<=0.0){
-      Request::probe(from, 0, MPI_COMM_WORLD, &status);
-      size=status.count;
+  if (size <= 0.0) {
+    Request::probe(from, 0, MPI_COMM_WORLD, &status);
+    size = status.count;
   }
 
   MPI_Request request = Request::irecv(nullptr, size, MPI_CURRENT_TYPE, from, 0, MPI_COMM_WORLD);
@@ -348,7 +325,8 @@ static void action_Irecv(const char *const *action)
   log_timed_action (action, clock);
 }
 
-static void action_test(const char *const *action){
+static void action_test(const char* const* action)
+{
   CHECK_ACTION_PARAMS(action, 0, 0)
   double clock = smpi_process()->simulated_elapsed();
   MPI_Status status;
@@ -360,9 +338,7 @@ static void action_test(const char *const *action){
   //In this case, ignore the extra calls.
   if(request!=nullptr){
     int rank = smpi_process()->index();
-    instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-    extra->type=TRACING_TEST;
-    TRACE_smpi_testing_in(rank, extra);
+    TRACE_smpi_testing_in(rank);
 
     int flag = Request::test(&request, &status);
 
@@ -396,9 +372,7 @@ static void action_wait(const char *const *action){
   int src_traced = group->rank(request->src());
   int dst_traced = group->rank(request->dst());
   int is_wait_for_receive = (request->flags() & RECV);
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type = TRACING_WAIT;
-  TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+  TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::NoOpTIData("wait"));
 
   Request::wait(&request, &status);
 
@@ -417,10 +391,7 @@ static void action_waitall(const char *const *action){
     MPI_Status status[count_requests];
 
    int rank_traced = smpi_process()->index();
-   instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-   extra->type = TRACING_WAITALL;
-   extra->send_size=count_requests;
-   TRACE_smpi_comm_in(rank_traced, __FUNCTION__, extra);
+   TRACE_smpi_comm_in(rank_traced, __FUNCTION__, new simgrid::instr::Pt2PtTIData("waitAll", -1, count_requests, ""));
    int recvs_snd[count_requests];
    int recvs_rcv[count_requests];
    for (unsigned int i = 0; i < count_requests; i++) {
@@ -445,9 +416,7 @@ static void action_waitall(const char *const *action){
 static void action_barrier(const char *const *action){
   double clock = smpi_process()->simulated_elapsed();
   int rank = smpi_process()->index();
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type = TRACING_BARRIER;
-  TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+  TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::NoOpTIData("barrier"));
 
   Colls::barrier(MPI_COMM_WORLD);
 
@@ -471,14 +440,10 @@ static void action_bcast(const char *const *action)
   }
 
   int rank = smpi_process()->index();
-  int root_traced = MPI_COMM_WORLD->group()->index(root);
-
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type = TRACING_BCAST;
-  extra->send_size = size;
-  extra->root = root_traced;
-  extra->datatype1       = encode_datatype(MPI_CURRENT_TYPE);
-  TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+  TRACE_smpi_comm_in(rank, __FUNCTION__,
+                     new simgrid::instr::CollTIData("bcast", MPI_COMM_WORLD->group()->index(root), -1.0, size, -1,
+                                                    encode_datatype(MPI_CURRENT_TYPE), ""));
+
   void *sendbuf = smpi_get_tmp_sendbuffer(size* MPI_CURRENT_TYPE->size());
 
   Colls::bcast(sendbuf, size, MPI_CURRENT_TYPE, root, MPI_COMM_WORLD);
@@ -503,15 +468,9 @@ static void action_reduce(const char *const *action)
   }
 
   int rank = smpi_process()->index();
-  int root_traced = MPI_COMM_WORLD->group()->rank(root);
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type = TRACING_REDUCE;
-  extra->send_size = comm_size;
-  extra->comp_size = comp_size;
-  extra->datatype1       = encode_datatype(MPI_CURRENT_TYPE);
-  extra->root = root_traced;
-
-  TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+  TRACE_smpi_comm_in(rank, __FUNCTION__,
+                     new simgrid::instr::CollTIData("reduce", MPI_COMM_WORLD->group()->index(root), comp_size,
+                                                    comm_size, -1, encode_datatype(MPI_CURRENT_TYPE), ""));
 
   void *recvbuf = smpi_get_tmp_sendbuffer(comm_size* MPI_CURRENT_TYPE->size());
   void *sendbuf = smpi_get_tmp_sendbuffer(comm_size* MPI_CURRENT_TYPE->size());
@@ -534,12 +493,8 @@ static void action_allReduce(const char *const *action) {
 
   double clock = smpi_process()->simulated_elapsed();
   int rank = smpi_process()->index();
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type = TRACING_ALLREDUCE;
-  extra->send_size = comm_size;
-  extra->comp_size = comp_size;
-  extra->datatype1       = encode_datatype(MPI_CURRENT_TYPE);
-  TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+  TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::CollTIData("allReduce", -1, comp_size, comm_size, -1,
+                                                                        encode_datatype(MPI_CURRENT_TYPE), ""));
 
   void *recvbuf = smpi_get_tmp_sendbuffer(comm_size* MPI_CURRENT_TYPE->size());
   void *sendbuf = smpi_get_tmp_sendbuffer(comm_size* MPI_CURRENT_TYPE->size());
@@ -569,14 +524,9 @@ static void action_allToAll(const char *const *action) {
   void *recv = smpi_get_tmp_recvbuffer(recv_size*comm_size* MPI_CURRENT_TYPE2->size());
 
   int rank = smpi_process()->index();
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type = TRACING_ALLTOALL;
-  extra->send_size = send_size;
-  extra->recv_size = recv_size;
-  extra->datatype1       = encode_datatype(MPI_CURRENT_TYPE);
-  extra->datatype2       = encode_datatype(MPI_CURRENT_TYPE2);
-
-  TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+  TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::CollTIData("allToAll", -1, -1.0, send_size, recv_size,
+                                                                        encode_datatype(MPI_CURRENT_TYPE),
+                                                                        encode_datatype(MPI_CURRENT_TYPE2)));
 
   Colls::alltoall(send, send_size, MPI_CURRENT_TYPE, recv, recv_size, MPI_CURRENT_TYPE2, MPI_COMM_WORLD);
 
@@ -616,15 +566,9 @@ static void action_gather(const char *const *action) {
   if(rank==root)
     recv = smpi_get_tmp_recvbuffer(recv_size*comm_size* MPI_CURRENT_TYPE2->size());
 
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type = TRACING_GATHER;
-  extra->send_size = send_size;
-  extra->recv_size = recv_size;
-  extra->root = root;
-  extra->datatype1       = encode_datatype(MPI_CURRENT_TYPE);
-  extra->datatype2       = encode_datatype(MPI_CURRENT_TYPE2);
-
-  TRACE_smpi_comm_in(smpi_process()->index(), __FUNCTION__, extra);
+  TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::CollTIData("gather", root, -1.0, send_size, recv_size,
+                                                                        encode_datatype(MPI_CURRENT_TYPE),
+                                                                        encode_datatype(MPI_CURRENT_TYPE2)));
 
   Colls::gather(send, send_size, MPI_CURRENT_TYPE, recv, recv_size, MPI_CURRENT_TYPE2, root, MPI_COMM_WORLD);
 
@@ -632,6 +576,49 @@ static void action_gather(const char *const *action) {
   log_timed_action (action, clock);
 }
 
+static void action_scatter(const char* const* action)
+{
+  /* The structure of the scatter action for the rank 0 (total 4 processes) is the following:
+        0 gather 68 68 0 0 0
+      where:
+        1) 68 is the sendcounts
+        2) 68 is the recvcounts
+        3) 0 is the root node
+        4) 0 is the send datatype id, see decode_datatype()
+        5) 0 is the recv datatype id, see decode_datatype()
+  */
+  CHECK_ACTION_PARAMS(action, 2, 3)
+  double clock                   = smpi_process()->simulated_elapsed();
+  int comm_size                  = MPI_COMM_WORLD->size();
+  int send_size                  = parse_double(action[2]);
+  int recv_size                  = parse_double(action[3]);
+  MPI_Datatype MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE;
+  if (action[4] && action[5]) {
+    MPI_CURRENT_TYPE  = decode_datatype(action[5]);
+    MPI_CURRENT_TYPE2 = decode_datatype(action[6]);
+  } else {
+    MPI_CURRENT_TYPE = MPI_DEFAULT_TYPE;
+  }
+  void* send = smpi_get_tmp_sendbuffer(send_size * MPI_CURRENT_TYPE->size());
+  void* recv = nullptr;
+  int root   = 0;
+  if (action[4])
+    root   = atoi(action[4]);
+  int rank = MPI_COMM_WORLD->rank();
+
+  if (rank == root)
+    recv = smpi_get_tmp_recvbuffer(recv_size * comm_size * MPI_CURRENT_TYPE2->size());
+
+  TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::CollTIData("gather", root, -1.0, send_size, recv_size,
+                                                                        encode_datatype(MPI_CURRENT_TYPE),
+                                                                        encode_datatype(MPI_CURRENT_TYPE2)));
+
+  Colls::scatter(send, send_size, MPI_CURRENT_TYPE, recv, recv_size, MPI_CURRENT_TYPE2, root, MPI_COMM_WORLD);
+
+  TRACE_smpi_comm_out(smpi_process()->index());
+  log_timed_action(action, clock);
+}
+
 static void action_gatherv(const char *const *action) {
   /* The structure of the gatherv action for the rank 0 (total 4 processes) is the following:
        0 gather 68 68 10 10 10 0 0 0
@@ -671,18 +658,13 @@ static void action_gatherv(const char *const *action) {
   if(rank==root)
     recv = smpi_get_tmp_recvbuffer(recv_sum* MPI_CURRENT_TYPE2->size());
 
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type            = TRACING_GATHERV;
-  extra->send_size       = send_size;
-  extra->recvcounts      = new int[comm_size];
-  for(int i=0; i< comm_size; i++)//copy data to avoid bad free
-    extra->recvcounts[i] = recvcounts[i];
-  extra->root = root;
-  extra->num_processes = comm_size;
-  extra->datatype1       = encode_datatype(MPI_CURRENT_TYPE);
-  extra->datatype2       = encode_datatype(MPI_CURRENT_TYPE2);
+  std::vector<int>* trace_recvcounts = new std::vector<int>;
+  for (int i = 0; i < comm_size; i++) // copy data to avoid bad free
+    trace_recvcounts->push_back(recvcounts[i]);
 
-  TRACE_smpi_comm_in(smpi_process()->index(), __FUNCTION__, extra);
+  TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::VarCollTIData(
+                                             "gatherV", root, send_size, nullptr, -1, trace_recvcounts,
+                                             encode_datatype(MPI_CURRENT_TYPE), encode_datatype(MPI_CURRENT_TYPE2)));
 
   Colls::gatherv(send, send_size, MPI_CURRENT_TYPE, recv, recvcounts, disps, MPI_CURRENT_TYPE2, root, MPI_COMM_WORLD);
 
@@ -690,6 +672,60 @@ static void action_gatherv(const char *const *action) {
   log_timed_action (action, clock);
 }
 
+static void action_scatterv(const char* const* action)
+{
+  /* The structure of the scatterv action for the rank 0 (total 4 processes) is the following:
+       0 gather 68 10 10 10 68 0 0 0
+     where:
+       1) 68 10 10 10 is the sendcounts
+       2) 68 is the recvcount
+       3) 0 is the root node
+       4) 0 is the send datatype id, see decode_datatype()
+       5) 0 is the recv datatype id, see decode_datatype()
+  */
+  double clock  = smpi_process()->simulated_elapsed();
+  int comm_size = MPI_COMM_WORLD->size();
+  CHECK_ACTION_PARAMS(action, comm_size + 1, 2)
+  int recv_size = parse_double(action[2 + comm_size]);
+  int disps[comm_size];
+  int sendcounts[comm_size];
+  int send_sum = 0;
+
+  MPI_Datatype MPI_CURRENT_TYPE2 = MPI_DEFAULT_TYPE;
+  if (action[4 + comm_size] && action[5 + comm_size]) {
+    MPI_CURRENT_TYPE  = decode_datatype(action[4 + comm_size]);
+    MPI_CURRENT_TYPE2 = decode_datatype(action[5 + comm_size]);
+  } else
+    MPI_CURRENT_TYPE = MPI_DEFAULT_TYPE;
+
+  void* send = nullptr;
+  void* recv = smpi_get_tmp_recvbuffer(recv_size * MPI_CURRENT_TYPE->size());
+  for (int i = 0; i < comm_size; i++) {
+    sendcounts[i] = atoi(action[i + 2]);
+    send_sum += sendcounts[i];
+    disps[i] = 0;
+  }
+
+  int root = atoi(action[3 + comm_size]);
+  int rank = MPI_COMM_WORLD->rank();
+
+  if (rank == root)
+    send = smpi_get_tmp_sendbuffer(send_sum * MPI_CURRENT_TYPE2->size());
+
+  std::vector<int>* trace_sendcounts = new std::vector<int>;
+  for (int i = 0; i < comm_size; i++) // copy data to avoid bad free
+    trace_sendcounts->push_back(sendcounts[i]);
+
+  TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::VarCollTIData(
+                                             "gatherV", root, -1, trace_sendcounts, recv_size, nullptr,
+                                             encode_datatype(MPI_CURRENT_TYPE), encode_datatype(MPI_CURRENT_TYPE2)));
+
+  Colls::scatterv(send, sendcounts, disps, MPI_CURRENT_TYPE, recv, recv_size, MPI_CURRENT_TYPE2, root, MPI_COMM_WORLD);
+
+  TRACE_smpi_comm_out(smpi_process()->index());
+  log_timed_action(action, clock);
+}
+
 static void action_reducescatter(const char *const *action) {
  /* The structure of the reducescatter action for the rank 0 (total 4 processes) is the following:
       0 reduceScatter 275427 275427 275427 204020 11346849 0
@@ -705,6 +741,7 @@ static void action_reducescatter(const char *const *action) {
   int recvcounts[comm_size];
   int rank = smpi_process()->index();
   int size = 0;
+  std::vector<int>* trace_recvcounts = new std::vector<int>;
   if(action[3+comm_size])
     MPI_CURRENT_TYPE=decode_datatype(action[3+comm_size]);
   else
@@ -712,20 +749,14 @@ static void action_reducescatter(const char *const *action) {
 
   for(int i=0;i<comm_size;i++) {
     recvcounts[i] = atoi(action[i+2]);
+    trace_recvcounts->push_back(recvcounts[i]);
     size+=recvcounts[i];
   }
 
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type = TRACING_REDUCE_SCATTER;
-  extra->send_size = 0;
-  extra->recvcounts      = new int[comm_size];
-  for(int i=0; i< comm_size; i++)//copy data to avoid bad free
-    extra->recvcounts[i] = recvcounts[i];
-  extra->datatype1       = encode_datatype(MPI_CURRENT_TYPE);
-  extra->comp_size = comp_size;
-  extra->num_processes = comm_size;
-
-  TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+  TRACE_smpi_comm_in(rank, __FUNCTION__,
+                     new simgrid::instr::VarCollTIData("reduceScatter", -1, 0, nullptr, -1, trace_recvcounts,
+                                                       std::to_string(comp_size), /* ugly hack to print comp_size */
+                                                       encode_datatype(MPI_CURRENT_TYPE)));
 
   void *sendbuf = smpi_get_tmp_sendbuffer(size* MPI_CURRENT_TYPE->size());
   void *recvbuf = smpi_get_tmp_recvbuffer(size* MPI_CURRENT_TYPE->size());
@@ -763,15 +794,10 @@ static void action_allgather(const char *const *action) {
   void *recvbuf = smpi_get_tmp_recvbuffer(recvcount* MPI_CURRENT_TYPE2->size());
 
   int rank = smpi_process()->index();
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type = TRACING_ALLGATHER;
-  extra->send_size = sendcount;
-  extra->recv_size= recvcount;
-  extra->datatype1       = encode_datatype(MPI_CURRENT_TYPE);
-  extra->datatype2       = encode_datatype(MPI_CURRENT_TYPE2);
-  extra->num_processes = MPI_COMM_WORLD->size();
 
-  TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+  TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::CollTIData("allGather", -1, -1.0, sendcount, recvcount,
+                                                                        encode_datatype(MPI_CURRENT_TYPE),
+                                                                        encode_datatype(MPI_CURRENT_TYPE2)));
 
   Colls::allgather(sendbuf, sendcount, MPI_CURRENT_TYPE, recvbuf, recvcount, MPI_CURRENT_TYPE2, MPI_COMM_WORLD);
 
@@ -813,17 +839,14 @@ static void action_allgatherv(const char *const *action) {
   void *recvbuf = smpi_get_tmp_recvbuffer(recv_sum* MPI_CURRENT_TYPE2->size());
 
   int rank = smpi_process()->index();
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type = TRACING_ALLGATHERV;
-  extra->send_size = sendcount;
-  extra->recvcounts      = new int[comm_size];
-  for(int i=0; i< comm_size; i++)//copy data to avoid bad free
-    extra->recvcounts[i] = recvcounts[i];
-  extra->datatype1       = encode_datatype(MPI_CURRENT_TYPE);
-  extra->datatype2       = encode_datatype(MPI_CURRENT_TYPE2);
-  extra->num_processes = comm_size;
-
-  TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+
+  std::vector<int>* trace_recvcounts = new std::vector<int>;
+  for (int i = 0; i < comm_size; i++) // copy data to avoid bad free
+    trace_recvcounts->push_back(recvcounts[i]);
+
+  TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::VarCollTIData(
+                                             "allGatherV", -1, sendcount, nullptr, -1, trace_recvcounts,
+                                             encode_datatype(MPI_CURRENT_TYPE), encode_datatype(MPI_CURRENT_TYPE2)));
 
   Colls::allgatherv(sendbuf, sendcount, MPI_CURRENT_TYPE, recvbuf, recvcounts, disps, MPI_CURRENT_TYPE2,
                           MPI_COMM_WORLD);
@@ -845,8 +868,12 @@ static void action_allToAllv(const char *const *action) {
 
   int comm_size = MPI_COMM_WORLD->size();
   CHECK_ACTION_PARAMS(action, 2*comm_size+2, 2)
+  int send_size = 0;
+  int recv_size = 0;
   int sendcounts[comm_size];
+  std::vector<int>* trace_sendcounts = new std::vector<int>;
   int recvcounts[comm_size];
+  std::vector<int>* trace_recvcounts = new std::vector<int>;
   int senddisps[comm_size];
   int recvdisps[comm_size];
 
@@ -861,33 +888,24 @@ static void action_allToAllv(const char *const *action) {
   else
     MPI_CURRENT_TYPE=MPI_DEFAULT_TYPE;
 
+  int rank       = smpi_process()->index();
   void *sendbuf = smpi_get_tmp_sendbuffer(send_buf_size* MPI_CURRENT_TYPE->size());
   void *recvbuf  = smpi_get_tmp_recvbuffer(recv_buf_size* MPI_CURRENT_TYPE2->size());
 
   for(int i=0;i<comm_size;i++) {
     sendcounts[i] = atoi(action[i+3]);
+    trace_sendcounts->push_back(sendcounts[i]);
+    send_size += sendcounts[i];
     recvcounts[i] = atoi(action[i+4+comm_size]);
+    trace_recvcounts->push_back(recvcounts[i]);
+    recv_size += recvcounts[i];
     senddisps[i] = 0;
     recvdisps[i] = 0;
   }
 
-  int rank = smpi_process()->index();
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type = TRACING_ALLTOALLV;
-  extra->recvcounts      = new int[comm_size];
-  extra->sendcounts      = new int[comm_size];
-  extra->num_processes = comm_size;
-
-  for(int i=0; i< comm_size; i++){//copy data to avoid bad free
-    extra->send_size += sendcounts[i];
-    extra->sendcounts[i] = sendcounts[i];
-    extra->recv_size += recvcounts[i];
-    extra->recvcounts[i] = recvcounts[i];
-  }
-  extra->datatype1 = encode_datatype(MPI_CURRENT_TYPE);
-  extra->datatype2 = encode_datatype(MPI_CURRENT_TYPE2);
-
-  TRACE_smpi_comm_in(rank, __FUNCTION__, extra);
+  TRACE_smpi_comm_in(rank, __FUNCTION__, new simgrid::instr::VarCollTIData(
+                                             "allToAllV", -1, send_size, trace_sendcounts, recv_size, trace_recvcounts,
+                                             encode_datatype(MPI_CURRENT_TYPE), encode_datatype(MPI_CURRENT_TYPE2)));
 
   Colls::alltoallv(sendbuf, sendcounts, senddisps, MPI_CURRENT_TYPE,recvbuf, recvcounts, recvdisps,
                          MPI_CURRENT_TYPE, MPI_COMM_WORLD);
@@ -908,9 +926,7 @@ void smpi_replay_init(int* argc, char*** argv)
   int rank = smpi_process()->index();
   TRACE_smpi_init(rank);
   TRACE_smpi_computing_init(rank);
-  instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1);
-  extra->type = TRACING_INIT;
-  TRACE_smpi_comm_in(rank, "smpi_replay_run_init", extra);
+  TRACE_smpi_comm_in(rank, "smpi_replay_run_init", new simgrid::instr::NoOpTIData("init"));
   TRACE_smpi_comm_out(rank);
   xbt_replay_action_register("init",       simgrid::smpi::action_init);
   xbt_replay_action_register("finalize",   simgrid::smpi::action_finalize);
@@ -931,7 +947,9 @@ void smpi_replay_init(int* argc, char*** argv)
   xbt_replay_action_register("allToAll",   simgrid::smpi::action_allToAll);
   xbt_replay_action_register("allToAllV",  simgrid::smpi::action_allToAllv);
   xbt_replay_action_register("gather",     simgrid::smpi::action_gather);
+  xbt_replay_action_register("scatter", simgrid::smpi::action_scatter);
   xbt_replay_action_register("gatherV",    simgrid::smpi::action_gatherv);
+  xbt_replay_action_register("scatterV", simgrid::smpi::action_scatterv);
   xbt_replay_action_register("allGather",  simgrid::smpi::action_allgather);
   xbt_replay_action_register("allGatherV", simgrid::smpi::action_allgatherv);
   xbt_replay_action_register("reduceScatter",  simgrid::smpi::action_reducescatter);
@@ -979,9 +997,7 @@ void smpi_replay_main(int* argc, char*** argv)
     xbt_free(recvbuffer);
   }
 
-  instr_extra_data extra_fin = xbt_new0(s_instr_extra_data_t,1);
-  extra_fin->type = TRACING_FINALIZE;
-  TRACE_smpi_comm_in(smpi_process()->index(), "smpi_replay_run_finalize", extra_fin);
+  TRACE_smpi_comm_in(smpi_process()->index(), "smpi_replay_run_finalize", new simgrid::instr::NoOpTIData("finalize"));
 
   smpi_process()->finalize();