Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SMPI. RMA: get rid of the s4u barrier, use an MPI one instead.
authorAugustin Degomme <adegomme@users.noreply.github.com>
Thu, 3 Mar 2022 16:27:31 +0000 (17:27 +0100)
committerAugustin Degomme <adegomme@users.noreply.github.com>
Thu, 3 Mar 2022 16:27:31 +0000 (17:27 +0100)
src/smpi/include/smpi_win.hpp
src/smpi/mpi/smpi_win.cpp

index f020e86..5e18418 100644 (file)
@@ -28,7 +28,6 @@ class Win : public F2C, public Keyval {
   MPI_Comm comm_;
   std::vector<MPI_Request> requests_;
   s4u::MutexPtr mut_ = s4u::Mutex::create();
-  s4u::Barrier* bar_ = nullptr;
   std::vector<MPI_Win> connected_wins_;
   std::string name_;
   int opened_               = 0;
index 57026f0..765d92f 100644 (file)
@@ -53,9 +53,6 @@ Win::Win(void* base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm,
   if(info!=MPI_INFO_NULL)
     info->ref();
   connected_wins_[rank_] = this;
-  if(rank_==0){
-    bar_ = new s4u::Barrier(comm->size());
-  }
   errhandler_->ref();
   comm->add_rma_win(this);
   comm->ref();
@@ -63,16 +60,13 @@ Win::Win(void* base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm,
   colls::allgather(&connected_wins_[rank_], sizeof(MPI_Win), MPI_BYTE, connected_wins_.data(), sizeof(MPI_Win),
                    MPI_BYTE, comm);
 
-  colls::bcast(&bar_, sizeof(s4u::Barrier*), MPI_BYTE, 0, comm);
-
   colls::barrier(comm);
   this->add_f();
 }
 
 Win::~Win(){
   //As per the standard, perform a barrier to ensure every async comm is finished
-  bar_->wait();
-
+  colls::barrier(comm_);
   flush_local_all();
 
   if (info_ != MPI_INFO_NULL)
@@ -85,9 +79,6 @@ Win::~Win(){
   colls::barrier(comm_);
   Comm::unref(comm_);
 
-  if (rank_ == 0)
-    delete bar_;
-
   if (allocated_)
     xbt_free(base_);
 
@@ -182,7 +173,7 @@ int Win::fence(int assert)
   opened_++;
   if (not (assert & MPI_MODE_NOPRECEDE)) {
     // This is not the first fence => finalize what came before
-    bar_->wait();
+    colls::barrier(comm_);
     flush_local_all();
     count_=0;
   }
@@ -190,8 +181,7 @@ int Win::fence(int assert)
   if (assert & MPI_MODE_NOSUCCEED) // there should be no ops after this one, tell we are closed.
     opened_=0;
   assert_ = assert;
-
-  bar_->wait();
+  colls::barrier(comm_);
   XBT_DEBUG("Leaving fence");
 
   return MPI_SUCCESS;