Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 3 Nov 2017 19:30:58 +0000 (20:30 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 3 Nov 2017 19:30:58 +0000 (20:30 +0100)
src/instr/instr_paje_events.cpp
src/instr/instr_paje_events.hpp
src/instr/instr_paje_types.cpp
src/smpi/include/smpi_datatype.hpp
src/smpi/include/smpi_datatype_derived.hpp
src/smpi/mpi/smpi_datatype.cpp
src/smpi/mpi/smpi_datatype_derived.cpp

index 067fb8b..d04a1f9 100644 (file)
@@ -22,15 +22,19 @@ NewEvent::NewEvent(double timestamp, container_t container, Type* type, EntityVa
   insertIntoBuffer();
 }
 
-LinkEvent::LinkEvent(double timestamp, container_t container, Type* type, e_event_type event_type, container_t endpoint,
+LinkEvent::LinkEvent(container_t container, Type* type, e_event_type event_type, container_t endpoint,
                      std::string value, std::string key)
-    : LinkEvent(timestamp, container, type, event_type, endpoint, value, key, -1)
+    : LinkEvent(container, type, event_type, endpoint, value, key, -1)
 {
 }
 
-LinkEvent::LinkEvent(double timestamp, container_t container, Type* type, e_event_type event_type, container_t endpoint,
+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, timestamp, event_type), endpoint_(endpoint), value_(value), key_(key), size_(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", __FUNCTION__, eventType_, timestamp_, value_.c_str());
   insertIntoBuffer();
@@ -43,14 +47,13 @@ VariableEvent::VariableEvent(double timestamp, Container* container, Type* type,
   insertIntoBuffer();
 }
 
-StateEvent::StateEvent(double timestamp, Container* container, Type* type, e_event_type event_type, EntityValue* value)
-    : StateEvent(timestamp, container, type, event_type, value, nullptr)
+StateEvent::StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value)
+    : StateEvent(container, type, event_type, value, nullptr)
 {
 }
 
-StateEvent::StateEvent(double timestamp, Container* container, Type* type, e_event_type event_type, EntityValue* value,
-                       void* extra)
-    : PajeEvent::PajeEvent(container, type, timestamp, event_type), value(value), extra_(extra)
+StateEvent::StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value, void* extra)
+    : PajeEvent::PajeEvent(container, type, SIMIX_get_clock(), event_type), value(value), extra_(extra)
 {
 #if HAVE_SMPI
   if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
index 6f0b3bb..3c2fc02 100644 (file)
@@ -66,9 +66,8 @@ class StateEvent : public PajeEvent {
   void* extra_ = nullptr;
 
 public:
-  StateEvent(double timestamp, Container* container, Type* type, e_event_type event_type, EntityValue* value);
-  StateEvent(double timestamp, 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);
+  StateEvent(Container* container, Type* type, e_event_type event_type, EntityValue* value, void* extra);
   void print() override;
 };
 
@@ -79,10 +78,10 @@ class LinkEvent : public PajeEvent {
   int size_ = -1;
 
 public:
-  LinkEvent(double timestamp, Container* container, Type* type, e_event_type event_type, Container* sourceContainer,
-            std::string value, std::string key);
-  LinkEvent(double timestamp, Container* container, Type* type, e_event_type event_type, Container* sourceContainer,
-            std::string value, std::string key, int size);
+  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);
   void print() override;
 };
 
@@ -95,5 +94,4 @@ public:
 };
 }
 }
-
 #endif
index 7261a6a..314bc86 100644 (file)
@@ -62,23 +62,22 @@ StateType::~StateType()
 
 void StateType::setEvent(std::string value_name)
 {
-  events_.push_back(new StateEvent(SIMIX_get_clock(), issuer_, this, PAJE_SetState, getEntityValue(value_name)));
+  events_.push_back(new StateEvent(issuer_, this, PAJE_SetState, getEntityValue(value_name)));
 }
 
 void StateType::pushEvent(std::string value_name, void* extra)
 {
-  events_.push_back(
-      new StateEvent(SIMIX_get_clock(), issuer_, this, PAJE_PushState, getEntityValue(value_name), extra));
+  events_.push_back(new StateEvent(issuer_, this, PAJE_PushState, getEntityValue(value_name), extra));
 }
 
 void StateType::pushEvent(std::string value_name)
 {
-  events_.push_back(new StateEvent(SIMIX_get_clock(), issuer_, this, PAJE_PushState, getEntityValue(value_name)));
+  events_.push_back(new StateEvent(issuer_, this, PAJE_PushState, getEntityValue(value_name)));
 }
 
 void StateType::popEvent()
 {
-  events_.push_back(new StateEvent(SIMIX_get_clock(), issuer_, this, PAJE_PopState, nullptr));
+  events_.push_back(new StateEvent(issuer_, this, PAJE_PopState, nullptr));
 }
 
 VariableType::VariableType(std::string name, std::string color, Type* father) : Type(name, name, color, father)
@@ -117,12 +116,12 @@ void LinkType::startEvent(container_t startContainer, std::string value, std::st
 
 void LinkType::startEvent(container_t startContainer, std::string value, std::string key, int size)
 {
-  new LinkEvent(SIMIX_get_clock(), issuer_, this, PAJE_StartLink, startContainer, value, key, size);
+  new LinkEvent(issuer_, this, PAJE_StartLink, startContainer, value, key, size);
 }
 
 void LinkType::endEvent(container_t endContainer, std::string value, std::string key)
 {
-  new LinkEvent(SIMIX_get_clock(), issuer_, this, PAJE_EndLink, endContainer, value, key);
+  new LinkEvent(issuer_, this, PAJE_EndLink, endContainer, value, key);
 }
 
 void Type::logDefinition(e_event_type event_type)
index 2fc90cf..97beb46 100644 (file)
@@ -75,59 +75,58 @@ namespace simgrid{
 namespace smpi{
 
 class Datatype : public F2C, public Keyval{
-  private:
-    char* name_;
-    size_t size_;
-    MPI_Aint lb_;
-    MPI_Aint ub_;
-    int flags_;
-    int refcount_;
-
-  public:
-    static std::unordered_map<int, smpi_key_elem> keyvals_;
-    static int keyval_id_;
-
-    Datatype(int size,MPI_Aint lb, MPI_Aint ub, int flags);
-    Datatype(char* name, int size,MPI_Aint lb, MPI_Aint ub, int flags);
-    Datatype(Datatype *datatype, int* ret);
-    virtual ~Datatype();
-
-    char* name();
-    size_t size();
-    MPI_Aint lb();
-    MPI_Aint ub();
-    int flags();
-    int refcount();
-
-    void ref();
-    static void unref(MPI_Datatype datatype);
-    void commit();
-    bool is_valid();
-    void addflag(int flag);
-    int extent(MPI_Aint * lb, MPI_Aint * extent);
-    MPI_Aint get_extent();
-    void get_name(char* name, int* length);
-    void set_name(char* name);
-    static int copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
-                    void *recvbuf, int recvcount, MPI_Datatype recvtype);
-    virtual void serialize( void* noncontiguous, void *contiguous,
-                            int count);
-    virtual void unserialize( void* contiguous, void *noncontiguous,
-                              int count, MPI_Op op);
-    static int keyval_create(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval, void* extra_state);
-    static int keyval_free(int* keyval);
-    int pack(void* inbuf, int incount, void* outbuf, int outcount, int* position, MPI_Comm comm);
-    int unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Comm comm);
-
-
-    static int create_contiguous(int count, MPI_Datatype old_type, MPI_Aint lb, MPI_Datatype* new_type);
-    static int create_vector(int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* new_type);
-    static int create_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* new_type);
-    static int create_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type);
-    static int create_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* new_type);
-    static int create_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* new_type);
-
-    static Datatype* f2c(int id);
+  char* name_;
+  size_t size_;
+  MPI_Aint lb_;
+  MPI_Aint ub_;
+  int flags_;
+  int refcount_;
+
+public:
+  static std::unordered_map<int, smpi_key_elem> keyvals_;
+  static int keyval_id_;
+
+  Datatype(int size, MPI_Aint lb, MPI_Aint ub, int flags);
+  Datatype(char* name, int size, MPI_Aint lb, MPI_Aint ub, int flags);
+  Datatype(Datatype* datatype, int* ret);
+  virtual ~Datatype();
+
+  char* name();
+  size_t size();
+  MPI_Aint lb();
+  MPI_Aint ub();
+  int flags();
+  int refcount();
+
+  void ref();
+  static void unref(MPI_Datatype datatype);
+  void commit();
+  bool is_valid();
+  void addflag(int flag);
+  int extent(MPI_Aint* lb, MPI_Aint* extent);
+  MPI_Aint get_extent();
+  void get_name(char* name, int* length);
+  void set_name(char* name);
+  static int copy(void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
+                  MPI_Datatype recvtype);
+  virtual void serialize(void* noncontiguous, void* contiguous, int count);
+  virtual void unserialize(void* contiguous, void* noncontiguous, int count, MPI_Op op);
+  static int keyval_create(MPI_Type_copy_attr_function* copy_fn, MPI_Type_delete_attr_function* delete_fn, int* keyval,
+                           void* extra_state);
+  static int keyval_free(int* keyval);
+  int pack(void* inbuf, int incount, void* outbuf, int outcount, int* position, MPI_Comm comm);
+  int unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Comm comm);
+
+  static int create_contiguous(int count, MPI_Datatype old_type, MPI_Aint lb, MPI_Datatype* new_type);
+  static int create_vector(int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* new_type);
+  static int create_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* new_type);
+  static int create_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* new_type);
+  static int create_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type,
+                             MPI_Datatype* new_type);
+  static int create_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types,
+                           MPI_Datatype* new_type);
+
+  static Datatype* f2c(int id);
 };
 
 }
index b450bd9..5c46639 100644 (file)
@@ -13,91 +13,84 @@ namespace simgrid{
 namespace smpi{
 
 class Type_Contiguous: public Datatype {
-  private:
-    int block_count_;
-    MPI_Datatype old_type_;
-  public:
-    Type_Contiguous(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, MPI_Datatype old_type);
-    ~Type_Contiguous();
-    void serialize( void* noncontiguous, void *contiguous,
-                            int count);
-    void unserialize( void* contiguous_vector, void *noncontiguous_vector,
-                              int count, MPI_Op op);
+  int block_count_;
+  MPI_Datatype old_type_;
+
+public:
+  Type_Contiguous(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, MPI_Datatype old_type);
+  ~Type_Contiguous();
+  void serialize(void* noncontiguous, void* contiguous, int count);
+  void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
 };
 
 class Type_Vector: public Datatype{
-  private:
-    int block_count_;
-    int block_length_;
-    int block_stride_;
-    MPI_Datatype old_type_;
-  public:
-    Type_Vector(int size,MPI_Aint lb, MPI_Aint ub, int flags, int count, int blocklen, int stride, MPI_Datatype old_type);
-    ~Type_Vector();
-    void serialize( void* noncontiguous, void *contiguous,
-                            int count);
-    void unserialize( void* contiguous_vector, void *noncontiguous_vector,
-                              int count, MPI_Op op);
+  int block_count_;
+  int block_length_;
+  int block_stride_;
+  MPI_Datatype old_type_;
+
+public:
+  Type_Vector(int size, MPI_Aint lb, MPI_Aint ub, int flags, int count, int blocklen, int stride,
+              MPI_Datatype old_type);
+  ~Type_Vector();
+  void serialize(void* noncontiguous, void* contiguous, int count);
+  void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
 };
 
 class Type_Hvector: public Datatype{
-  private:
-    int block_count_;
-    int block_length_;
-    MPI_Aint block_stride_;
-    MPI_Datatype old_type_;
-  public:
-    Type_Hvector(int size,MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int block_length, MPI_Aint block_stride, MPI_Datatype old_type);
-    ~Type_Hvector();
-    void serialize( void* noncontiguous, void *contiguous,
-                            int count);
-    void unserialize( void* contiguous_vector, void *noncontiguous_vector,
-                              int count, MPI_Op op);
+  int block_count_;
+  int block_length_;
+  MPI_Aint block_stride_;
+  MPI_Datatype old_type_;
+
+public:
+  Type_Hvector(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int block_length, MPI_Aint block_stride,
+               MPI_Datatype old_type);
+  ~Type_Hvector();
+  void serialize(void* noncontiguous, void* contiguous, int count);
+  void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
 };
 
 class Type_Indexed: public Datatype{
-  private:
-    int block_count_;
-    int* block_lengths_;
-    int* block_indices_;
-    MPI_Datatype old_type_;
-  public:
-    Type_Indexed(int size,MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, int* block_indices, MPI_Datatype old_type);
-    ~Type_Indexed();
-    void serialize( void* noncontiguous, void *contiguous,
-                            int count);
-    void unserialize( void* contiguous_vector, void *noncontiguous_vector,
-                              int count, MPI_Op op);
+  int block_count_;
+  int* block_lengths_;
+  int* block_indices_;
+  MPI_Datatype old_type_;
+
+public:
+  Type_Indexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, int* block_indices,
+               MPI_Datatype old_type);
+  ~Type_Indexed();
+  void serialize(void* noncontiguous, void* contiguous, int count);
+  void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
 };
 
 class Type_Hindexed: public Datatype{
-  private:
-    int block_count_;
-    int* block_lengths_;
-    MPI_Aint* block_indices_;
-    MPI_Datatype old_type_;
-  public:
-    Type_Hindexed(int size,MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, MPI_Aint* block_indices, MPI_Datatype old_type);
-    ~Type_Hindexed();
-    void serialize( void* noncontiguous, void *contiguous,
-                            int count);
-    void unserialize( void* contiguous_vector, void *noncontiguous_vector,
-                              int count, MPI_Op op);
+  int block_count_;
+  int* block_lengths_;
+  MPI_Aint* block_indices_;
+  MPI_Datatype old_type_;
+
+public:
+  Type_Hindexed(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths,
+                MPI_Aint* block_indices, MPI_Datatype old_type);
+  ~Type_Hindexed();
+  void serialize(void* noncontiguous, void* contiguous, int count);
+  void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
 };
 
 class Type_Struct: public Datatype{
-  private:
-    int block_count_;
-    int* block_lengths_;
-    MPI_Aint* block_indices_;
-    MPI_Datatype* old_types_;
-  public:
-    Type_Struct(int size,MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths, MPI_Aint* block_indices, MPI_Datatype* old_types);
-    ~Type_Struct();
-    void serialize( void* noncontiguous, void *contiguous,
-                            int count);
-    void unserialize( void* contiguous_vector, void *noncontiguous_vector,
-                              int count, MPI_Op op);
+  int block_count_;
+  int* block_lengths_;
+  MPI_Aint* block_indices_;
+  MPI_Datatype* old_types_;
+
+public:
+  Type_Struct(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, int* block_lengths,
+              MPI_Aint* block_indices, MPI_Datatype* old_types);
+  ~Type_Struct();
+  void serialize(void* noncontiguous, void* contiguous, int count);
+  void unserialize(void* contiguous_vector, void* noncontiguous_vector, int count, MPI_Op op);
 };
 
 
index e23986d..b738b7b 100644 (file)
@@ -189,7 +189,6 @@ void Datatype::commit()
   flags_ |= DT_FLAG_COMMITED;
 }
 
-
 bool Datatype::is_valid(){
   return (flags_ & DT_FLAG_COMMITED);
 }
index 3be87a2..2624ca3 100644 (file)
@@ -8,29 +8,29 @@
 #include "smpi_op.hpp"
 #include <xbt/log.h>
 
-XBT_LOG_EXTERNAL_CATEGORY(smpi_datatype);
-
 namespace simgrid{
 namespace smpi{
 
-
-Type_Contiguous::Type_Contiguous(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, MPI_Datatype old_type): Datatype(size, lb, ub, flags), block_count_(block_count), old_type_(old_type){
+Type_Contiguous::Type_Contiguous(int size, MPI_Aint lb, MPI_Aint ub, int flags, int block_count, MPI_Datatype old_type)
+    : Datatype(size, lb, ub, flags), block_count_(block_count), old_type_(old_type)
+{
   old_type_->ref();
 }
 
-Type_Contiguous::~Type_Contiguous(){
+Type_Contiguous::~Type_Contiguous()
+{
   Datatype::unref(old_type_);
 }
 
-
-void Type_Contiguous::serialize( void* noncontiguous_buf, void *contiguous_buf,
-                            int count){
+void Type_Contiguous::serialize(void* noncontiguous_buf, void* contiguous_buf, int count)
+{
   char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
   char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+lb();
   memcpy(contiguous_buf_char, noncontiguous_buf_char, count * block_count_ * old_type_->size());
 }
-void Type_Contiguous::unserialize( void* contiguous_buf, void *noncontiguous_buf,
-                              int count, MPI_Op op){
+
+void Type_Contiguous::unserialize(void* contiguous_buf, void* noncontiguous_buf, int count, MPI_Op op)
+{
   char* contiguous_buf_char = static_cast<char*>(contiguous_buf);
   char* noncontiguous_buf_char = static_cast<char*>(noncontiguous_buf)+lb();
   int n= count*block_count_;