X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ecd5f7562caf1d443bf22788fa5f4fac408776ec..84402e8e2ee2a2d0bef25fdceb0a263ed8b471f6:/src/smpi/bindings/smpi_f77_request.cpp diff --git a/src/smpi/bindings/smpi_f77_request.cpp b/src/smpi/bindings/smpi_f77_request.cpp index 3fb234305f..73c99a901b 100644 --- a/src/smpi/bindings/smpi_f77_request.cpp +++ b/src/smpi/bindings/smpi_f77_request.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2010-2020. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -171,9 +171,12 @@ void mpi_waitany_(int* count, int* requests, int* index, MPI_Status* status, int reqs[i] = simgrid::smpi::Request::f2c(requests[i]); } *ierr = MPI_Waitany(*count, reqs, index, status); - if(reqs[*index]==MPI_REQUEST_NULL){ - simgrid::smpi::Request::free_f(requests[*index]); - requests[*index]=MPI_FORTRAN_REQUEST_NULL; + if(*index!=MPI_UNDEFINED){ + if(reqs[*index]==MPI_REQUEST_NULL){ + simgrid::smpi::Request::free_f(requests[*index]); + requests[*index]=MPI_FORTRAN_REQUEST_NULL; + } + *index=*index+1; } xbt_free(reqs); } @@ -212,6 +215,7 @@ void mpi_waitsome_ (int* incount, int* requests, int *outcount, int *indices, MP simgrid::smpi::Request::free_f(requests[indices[i]]); requests[indices[i]]=MPI_FORTRAN_REQUEST_NULL; } + indices[i]++; } xbt_free(reqs); } @@ -251,9 +255,12 @@ void mpi_testany_ (int* count, int* requests, int *index, int *flag, MPI_Status* reqs[i] = simgrid::smpi::Request::f2c(requests[i]); } *ierr = MPI_Testany(*count, reqs, index, flag, FORT_STATUS_IGNORE(status)); - if(*index!=MPI_UNDEFINED && reqs[*index]==MPI_REQUEST_NULL){ + if(*index!=MPI_UNDEFINED){ + if(reqs[*index]==MPI_REQUEST_NULL){ simgrid::smpi::Request::free_f(requests[*index]); requests[*index]=MPI_FORTRAN_REQUEST_NULL; + } + *index=*index+1; } xbt_free(reqs); } @@ -269,10 +276,11 @@ void mpi_testsome_ (int* incount, int* requests, int* outcount, int* indices, M } *ierr = MPI_Testsome(*incount, reqs, outcount, indices, FORT_STATUSES_IGNORE(statuses)); for(i=0;i<*incount;i++){ - if(indices[i] && reqs[indices[i]]==MPI_REQUEST_NULL){ + if(reqs[indices[i]]==MPI_REQUEST_NULL){ simgrid::smpi::Request::free_f(requests[indices[i]]); requests[indices[i]]=MPI_FORTRAN_REQUEST_NULL; } + indices[i]++; } xbt_free(reqs); }