24#include "kamping/named_parameters_detail/status_parameters.hpp"
26#include "kamping/request.hpp"
33template <
typename IndexType,
typename StatusType>
57 template <
typename...
Args>
67 return _requests.size();
72 return _requests.size();
77 return _requests.data();
90 template <
typename StatusesParamObjectType = decltype(kamping::statuses(ignore<>))>
94 "Only statuses parameters are allowed."
98 if constexpr (
decltype(
statuses)::buffer_type == internal::BufferType::ignore) {
107 "statuses buffer is not large enough to hold all status information.",
128 template <
typename StatusesParamObjectType = decltype(kamping::statuses(ignore<>))>
132 "Only statuses parameters are allowed."
136 if constexpr (
decltype(
statuses)::buffer_type == internal::BufferType::ignore) {
145 "statuses buffer is not large enough to hold all status information.",
156 return std::optional{
statuses.extract()};
158 return std::optional<
decltype(
statuses.extract())>{};
172 template <
typename StatusParamObjectType = decltype(status(ignore<>))>
176 "Only status parameters are allowed."
210 template <
typename StatusParamObjectType = decltype(status(ignore<>))>
214 "Only status parameters are allowed."
234 return std::optional<return_type>{{
static_cast<index_type>(index),
status.extract()}};
237 return std::optional<PoolAnyResult<index_type, status_type>>{};
244 return std::optional{
static_cast<index_type>(index)};
247 return std::optional<index_type>{};
253 std::vector<MPI_Request> _requests;
Helper functions that make casts safer.
STL-compatible allocator for requesting memory using the builtin MPI allocator.
Definition allocator.hpp:32
A pool for storing multiple Request s and checking them for completion.
Definition request_pool.hpp:48
auto wait_any(StatusParamObjectType status_param=kamping::status(ignore<>))
Waits any request in the pool to complete by calling MPI_Waitany.
Definition request_pool.hpp:173
index_type index_end() const
The index value after the last one. The pool is empty if index_begin() == index_end().
Definition request_pool.hpp:66
MPI_Request * request_ptr()
Returns a pointer to the underlying MPI_Request array.
Definition request_pool.hpp:76
auto test_all(StatusesParamObjectType statuses_param=kamping::statuses(ignore<>))
Tests whether all requests in the pool have completed by calling MPI_Testall.
Definition request_pool.hpp:129
RequestPool()
Constructs a new empty RequestPool.
Definition request_pool.hpp:51
auto wait_all(StatusesParamObjectType statuses_param=kamping::statuses(ignore<>))
Waits for all requests in the pool to complete by calling MPI_Waitall.
Definition request_pool.hpp:91
size_t num_requests() const
Returns the number of requests currently stored in the pool.
Definition request_pool.hpp:71
auto test_any(StatusParamObjectType status_param=kamping::status(ignore<>))
Tests if any request in the pool is completed by calling MPI_Testany.
Definition request_pool.hpp:211
PooledRequest< index_type > get_request()
Adds a new request to the pool and returns a PooledRequest encapsulating it.
Definition request_pool.hpp:81
index_type index_begin() const
The first index value. The pool is empty if index_begin() == index_end().
Definition request_pool.hpp:61
#define THROW_IF_MPI_ERROR(error_code, function)
Wrapper around THROWING_KASSERT for MPI errors.
Definition error_handling.hpp:33
constexpr int light
Assertion level for lightweight assertions.
Definition assertion_levels.hpp:13
auto status(internal::ignore_t< void >)
pass MPI_STATUS_IGNORE to the underlying MPI call.
Definition status_parameters.hpp:52
auto statuses(internal::ignore_t< void >)
pass MPI_STATUSES_IGNORE to the underlying MPI call.
Definition status_parameters.hpp:58
@ status
Tag used to represent the status in a MPI call.
@ statuses
Tag used to represent a container of statuses in a MPI call.
constexpr bool is_extractable
Helper for implementing the extract_* functions in MPIResult. Is true if the passed buffer type owns ...
Definition result.hpp:48
static MPI_Status * status_param_to_native_ptr(StatusParam ¶m)
returns a pointer to the MPI_Status encapsulated by the provided status parameter object.
Definition parameter_objects.hpp:489
Parameter objects return by named parameter factory functions.
Result returned by RequestPool::wait_any()
Definition request_pool.hpp:34
IndexType index
The index of the completed operation. RequestPool::index_end() if there were no active requests.
Definition request_pool.hpp:36
StatusType status
The status of the complete operation.
Definition request_pool.hpp:37