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;
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();
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)
colls::barrier(comm_);
Comm::unref(comm_);
- if (rank_ == 0)
- delete bar_;
-
if (allocated_)
xbt_free(base_);
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;
}
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;