KaMPIng 0.2.1
(Near) zero-overhead MPI wrapper for C++
Loading...
Searching...
No Matches
MPI Utility

Quality of life features for MPI like automatic type conversion (from C++ to MPI) More...

Namespaces

namespace  kamping::internal
 Internal namespace marking the code that is not user-facing.
 

Classes

struct  kamping::AllocNewT< Container >
 Buffer allocation tag used for indicating that a buffer should be allocated by KaMPIng. More...
 
struct  kamping::AllocNewUsingT< Container >
 Buffer allocation tag used for indicating that a buffer should be allocated by KaMPIng. More...
 
struct  kamping::AllocContainerOfT< T >
 Buffer allocation tag used for indicating that a buffer of type T should be allocated by KaMPIng. More...
 
struct  kamping::mpi_type_traits< T, Enable >
 The type trait that maps a C++ type T to an MPI_Datatype for full KaMPIng. More...
 
struct  kamping::mpi_type_traits< T, std::enable_if_t< has_auto_dispatched_type_v< T > > >
 Partial specialization of mpi_type_traits for types handled by type_dispatcher. More...
 
struct  kamping::has_static_type< typename, Enable >
 Check if the type has a static type definition, i.e. kamping::mpi_type_traits is defined. More...
 
struct  kamping::has_static_type< T, std::void_t< decltype(mpi_type_traits< T >::data_type())> >
 Check if the type has a static type definition, i.e. kamping::mpi_type_traits is defined. More...
 
struct  kamping::kamping_lookup
 Lookup policy for KaMPIng that resolves MPI_Datatypes via kamping::mpi_type_traits. More...
 

Typedefs

template<typename T , size_t N>
using kamping::contiguous_type = types::contiguous_type<T, N, kamping_lookup>
 Constructs a contiguous MPI type of N elements of type T, using kamping_lookup to resolve element types (includes the byte-serialization fallback for trivially-copyable types).
 
template<typename T >
using kamping::struct_type = types::struct_type<T, kamping_lookup>
 Constructs an MPI struct type for T, using kamping_lookup to resolve field types (includes the byte-serialization fallback for trivially-copyable types).
 

Enumerations

enum class  kamping::BufferResizePolicy { BufferResizePolicy::no_resize , BufferResizePolicy::grow_only , BufferResizePolicy::resize_to_fit }
 Enum to specify in which cases a buffer is resized. More...
 

Functions

template<typename T >
auto kamping::type_dispatcher ()
 Maps a C++ type T to a type trait for constructing an MPI_Datatype.
 
template<typename T >
MPI_Datatype kamping::construct_and_commit_type ()
 Register a new MPI_Datatype for T with the MPI environment. It will be freed when the environment is finalized.
 
template<typename T >
MPI_Datatype kamping::mpi_datatype () KAMPING_NOEXCEPT
 Translate type T to an MPI_Datatype using the type defined via mpi_type_traits.
 
template<typename StatusObject >
auto kamping::params::status_out (StatusObject &&status)
 Outputs the return status of the operation to the provided status object. The status object may be passed as lvalue-reference or rvalue.
 
auto kamping::params::status_out ()
 Constructs a status object internally, which may then be retrieved from kamping::MPIResult returned by the operation.
 
auto kamping::params::status (internal::ignore_t< void >)
 pass MPI_STATUS_IGNORE to the underlying MPI call.
 
auto kamping::params::statuses (internal::ignore_t< void >)
 pass MPI_STATUSES_IGNORE to the underlying MPI call.
 
template<BufferResizePolicy resize_policy = BufferResizePolicy::no_resize, typename Container >
auto kamping::params::statuses_out (Container &&container)
 Pass a Container of MPI_Status to the underlying MPI call in which the statuses are stored upon completion. The container may be resized according the provided resize_policy.
 
template<typename Container >
auto kamping::params::statuses_out (AllocNewT< Container >)
 Internally construct a new Container of MPI_Status, which will hold the returned statuses.
 
template<template< typename... > typename Container>
auto kamping::params::statuses_out (AllocNewUsingT< Container >)
 Internally construct a new Container<MPI_Status> which will hold the returned statuses.
 
auto kamping::params::statuses_out ()
 Internally construct a container of MPI_Status, which will hold the returned statuses. The container's type is usually determined by operations called on a kamping::RequestPool, and defaults to kamping::RequestPool::default_container_type.
 

Variables

template<typename Container >
static constexpr auto kamping::alloc_new = AllocNewT<Container>{}
 Convenience wrapper for creating library allocated containers. See AllocNewT for details.
 
template<typename T >
static constexpr bool kamping::is_alloc_new_v = false
 Helper to decide if an allocation tag is an AllocNewT.
 
template<typename T >
static constexpr bool kamping::is_alloc_new_v< AllocNewT< T > > = true
 Helper to decide if an allocation tag is an AllocNewT.
 
template<template< typename... > typename Container>
static constexpr auto kamping::alloc_new_using = AllocNewUsingT<Container>{}
 Convenience wrapper for creating library allocated containers. See AllocNewUsingT for details.
 
template<typename T >
static constexpr bool kamping::is_alloc_new_using_v = false
 Helper to decide if an allocation tag is an AllocNewUsingT.
 
template<template< typename... > typename Container>
static constexpr bool kamping::is_alloc_new_using_v< AllocNewUsingT< Container > > = true
 Helper to decide if an allocation tag is an AllocNewUsingT.
 
template<typename T >
static constexpr auto kamping::alloc_container_of = AllocContainerOfT<T>{}
 Convenience wrapper for creating library allocated containers. See AllocContainerOfT for details.
 
template<typename T >
static constexpr bool kamping::is_alloc_container_of_v = false
 Helper to decide if an allocation tag is an AllocContainerOfT.
 
template<typename T >
static constexpr bool kamping::is_alloc_container_of_v< AllocContainerOfT< T > > = true
 Helper to decide if an allocation tag is an AllocContainerOfT.
 
constexpr BufferResizePolicy kamping::no_resize
 
constexpr BufferResizePolicy kamping::grow_only
 
constexpr BufferResizePolicy kamping::resize_to_fit
 
template<typename T >
static constexpr bool kamping::has_auto_dispatched_type_v
 Whether the type is handled by the auto-dispatcher type_dispatcher, i.e. whether mpi_type_traits is defined without a user-provided specialization.
 
template<typename T >
static constexpr bool kamping::has_static_type_v = has_static_type<T>::value
 true if kamping::mpi_type_traits provides a data_type() function.
 

Detailed Description

Quality of life features for MPI like automatic type conversion (from C++ to MPI)

Typedef Documentation

◆ contiguous_type

Constructs a contiguous MPI type of N elements of type T, using kamping_lookup to resolve element types (includes the byte-serialization fallback for trivially-copyable types).

See also
kamping::types::contiguous_type

◆ struct_type

Constructs an MPI struct type for T, using kamping_lookup to resolve field types (includes the byte-serialization fallback for trivially-copyable types).

See also
kamping::types::struct_type

Enumeration Type Documentation

◆ BufferResizePolicy

Enum to specify in which cases a buffer is resized.

Enumerator
no_resize 

Policy indicating that the underlying buffer shall never be resized.

grow_only 

Policy indicating that the underlying buffer shall only be resized if the current size of the buffer is too small.

resize_to_fit 

Policy indicating that the underlying buffer is resized such that it has exactly the required size.

Function Documentation

◆ construct_and_commit_type()

template<typename T >
MPI_Datatype kamping::construct_and_commit_type ( )
inline

Register a new MPI_Datatype for T with the MPI environment. It will be freed when the environment is finalized.

The MPI_Datatype is created using mpi_type_traits<T>::data_type() and committed using MPI_Type_commit.

Template Parameters
TThe type to register.

◆ mpi_datatype()

template<typename T >
MPI_Datatype kamping::mpi_datatype ( )

Translate type T to an MPI_Datatype using the type defined via mpi_type_traits.

If the type has not been registered with MPI yet, it will be created and committed and automatically registered with the MPI environment, such that it will be freed when the environment is finalized.

Template Parameters
TThe type to translate into an MPI_Datatype.

◆ status_out()

template<typename StatusObject >
auto kamping::params::status_out ( StatusObject && status)
inline

Outputs the return status of the operation to the provided status object. The status object may be passed as lvalue-reference or rvalue.

Template Parameters
StatusObjecttype of the status object, may either be MPI_Status or kamping::Status
Parameters
statusThe status object.

◆ statuses_out()

template<BufferResizePolicy resize_policy = BufferResizePolicy::no_resize, typename Container >
auto kamping::params::statuses_out ( Container && container)
inline

Pass a Container of MPI_Status to the underlying MPI call in which the statuses are stored upon completion. The container may be resized according the provided resize_policy.

Template Parameters
resize_policyPolicy specifying whether (and if so, how) the underlying buffer shall be resized. The default
Containerthe container type to use for the statuses.

◆ type_dispatcher()

template<typename T >
auto kamping::type_dispatcher ( )

Maps a C++ type T to a type trait for constructing an MPI_Datatype.

Extends kamping::types::type_dispatcher() with:

Returns
The corresponding type trait for the type T.

Variable Documentation

◆ grow_only

constexpr BufferResizePolicy kamping::grow_only
constexpr
Initial value:
=
BufferResizePolicy::grow_only

Constant storing a BufferResizePolicy::grow_only enum member. It can be used to declare a buffer's resize policy in more concise manner.

◆ has_auto_dispatched_type_v

template<typename T >
constexpr bool kamping::has_auto_dispatched_type_v
staticconstexpr
Initial value:
=
!std::is_same_v<decltype(type_dispatcher<T>()), internal::no_matching_type>

Whether the type is handled by the auto-dispatcher type_dispatcher, i.e. whether mpi_type_traits is defined without a user-provided specialization.

◆ no_resize

constexpr BufferResizePolicy kamping::no_resize
constexpr
Initial value:
=
BufferResizePolicy::no_resize

Constant storing a BufferResizePolicy::no_resize enum member. It can be used to declare a buffer's resize policy in more concise manner.

◆ resize_to_fit

constexpr BufferResizePolicy kamping::resize_to_fit
constexpr
Initial value:
=
BufferResizePolicy::resize_to_fit

Constant storing a BufferResizePolicy::resize_to_fit enum member. It can be used to declare a buffer's resize policy in more concise manner.