KaMPIng 0.1.1
Flexible and (near) zero-overhead C++ bindings for MPI
Loading...
Searching...
No Matches
kamping::NonBlockingResult< CallerProvidedArgs, RequestDataBuffer, Buffers > Class Template Reference

NonBlockingResult contains the result of a non-blocking MPI call wrapped by KaMPIng. It encapsulates a kamping::Request and stores the buffers associated with the non-blocking call. Upon completion the owning out-buffers among all associated buffers are returned wrappend in an MPIResult object. More...

#include <result.hpp>

Public Member Functions

 NonBlockingResult (std::unique_ptr< std::tuple< Buffers... > > buffers_on_heap, RequestDataBuffer request)
 Constructor for NonBlockingResult.
 
 NonBlockingResult (RequestDataBuffer request)
 Constructor for NonBlockingResult.
 
auto extract ()
 Extracts the components of this results, leaving the user responsible.
 
template<typename StatusParamObjectType = decltype(status(ignore<>)), typename NonBlockingResulType_ = NonBlockingResult<CallerProvidedArgs, RequestDataBuffer, Buffers...>, typename std::enable_if< NonBlockingResulType_::owns_request, bool >::type = true>
auto wait (StatusParamObjectType status=kamping::status(ignore<>))
 Waits for the underlying Request to complete by calling Request::wait() and upon completion returns:
 
template<typename StatusParamObjectType = decltype(status(ignore<>)), typename NonBlockingResulType_ = NonBlockingResult<CallerProvidedArgs, RequestDataBuffer, Buffers...>, typename std::enable_if< NonBlockingResulType_::owns_request, bool >::type = true>
auto test (StatusParamObjectType status=kamping::status(ignore<>))
 Tests the underlying Request for completion by calling Request::test() and returns a value convertible to bool indicating if the request is complete.
 
MPI_Requestget_request_ptr ()
 Returns a pointer to the underlying request.
 

Static Public Attributes

static constexpr bool owns_request = internal::has_extract_v<RequestDataBuffer>
 true if the result object owns the underlying kamping::Request.
 

Detailed Description

template<typename CallerProvidedArgs, typename RequestDataBuffer, typename... Buffers>
class kamping::NonBlockingResult< CallerProvidedArgs, RequestDataBuffer, Buffers >

NonBlockingResult contains the result of a non-blocking MPI call wrapped by KaMPIng. It encapsulates a kamping::Request and stores the buffers associated with the non-blocking call. Upon completion the owning out-buffers among all associated buffers are returned wrappend in an MPIResult object.

Template Parameters
CallerProvidedArgsTypes of arguments passed to the wrapped MPI call.
RequestDataBufferContainer encapsulating the underlying request.
BuffersTypes of buffers associated with the underlying non-blocking MPI call.

Constructor & Destructor Documentation

◆ NonBlockingResult() [1/2]

template<typename CallerProvidedArgs , typename RequestDataBuffer , typename... Buffers>
kamping::NonBlockingResult< CallerProvidedArgs, RequestDataBuffer, Buffers >::NonBlockingResult ( std::unique_ptr< std::tuple< Buffers... > > buffers_on_heap,
RequestDataBuffer request )
inline

Constructor for NonBlockingResult.

Parameters
buffers_on_heapBuffers stored on the heap which are required by the non-blocking mpi operation associated with the given request upon completition.
requestA kamping::internal::DataBuffer containing the associated kamping::Request.

◆ NonBlockingResult() [2/2]

Constructor for NonBlockingResult.

Parameters
requestA kamping::internal::DataBuffer containing the associated kamping::Request.

Member Function Documentation

◆ extract()

Extracts the components of this results, leaving the user responsible.

If this result owns the underlying request:

  • returns a std::pair containing the Request and MPIResult if the result object contains owning out buffers.
  • returns only the Request object otherwise.

If the request is owned by the user

  • return the underlying MPIResult if the result object contains any owning out buffers.
  • returns nothing otherwise.

Note that the result may be in an undefined state because the associated operations is still underway and it is the user's responsibilty to ensure that the corresponding request has been completed before accessing the result.

◆ test()

template<typename CallerProvidedArgs , typename RequestDataBuffer , typename... Buffers>
template<typename StatusParamObjectType = decltype(status(ignore<>)), typename NonBlockingResulType_ = NonBlockingResult<CallerProvidedArgs, RequestDataBuffer, Buffers...>, typename std::enable_if< NonBlockingResulType_::owns_request, bool >::type = true>
auto kamping::NonBlockingResult< CallerProvidedArgs, RequestDataBuffer, Buffers >::test ( StatusParamObjectType status = kamping::status(ignore<>))
inline

Tests the underlying Request for completion by calling Request::test() and returns a value convertible to bool indicating if the request is complete.

The type of the return value depends on the encapsulated result and the status parameter and follows the same semantics as wait(), but its return value is wrapped in an std::optional. The optional only contains a value if the request is complete, i.e. test() succeeded.

If both the result is empty and no status returned, returns a bool indicating completion instead of an std::optional.

This method is only available if this result owns the underlying request. If this is not the case, the user must manually test the request that they own and manually obtain the result via extract().

Parameters
statusA parameter created by kamping::status() or kamping::status_out(). Defaults to kamping::status(ignore<>).

◆ wait()

template<typename CallerProvidedArgs , typename RequestDataBuffer , typename... Buffers>
template<typename StatusParamObjectType = decltype(status(ignore<>)), typename NonBlockingResulType_ = NonBlockingResult<CallerProvidedArgs, RequestDataBuffer, Buffers...>, typename std::enable_if< NonBlockingResulType_::owns_request, bool >::type = true>
auto kamping::NonBlockingResult< CallerProvidedArgs, RequestDataBuffer, Buffers >::wait ( StatusParamObjectType status = kamping::status(ignore<>))
inline

Waits for the underlying Request to complete by calling Request::wait() and upon completion returns:

If status is an out-parameter:

  • If the result is not empty (see is_result_empty_v), an std::pair containing an MPIResult and the status.
  • If the result is empty, only the status is returned.

If is kamping::status(ignore<>), or not an out-paramter:

  • If the result is not empty (see is_result_empty_v), only the result is returned.
  • If the result is empty, nothing is returned.

This method is only available if this result owns the underlying request. If this is not the case, the user must manually wait on the request that they own and manually obtain the result via extract().

Parameters
statusA parameter created by kamping::status() or kamping::status_out(). Defaults to kamping::status(ignore<>).

The documentation for this class was generated from the following file: