#include "mpiP.h" /* * COMPLETION */ FC_FUNC( mpi_test , MPI_TEST)(int *request, int *flag, int *status, int *ierror) { *ierror=MPI_Test( (void *)request ,flag,(MPI_Status *)status); } int MPI_Test(MPI_Request *request, int *flag, MPI_Status *status) { Req *req; if (*request==MPI_REQUEST_NULL) { status->MPI_TAG= MPI_ANY_TAG; status->MPI_SOURCE= MPI_ANY_SOURCE; *flag=1; return(MPI_SUCCESS); } req=mpi_handle_to_ptr(*request); *flag=req->complete; if (*flag) { status->MPI_SOURCE= req->source; status->MPI_TAG= req->tag; mpi_free_handle(*request); *request=MPI_REQUEST_NULL; } return(MPI_SUCCESS); } FC_FUNC( mpi_wait , MPI_WAIT )(int *request, int *status, int *ierror) { *ierror=MPI_Wait( (void *)request, (MPI_Status *)status ); } int MPI_Wait(MPI_Request *request, MPI_Status *status) { int flag; MPI_Test(request,&flag,status); if (!flag) { fprintf(stderr,"MPI_Wait: request not complete, deadlock\n"); abort(); } return(MPI_SUCCESS); } /*********/ FC_FUNC( mpi_waitany , MPI_WAITANY )(int *count, int *requests, int *index, int *status, int *ierror) { *ierror=MPI_Waitany(*count, (void *)requests,index,(MPI_Status *)status); } int MPI_Waitany(int count, MPI_Request *array_of_requests, int *index, MPI_Status *status) { int i; int flag; for (i=0; i