KaMPIng 0.1.0
(Near) zero-overhead C++ MPI bindings.
Loading...
Searching...
No Matches
kamping::mpi_type_traits< T, std::enable_if_t<!std::is_same_v< decltype(type_dispatcher< T >()), no_matching_type > > > Struct Template Reference

The type trait that maps a C++ type T to a type trait that can be used to construct an MPI_Datatype. More...

#include <mpi_datatype.hpp>

Public Types

using base = decltype(type_dispatcher<T>())
 The base type of this trait obtained via type_dispatcher. This defines how the data type is constructed in mpi_type_traits::data_type().
 

Static Public Member Functions

static MPI_Datatype data_type ()
 The MPI_Datatype corresponding to the type T.
 

Static Public Attributes

static constexpr TypeCategory category = base::category
 The category of the type.
 
static constexpr bool has_to_be_committed = category_has_to_be_committed(category)
 Whether the type has to be committed before it can be used in MPI calls.
 

Detailed Description

template<typename T>
struct kamping::mpi_type_traits< T, std::enable_if_t<!std::is_same_v< decltype(type_dispatcher< T >()), no_matching_type > > >

The type trait that maps a C++ type T to a type trait that can be used to construct an MPI_Datatype.

The default behavior is controlled by type_dispatcher. If you want to support a type that is not supported by the default behavior, you can specialize this trait. For example:

struct MyType {
int a;
double b;
char c;
std::array<int, 3> d;
};
namespace kamping {
// using KaMPIng's built-in struct serializer
template <>
struct mpi_type_traits<MyType> : struct_type<MyType> {};
// or using an explicitly constructed type
template <>
struct mpi_type_traits<MyType> {
static constexpr bool has_to_be_committed = true;
static MPI_Datatype data_type() {
MPI_Datatype type;
MPI_Type_create_*(..., &type);
return type;
}
};
} // namespace kamping
STL-compatible allocator for requesting memory using the builtin MPI allocator.
Definition allocator.hpp:32
The type trait that maps a C++ type T to a type trait that can be used to construct an MPI_Datatype.
Definition mpi_datatype.hpp:193
Constructs a MPI_Datatype for a struct-like type.
Definition mpi_datatype.hpp:92

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