Edit

Share via


MPI_Grequest_query_function callback function

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

Syntax

int MPI_Grequest_query_function(
  _In_opt_ void       *extra_state,
  _Out_    MPI_Status *status
);

Parameters

  • extra_state [in, optional]
    Extra state.

  • status [out]
    MPI status object.

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_{Wait|Test}any 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_{Wait|Test}{some|all} 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_QUERY_FUNCTION(EXTRA_STATE, STATUS, IERROR)
        INTEGER STATUS(MPI_STATUS_SIZE), IERROR
        INTEGER(KIND=MPI_ADDRESS_KIND) EXTRA_STATE

Remarks

The query_fn function computes the status that should be returned for the generalized request. The status also includes information about successful/unsuccessful cancellation of the request (result to be returned by MPI_Test_cancelled).

The query_fn callback is invoked by the MPI_{Wait|Test}{any|some|all} call that completed the generalized request associated with this callback. The callback function is also invoked by calls to MPI_Request_get_status, if the request is complete when the call occurs. In both cases, the callback is passed a reference to the corresponding status variable passed by the user to the MPI call; the status set by the callback function is returned by the MPI call. If the user provided MPI_STATUS_IGNORE or MPI_STATUSES_IGNORE to the MPI function that causes query_fn to be called, then MPI will pass a valid status object to query_fn, and this status will be ignored upon return of the callback function. Note that query_fn is invoked only after MPI_Grequest_complete is called on the request; it may be invoked several times for the same generalized request, e.g., if the user calls MPI_Request_get_status several times for this request. Note also that a call to MPI_{Wait|Test}{some|all} may cause multiple invocations of query_fn callback functions, one for each generalized request that is completed by the MPI call. The order of these invocations is not specified by MPI.

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