int PMPI_Win_free( MPI_Win* win){
CHECK_NULL(1, MPI_ERR_WIN, win)
CHECK_WIN(1, (*win))
+ if ((*win)->opened() == 1){
+ XBT_WARN("Attempt to destroy a MPI_Win too early -missing MPI_Win_fence ?");
+ return MPI_ERR_WIN;
+ }
const SmpiBenchGuard suspend_bench;
delete *win;
return MPI_SUCCESS;
void* base() const;
int disp_unit() const;
int fence(int assert);
+ int opened() const {return opened_;}
int put(const void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
MPI_Aint target_disp, int target_count, MPI_Datatype target_datatype, MPI_Request* request=nullptr);
int get( void *origin_addr, int origin_count, MPI_Datatype origin_datatype, int target_rank,
int Win::fence(int assert)
{
XBT_DEBUG("Entering fence");
- if (opened_ == 0)
- opened_=1;
+ opened_++;
if (not (assert & MPI_MODE_NOPRECEDE)) {
// This is not the first fence => finalize what came before
bar_->wait();