« Return to documentation listing
Table of Contents
#include <mpi.h> int MPI_Request_free(MPI_Request *request)
INCLUDE ’mpif.h’ MPI_REQUEST_FREE(REQUEST, IERROR) INTEGER REQUEST, IERROR
USE mpi_f08 MPI_Request_free(request, ierror) TYPE(MPI_Request), INTENT(INOUT) :: request INTEGER, OPTIONAL, INTENT(OUT) :: ierror
MPI_Request_free marks the request object for deallocation and sets request to MPI_REQUEST_NULL. Any ongoing communication that is associated with the request will be allowed to complete. The request will be deallocated only after its completion.
Example:
CALL MPI_COMM_RANK(MPI_COMM_WORLD, rank) IF(rank.EQ.0) THEN DO i=1, n CALL MPI_ISEND(outval, 1, MPI_REAL, 1, 0, req, ierr) CALL MPI_REQUEST_FREE(req, ierr) CALL MPI_IRECV(inval, 1, MPI_REAL, 1, 0, req, ierr) CALL MPI_WAIT(req, status, ierr) END DO ELSE ! rank.EQ.1 CALL MPI_IRECV(inval, 1, MPI_REAL, 0, 0, req, ierr) CALL MPI_WAIT(req, status) DO I=1, n-1 CALL MPI_ISEND(outval, 1, MPI_REAL, 0, 0, req, ierr) CALL MPI_REQUEST_FREE(req, ierr) CALL MPI_IRECV(inval, 1, MPI_REAL, 0, 0, req, ierr) CALL MPI_WAIT(req, status, ierr) END DO CALL MPI_ISEND(outval, 1, MPI_REAL, 0, 0, req, ierr) CALL MPI_WAIT(req, status) END IF
This routine is normally used to free persistent requests created with either MPI_Recv_init or MPI_Send_init and friends. However, it can be used to free a request created with MPI_Irecv or MPI_Isend and friends; in that case the use can not use the test/wait routines on the request.
It is permitted to free an active request. However, once freed, you can not use the request in a wait or test routine (e.g., MPI_Wait ).
Before the error value is returned, the current MPI error handler is called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed with MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error.