Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add a name() to all F2C objects.
authorAugustin Degomme <adegomme@users.noreply.github.com>
Tue, 6 Apr 2021 15:39:50 +0000 (17:39 +0200)
committerAugustin Degomme <adegomme@users.noreply.github.com>
Tue, 6 Apr 2021 18:07:17 +0000 (20:07 +0200)
This avoids demangling need for leak check (and should fix tests, as freebsd has a broken demangler on our ci system).

13 files changed:
src/smpi/include/smpi_comm.hpp
src/smpi/include/smpi_datatype.hpp
src/smpi/include/smpi_errhandler.hpp
src/smpi/include/smpi_f2c.hpp
src/smpi/include/smpi_file.hpp
src/smpi/include/smpi_group.hpp
src/smpi/include/smpi_info.hpp
src/smpi/include/smpi_op.hpp
src/smpi/include/smpi_request.hpp
src/smpi/include/smpi_win.hpp
src/smpi/internals/smpi_utils.cpp
src/smpi/mpi/smpi_comm.cpp
src/smpi/mpi/smpi_op.cpp

index cee159a..0ca688d 100644 (file)
@@ -54,6 +54,7 @@ public:
   int rank() const;
   int id() const;
   void get_name(char* name, int* len) const;
+  std::string name() const;
   void set_name(const char* name);
   MPI_Info info();
   void set_info( MPI_Info info);
index 294e617..06a106b 100644 (file)
@@ -127,8 +127,7 @@ public:
   Datatype(const Datatype&) = delete;
   Datatype& operator=(const Datatype&) = delete;
   ~Datatype() override;
-
-  const char* name() const { return name_.c_str(); }
+  std::string name() const {return name_;}
   size_t size() const { return size_; }
   MPI_Aint lb() const { return lb_; }
   MPI_Aint ub() const { return ub_; }
index 54f5f65..fb85659 100644 (file)
@@ -25,6 +25,7 @@ class Errhandler: public F2C {
   explicit Errhandler(MPI_File_errhandler_fn *function):file_func_(function){};
   explicit Errhandler(MPI_Win_errhandler_fn *function):win_func_(function){};
   void ref();
+  std::string name() const {return "MPI_Errhandler";}
   void call(MPI_Comm comm, int errorcode) const;
   void call(MPI_Win win, int errorcode) const;
   void call(MPI_File file, int errorcode) const;
index fa915c4..4c6ca1b 100644 (file)
@@ -36,13 +36,14 @@ protected:
   int f2c_id() { return my_f2c_id_; }
   static int global_f2c_id() { return f2c_id_; }
   static void f2c_id_increment() { f2c_id_++; }
-  void mark_as_deleted() { deleted_ = true; };
 
 public:
+  void mark_as_deleted() { deleted_ = true; };
   bool deleted() const { return deleted_; }
   static f2c_lookup_type* lookup() { return f2c_lookup_.get(); }
   F2C();
   virtual ~F2C() = default;
+  virtual std::string name() const = 0;
 
   int add_f();
   static void free_f(int id) { if(id!=-1) f2c_lookup_->erase(id); }
index 1d73605..dc95b2c 100644 (file)
@@ -42,6 +42,8 @@ class File : public F2C{
   int get_position_shared(MPI_Offset* offset) const;
   int flags() const;
   MPI_Comm comm() const;
+  std::string name() const {return file_ ? std::string("MPI_File:" + file_->get_path()): std::string("MPI_File");}
+
   int sync();
   int seek(MPI_Offset offset, int whence);
   int seek_shared(MPI_Offset offset, int whence);
index 83a531f..c3ef761 100644 (file)
@@ -34,6 +34,7 @@ public:
   void set_mapping(s4u::Actor* actor, int rank);
   int rank(int index);
   s4u::Actor* actor(int rank);
+  std::string name() const {return std::string("MPI_Group");}
   int rank(s4u::Actor* process);
   void ref();
   static void unref(MPI_Group group);
index df50447..4650a83 100644 (file)
@@ -26,6 +26,7 @@ public:
   static void unref(MPI_Info info);
   void set(const char* key, const char* value) { map_[key] = value; }
   int get(const char* key, int valuelen, char* value, int* flag) const;
+  std::string name() const {return std::string("MPI_Info");}
   int remove(const char* key);
   int get_nkeys(int* nkeys) const;
   int get_nthkey(int n, char* key) const;
index bfb1e7d..58980e8 100644 (file)
@@ -26,6 +26,7 @@ public:
   bool is_predefined() const { return is_predefined_; }
   bool is_fortran_op() const { return is_fortran_op_; }
   int allowed_types() const { return types_; }
+  std::string name() const {return std::string("MPI_Op");}
   // tell that we were created from fortran, so we need to translate the type to fortran when called
   void set_fortran_op() { is_fortran_op_ = true; }
   void apply(const void* invec, void* inoutvec, const int* len, MPI_Datatype datatype) const;
index 226094d..9f2f864 100644 (file)
@@ -64,6 +64,7 @@ public:
   int tag() const { return tag_; }
   int flags() const { return flags_; }
   bool detached() const { return detached_; }
+  std::string name() const {return std::string("MPI_Request");}
   MPI_Datatype type() const { return old_type_; }
   void print_request(const char* message) const;
   void start();
index 5022f6e..e638736 100644 (file)
@@ -54,6 +54,7 @@ public:
   int attach (void *base, MPI_Aint size);
   int detach (const void *base);
   void get_name(char* name, int* length) const;
+  std::string name() const {return name_;}
   void get_group( MPI_Group* group);
   void set_name(const char* name);
   int rank() const;
index 062ff2d..791bf56 100644 (file)
@@ -156,7 +156,7 @@ void print_memory_analysis()
         if (xbt_log_no_loc) {
           XBT_WARN("Leaked handle of type %s", boost::core::demangle(typeid(*p.second).name()).c_str());
         } else {
-          XBT_WARN("Leaked handle of type %s at %p", boost::core::demangle(typeid(*p.second).name()).c_str(), p.second);
+          XBT_WARN("Leaked handle of type %s at %p", p.second->name().c_str(), p.second);
         }
       }
       if (truncate)
index 117d76f..ce496d2 100644 (file)
@@ -178,6 +178,15 @@ void Comm::get_name(char* name, int* len) const
   }
 }
 
+std::string Comm::name() const
+{
+  int size;
+  char name[MPI_MAX_NAME_STRING];
+  this->get_name(name, &size);
+  return std::string(name);
+}
+
+
 void Comm::set_name (const char* name)
 {
   if (this == MPI_COMM_UNINITIALIZED){
index 9b2bf1b..5ec47aa 100644 (file)
@@ -116,7 +116,7 @@ APPLY_OP_LOOP(MPI_COMPLEX32, double_double,op)
 
 #define APPLY_END_OP_LOOP(op)                                                                                          \
   {                                                                                                                    \
-    xbt_die("Failed to apply " _XBT_STRINGIFY(op) " to type %s", (*datatype)->name());                                 \
+    xbt_die("Failed to apply " _XBT_STRINGIFY(op) " to type %s", (*datatype)->name().c_str());                         \
   }
 
 static void max_func(void *a, void *b, int *length, MPI_Datatype * datatype)