Edit

Share via


MPI_Grequest_free_function callback function

MPI_Grequest_free_function is a placeholder for the application-defined function name.

Syntax

int MPI_Grequest_free_function(
  _In_opt_ void *extra_state
);

Parameters

  • extra_state [in, optional]
    Extra state.

Return value

All callback functions return an error code. The code is passed back and dealt with as appropriate for the error code by the MPI function that invoked the callback function. For example, if error codes are returned then the error code returned by the callback function will be returned by the MPI function that invoked the callback function. In the case of an MPI_Waitany and MPI_Testany call that invokes both query_fn and free_fn, the MPI call will return the error code returned by the last callback, namely free_fn. If one or more of the requests in a call to MPI_Waitsome, MPI_Waitall, MPI_Testsome, or MPI_Testall failed, then the MPI call will return MPI_ERR_IN_STATUS. In such a case, if the MPI call was passed an array of statuses, then MPI will return in each of the statuses that correspond to a completed generalized request the error code returned by the corresponding invocation of its free_fn callback function. However, if the MPI function was passed MPI_STATUSES_IGNORE, then the individual error codes returned by each callback functions will be lost.

Fortran

    SUBROUTINE GREQUEST_FREE_FUNCTION(EXTRA_STATE, IERROR)
        INTEGER IERROR
        INTEGER(KIND=MPI_ADDRESS_KIND) EXTRA_STATE

Remarks

The free_fn function is invoked to clean up user-allocated resources when the generalized request is freed.

The free_fn callback is invoked by the MPI_{Wait|Test}{any|some|all} call that completed the generalized request associated with this callback. free_fn is invoked after the call to query_fn for the same request. However, if the MPI call completed multiple generalized requests, the order in which free_fn callback functions are invoked is not specified by MPI.

The free_fn callback is also invoked for generalized requests that are freed by a call to MPI_Request_free (no call to MPI_{Wait|Test}{any|some|all} will occur for such a request). In this case, the callback function will be called either in the MPI call MPI_Request_free, or in the MPI call MPI_Grequest_complete, whichever happens last, i.e., in this case the actual freeing code is executed as soon as both calls MPI_Request_free and MPI_Grequest_complete have occurred. The request is not deallocated until after free_fn completes. Note that free_fn will be invoked only once per request by a correct program.

Requirements

Product

HPC Pack 2012 MS-MPI Redistributable Package, HPC Pack 2008 R2 MS-MPI Redistributable Package, HPC Pack 2008 MS-MPI Redistributable Package or HPC Pack 2008 Client Utilities

Header

Mpi.h; Mpif.h

See also

MPI External Functions

MPI_Grequest_start

MPI_Waitall

MPI_Waitsome

MPI_Waitany

MPI_Testall

MPI_Testsome

MPI_Testany