Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Actor: make the refcount observable, and improve debug messages
[simgrid.git] / src / smpi / colls / smpi_coll.cpp
index ffb2dd4..f8c1d75 100644 (file)
@@ -17,12 +17,12 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_coll, smpi, "Logging specific to SMPI (coll
 
 #define COLL_SETTER(cat, ret, args, args2)                                                                             \
   int(*Colls::cat) args;                                                                                               \
-  void Colls::set_##cat(const std::string& name)                                                                       \
+  void Colls::_XBT_CONCAT(set_, cat)(const std::string& name)                                                          \
   {                                                                                                                    \
-    int id = find_coll_description(mpi_coll_##cat##_description, name, #cat);                                          \
-    cat    = reinterpret_cast<ret(*) args>(mpi_coll_##cat##_description[id].coll);                                     \
+    int id = find_coll_description(_XBT_CONCAT3(mpi_coll_, cat, _description), name, _XBT_STRINGIFY(cat));             \
+    cat    = reinterpret_cast<ret(*) args>(_XBT_CONCAT3(mpi_coll_, cat, _description)[id].coll);                       \
     if (cat == nullptr)                                                                                                \
-      xbt_die("Collective " #cat " set to nullptr!");                                                                  \
+      xbt_die("Collective " _XBT_STRINGIFY(cat) " set to nullptr!");                                                   \
   }
 
 namespace simgrid{
@@ -150,8 +150,8 @@ int Colls::scan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype data
   Datatype::copy(sendbuf, count, datatype, recvbuf, count, datatype);
 
   // Send/Recv buffers to/from others
-  MPI_Request *requests = xbt_new(MPI_Request, size - 1);
-  void **tmpbufs = xbt_new(void *, rank);
+  MPI_Request* requests = new MPI_Request[size - 1];
+  unsigned char** tmpbufs = new unsigned char*[rank];
   int index = 0;
   for (int other = 0; other < rank; other++) {
     tmpbufs[index] = smpi_get_tmp_sendbuffer(count * dataext);
@@ -191,8 +191,8 @@ int Colls::scan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype data
   for(index = 0; index < size-1; index++) {
     Request::unref(&requests[index]);
   }
-  xbt_free(tmpbufs);
-  xbt_free(requests);
+  delete[] tmpbufs;
+  delete[] requests;
   return MPI_SUCCESS;
 }
 
@@ -208,8 +208,8 @@ int Colls::exscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype da
   datatype->extent(&lb, &dataext);
 
   // Send/Recv buffers to/from others
-  MPI_Request *requests = xbt_new(MPI_Request, size - 1);
-  void **tmpbufs = xbt_new(void *, rank);
+  MPI_Request* requests = new MPI_Request[size - 1];
+  unsigned char** tmpbufs = new unsigned char*[rank];
   int index = 0;
   for (int other = 0; other < rank; other++) {
     tmpbufs[index] = smpi_get_tmp_sendbuffer(count * dataext);
@@ -258,8 +258,8 @@ int Colls::exscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype da
   for(index = 0; index < size-1; index++) {
     Request::unref(&requests[index]);
   }
-  xbt_free(tmpbufs);
-  xbt_free(requests);
+  delete[] tmpbufs;
+  delete[] requests;
   return MPI_SUCCESS;
 }