Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid doing things when there is nothing to do.
authordegomme <augustin.degomme@unibas.ch>
Thu, 16 Feb 2017 11:08:44 +0000 (12:08 +0100)
committerdegomme <augustin.degomme@unibas.ch>
Thu, 16 Feb 2017 11:08:56 +0000 (12:08 +0100)
src/smpi/smpi_rma.cpp

index 68d8507..6edbee3 100644 (file)
@@ -117,13 +117,16 @@ int smpi_mpi_win_fence( int assert,  MPI_Win win){
     std::vector<MPI_Request> *reqs = win->requests;
     int size = static_cast<int>(reqs->size());
     // start all requests that have been prepared by another process
     std::vector<MPI_Request> *reqs = win->requests;
     int size = static_cast<int>(reqs->size());
     // start all requests that have been prepared by another process
-    for(auto req: *reqs){
-      if (req && (req->flags & PREPARED))
-        smpi_mpi_start(req);
-    }
+    if(size>0){
+        for(auto req: *reqs){
+          if (req && (req->flags & PREPARED))
+            smpi_mpi_start(req);
+        }
+
+        MPI_Request* treqs = &(*reqs)[0];
 
 
-    MPI_Request* treqs = &(*reqs)[0];
-    smpi_mpi_waitall(size,treqs,MPI_STATUSES_IGNORE);
+        smpi_mpi_waitall(size,treqs,MPI_STATUSES_IGNORE);
+    }
     win->count=0;
   }
   win->assert = assert;
     win->count=0;
   }
   win->assert = assert;