From 929ca338906ad17f8f3282b7b5d95f9457c74a99 Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Thu, 18 Jul 2019 18:25:56 +0200 Subject: [PATCH] Only wait on active requests (not null and not finished) --- src/smpi/mpi/smpi_request.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/smpi/mpi/smpi_request.cpp b/src/smpi/mpi/smpi_request.cpp index 7ae4f42bd1..9c2653a227 100644 --- a/src/smpi/mpi/smpi_request.cpp +++ b/src/smpi/mpi/smpi_request.cpp @@ -594,7 +594,7 @@ int Request::testsome(int incount, MPI_Request requests[], int *count, int *indi *count = 0; for (int i = 0; i < incount; i++) { - if (requests[i] != MPI_REQUEST_NULL) { + if (requests[i] != MPI_REQUEST_NULL && not (requests[i]->flags_ & MPI_REQ_FINISHED)) { ret = test(&requests[i], pstat, &flag); if(ret!=MPI_SUCCESS) error = 1; @@ -1060,7 +1060,6 @@ int Request::waitsome(int incount, MPI_Request requests[], int *indices, MPI_Sta int index = 0; MPI_Status stat; MPI_Status *pstat = status == MPI_STATUSES_IGNORE ? MPI_STATUS_IGNORE : &stat; - index = waitany(incount, (MPI_Request*)requests, pstat); if(index==MPI_UNDEFINED) return MPI_UNDEFINED; if(status != MPI_STATUSES_IGNORE) { @@ -1069,9 +1068,8 @@ int Request::waitsome(int incount, MPI_Request requests[], int *indices, MPI_Sta indices[count] = index; count++; for (int i = 0; i < incount; i++) { - if (i==index) - continue; - if (requests[i] != MPI_REQUEST_NULL) { + if (i!=index && requests[i] != MPI_REQUEST_NULL + && not(requests[i]->flags_ & MPI_REQ_FINISHED)) { test(&requests[i], pstat,&flag); if (flag==1){ indices[count] = i; -- 2.20.1