KaMPIng 0.1.1
Flexible and (near) zero-overhead C++ bindings for MPI
Loading...
Searching...
No Matches
kamping::RequestPool< DefaultContainerType > Class Template Reference

A pool for storing multiple Request s and checking them for completion. More...

#include <request_pool.hpp>

Public Types

using index_type = size_t
 The type used to index requests in the pool.
 
template<typename... Args>
using default_container_type = DefaultContainerType<Args...>
 Type of the default container type to use for containers created inside operations of this request pool.
 

Public Member Functions

 RequestPool ()
 Constructs a new empty RequestPool.
 
index_type index_begin () const
 The first index value. The pool is empty if index_begin() == index_end().
 
index_type index_end () const
 The index value after the last one. The pool is empty if index_begin() == index_end().
 
size_t num_requests () const
 Returns the number of requests currently stored in the pool.
 
MPI_Requestrequest_ptr ()
 Returns a pointer to the underlying MPI_Request array.
 
PooledRequest< index_typeget_request ()
 Adds a new request to the pool and returns a PooledRequest encapsulating it.
 
template<typename StatusesParamObjectType = decltype(kamping::statuses(ignore<>))>
auto wait_all (StatusesParamObjectType statuses_param=kamping::statuses(ignore<>))
 Waits for all requests in the pool to complete by calling MPI_Waitall.
 
template<typename StatusesParamObjectType = decltype(kamping::statuses(ignore<>))>
auto test_all (StatusesParamObjectType statuses_param=kamping::statuses(ignore<>))
 Tests whether all requests in the pool have completed by calling MPI_Testall.
 
template<typename StatusParamObjectType = decltype(status(ignore<>))>
auto wait_any (StatusParamObjectType status_param=kamping::status(ignore<>))
 Waits any request in the pool to complete by calling MPI_Waitany.
 
template<typename StatusParamObjectType = decltype(status(ignore<>))>
auto test_any (StatusParamObjectType status_param=kamping::status(ignore<>))
 Tests if any request in the pool is completed by calling MPI_Testany.
 

Detailed Description

template<template< typename... > typename DefaultContainerType = std::vector>
class kamping::RequestPool< DefaultContainerType >

A pool for storing multiple Request s and checking them for completion.

Requests are internally stored in a vector. The vector is resized as needed. New requests can be obtained by calling get_request.

Template Parameters
DefaultContainerTypeThe default container type to use for containers created inside pool operations. Defaults to std::vector.

Member Typedef Documentation

◆ default_container_type

template<template< typename... > typename DefaultContainerType = std::vector>
template<typename... Args>
using kamping::RequestPool< DefaultContainerType >::default_container_type = DefaultContainerType<Args...>

Type of the default container type to use for containers created inside operations of this request pool.

Template Parameters
ArgsArguments to the container type.

Member Function Documentation

◆ test_all()

template<template< typename... > typename DefaultContainerType = std::vector>
template<typename StatusesParamObjectType = decltype(kamping::statuses(ignore<>))>
auto kamping::RequestPool< DefaultContainerType >::test_all ( StatusesParamObjectType statuses_param = kamping::statuses(ignore<>))
inline

Tests whether all requests in the pool have completed by calling MPI_Testall.

Parameters
statuses_paramA statuses parameter object to which the status information is written. Defaults to kamping::statuses(ignore<>).
Returns
A truthful value if all requests have completed, a falsy value otherwise.
Note
By default, returns a bool indicated completion, but if statuses is an owning out parameter, returns a std::optional containing the status information.
Warning
If the status parameter is provided, the underlying buffer is always resized to fit all requests according to its resize_policy, even if not all requests have completed yet. This is because MPI does not allow retrieving statuses after a test succeeded.

◆ test_any()

template<template< typename... > typename DefaultContainerType = std::vector>
template<typename StatusParamObjectType = decltype(status(ignore<>))>
auto kamping::RequestPool< DefaultContainerType >::test_any ( StatusParamObjectType status_param = kamping::status(ignore<>))
inline

Tests if any request in the pool is completed by calling MPI_Testany.

Parameters
status_paramA status parameter object to which the status information about the completed operation is written. Defaults to kamping::status(ignore<>).
Returns
If any request completes, returns an std::optional containing information about the completed request. Otherwise, std::nullopt. The value contained inside the optional depends on status parameter and follows the same rules as for wait_any.
See also
wait_any

◆ wait_all()

template<template< typename... > typename DefaultContainerType = std::vector>
template<typename StatusesParamObjectType = decltype(kamping::statuses(ignore<>))>
auto kamping::RequestPool< DefaultContainerType >::wait_all ( StatusesParamObjectType statuses_param = kamping::statuses(ignore<>))
inline

Waits for all requests in the pool to complete by calling MPI_Waitall.

Parameters
statuses_paramA statuses parameter object to which the status information is written. Defaults to kamping::statuses(ignore<>).
Returns
If statuses is an owning out parameter, returns the status information, otherwise returns nothing.

◆ wait_any()

template<template< typename... > typename DefaultContainerType = std::vector>
template<typename StatusParamObjectType = decltype(status(ignore<>))>
auto kamping::RequestPool< DefaultContainerType >::wait_any ( StatusParamObjectType status_param = kamping::status(ignore<>))
inline

Waits any request in the pool to complete by calling MPI_Waitany.

Parameters
status_paramA status parameter object to which the status information about the completed operation is written. Defaults to kamping::status(ignore<>).
Returns
By default, returns the index of the completed operation. If the pool is empty or no request in the pool is active, returns an index equal to index_end(). If status is an owning out parameter, also returns the status alongside the index by returning a PoolAnyResult.
See also
PoolAnyResult

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