From: degomme Date: Thu, 16 Feb 2017 11:08:44 +0000 (+0100) Subject: Avoid doing things when there is nothing to do. X-Git-Tag: v3_15~344^2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/63c411f773b06e9adb04479d4943efaf9838bf9f Avoid doing things when there is nothing to do. --- diff --git a/src/smpi/smpi_rma.cpp b/src/smpi/smpi_rma.cpp index 68d8507b8d..6edbee3e47 100644 --- a/src/smpi/smpi_rma.cpp +++ b/src/smpi/smpi_rma.cpp @@ -117,13 +117,16 @@ int smpi_mpi_win_fence( int assert, MPI_Win win){ std::vector *reqs = win->requests; int size = static_cast(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;