KaMPIng 0.1.0
(Near) zero-overhead C++ MPI bindings.
Loading...
Searching...
No Matches
kamping::NonBlockingResult< MPIResultType, RequestDataBuffer > Class Template Reference

NonBlockingResult contains the result of a non-blocking MPI call wrapped by KaMPIng. It encapsulates a kamping::MPIResult and a kamping::Request. More...

#include <result.hpp>

Public Member Functions

 NonBlockingResult (std::unique_ptr< MPIResultType > result, 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<MPIResultType, RequestDataBuffer>, 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<MPIResultType, RequestDataBuffer>, 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.
 
MPIResultTypeget_result ()
 Provides access to the underlying result object.
 
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 MPIResultType, typename RequestDataBuffer>
class kamping::NonBlockingResult< MPIResultType, RequestDataBuffer >

NonBlockingResult contains the result of a non-blocking MPI call wrapped by KaMPIng. It encapsulates a kamping::MPIResult and a kamping::Request.

Template Parameters
MPIResultTypeThe underlying result type.
RequestDataBufferContainer encapsulating the underlying request.

Constructor & Destructor Documentation

◆ NonBlockingResult()

kamping::NonBlockingResult< MPIResultType, RequestDataBuffer >::NonBlockingResult ( std::unique_ptr< MPIResultType > result,
RequestDataBuffer request )
inline

Constructor for NonBlockingResult.

Parameters
resultThe underlying kamping::MPIResult.
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 StatusParamObjectType = decltype(status(ignore<>)), typename NonBlockingResulType_ = NonBlockingResult<MPIResultType, RequestDataBuffer>, typename std::enable_if< NonBlockingResulType_::owns_request, bool >::type = true>
auto kamping::NonBlockingResult< MPIResultType, RequestDataBuffer >::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 StatusParamObjectType = decltype(status(ignore<>)), typename NonBlockingResulType_ = NonBlockingResult<MPIResultType, RequestDataBuffer>, typename std::enable_if< NonBlockingResulType_::owns_request, bool >::type = true>
auto kamping::NonBlockingResult< MPIResultType, RequestDataBuffer >::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: