KaMPIng 0.1.1
Flexible and (near) zero-overhead C++ bindings for MPI
|
Quality of life features that make coding with (and within) KaMPIng easier. More...
Classes | |
struct | kamping::internal::ParameterTypeUnwrapping< Arg > |
Trait struct used to determine the underlying type and value of the parameter type of an object with a parameter type. (This is a building block to enable plugins to have their own named parameters). More... | |
struct | kamping::internal::ParameterTypeUnwrapping< std::integral_constant< T, v > > |
Trait struct used to determine the underlying type and value of the parameter type of an std::integral_constant wrapping a parameter type. (This is a building block to enable plugins to have their own named parameters). More... | |
struct | kamping::internal::has_parameter_helper< typename > |
Helper struct needed to retrieve the types stored in a std::tuple for the has_parameter_type check. More... | |
Typedefs | |
template<typename Arg > | |
using | kamping::internal::parameter_type_t = typename ParameterTypeUnwrapping<Arg>::type |
Trait for the underlying type of the parameter type of. | |
template<ParameterType parameter_type, typename... Args> | |
using | kamping::internal::buffer_type_with_requested_parameter_type |
Type of Buffer with requested. | |
Functions | |
template<class To , class From > | |
constexpr bool | kamping::in_range (From value) noexcept |
Checks if an integer value can be safely casted into an integer type To, that is, it lies in the range [min(To), max(To)]. | |
template<class To , class From > | |
constexpr To | kamping::asserting_cast (From value) KAMPING_NOEXCEPT |
Casts an integer value to the integer type To. If the value is outside To's range, throws an assertion. | |
template<class To , class From > | |
constexpr To | kamping::throwing_cast (From value) |
Casts an integer value to the integer type To. If the value is outside To's range, throws an exception. | |
template<typename T , typename U > | |
constexpr bool | kamping::internal::has_same_parameter_type () |
Check whether two objects have the same parameter type. | |
template<typename ParameterTypeConstant , size_t Index> | |
constexpr size_t | kamping::internal::find_pos () |
Base case if there are no parameters: always returns max index indicating that the parameter was not found. | |
template<typename ParameterTypeConstant , size_t Index, typename Arg > | |
constexpr size_t | kamping::internal::find_pos () |
Returns the Index parameter if the parameter type of Arg matches the requested parameter type. If not, this fails to compile. | |
template<typename ParameterTypeConstant , size_t Index, typename Arg , typename Arg2 , typename... Args> | |
constexpr size_t | kamping::internal::find_pos () |
Returns position of first argument in Args with Trait trait. | |
template<typename ParameterTypeConstant , typename... Args> | |
auto & | kamping::internal::select_parameter_type (Args &... args) |
Returns parameter with requested parameter type. | |
template<ParameterType parameter_type, typename... Args> | |
auto & | kamping::internal::select_parameter_type_in_tuple (std::tuple< Args... > &tuple) |
Returns parameter with requested parameter type. | |
template<ParameterType parameter_type, typename... Args> | |
auto const & | kamping::internal::select_parameter_type_in_tuple (std::tuple< Args... > const &tuple) |
Returns parameter with requested parameter type. | |
template<typename ParameterTypeConstant , typename... Args> | |
constexpr bool | kamping::internal::has_parameter_type () |
Checks if parameter with requested parameter type exists. | |
template<ParameterType parameter_type, typename... Args> | |
constexpr bool | kamping::internal::has_parameter_type_in_tuple_impl (has_parameter_helper< std::tuple< Args... > >) |
Checks if parameter with requested parameter type exists. Wrapper using the functionality from kamping::internal::has_parameter_type() disassembling a std::tuple passed as parameter. | |
template<ParameterType parameter_type, typename Tuple > | |
constexpr bool | kamping::internal::has_parameter_type_in_tuple () |
Checks if parameter with requested parameter type exists. | |
template<typename ParameterTypeConstant , typename DefaultParameterType , typename... DefaultArguments, typename... Args> | |
decltype(auto) | kamping::internal::select_parameter_type_or_default (std::tuple< DefaultArguments... > default_arguments, Args &... args) |
Checks if parameter with requested parameter type exists, if not constructs a default value. | |
Variables | |
template<typename Arg > | |
constexpr parameter_type_t< Arg > | kamping::internal::parameter_type_v = ParameterTypeUnwrapping<Arg>::value |
Trait for the underlying value of the parameter type of. | |
Quality of life features that make coding with (and within) KaMPIng easier.
using kamping::internal::buffer_type_with_requested_parameter_type |
Type of Buffer with requested.
parameter_type | |
TParameterType | Type of the parameter type (required for parameter selection within plugins). |
parameter_type | The parameter type with which a parameter should be found. |
Args | All parameter types to be searched for type parameter_type . |
Trait for the underlying type of the parameter type of.
Arg. |
Each input parameter to one of the MPI
calls wrapped by KaMPIng needs to has one of the following tags.
The MPI
calls wrapped by KaMPIng do not rely on the restricting positional parameter paradigm but use named parameters instead. The ParameterTypes defined in this enum are necessary to implement this approach, as KaMPIng needs to identify the purpose of each (unordered) argument. Note that not all enum entries are necessary in each wrapped MPI
call.
Casts an integer value to the integer type To. If the value is outside To's range, throws an assertion.
Alternatively, exceptions can be used instead of assertions by using throwing_cast().
This function works only for integer types which have at most std::numeric_limits<intmax_t>::digits (To and From are signed) or std::numeric_limits<intmax_t>::digits (else) bits. These two assumptions are checked by in_range() using static_assert()s.
To | Type to cast to. |
From | Type to cast from, will be auto inferred. |
value | Value you want to cast. |
Base case if there are no parameters: always returns max index indicating that the parameter was not found.
ParameterTypeConstant | Type and value of the parameter type (required for parameter selection within plugins). |
Index | Index of current argument to evaluate (ignored). |
std::numeric_limits<size_t>::max()
. Returns the Index parameter if the parameter type of Arg matches the requested parameter type. If not, this fails to compile.
This is the base case of the recursion.
ParameterTypeConstant | Type and value of the parameter type (required for parameter selection within plugins). |
Index | Index of current argument to evaluate. |
Arg | Argument to evaluate. |
std::numeric_limits<size_t>::max()
if not found
|
constexpr |
Returns position of first argument in Args with Trait trait.
ParameterTypeConstant | Type and value of the parameter type (required for parameter selection within plugins). |
Index | Index of current argument to evaluate. |
Arg | Argument to evaluate. |
Arg2 | The next argument. |
Args | All remaining arguments. |
std::numeric_limits<size_t>::max()
if not found
|
constexpr |
Checks if parameter with requested parameter type exists.
ParameterTypeConstant | Type and value of the parameter type to be searched(required for parameter selection within plugins). |
Args | All parameter types to be searched. |
true
iff. Args
contains a parameter of type ParameterTypeConstant::value
.parameter_type | The parameter type with which a parameter should be found. |
Args | All parameter types to be searched. |
true
iff. Args
contains a parameter of type parameter_type
. Checks if parameter with requested parameter type exists.
parameter_type | The parameter type with which a parameter should be found. |
Tuple | Intended: std::tuple<Args...> containing all types to be searched. |
true
iff. Args
contains a parameter of type parameter_type
.
|
constexpr |
Checks if parameter with requested parameter type exists. Wrapper using the functionality from kamping::internal::has_parameter_type() disassembling a std::tuple passed as parameter.
parameter_type | The parameter type with which a parameter should be found. |
Args | All parameter types to be searched. |
true
iff. Args
contains a parameter of type parameter_type
. Check whether two objects have the same parameter type.
T | First type. |
U | Second type. |
Checks if an integer value can be safely casted into an integer type To, that is, it lies in the range [min(To), max(To)].
This function works only for integer types which have at most std::numeric_limits<intmax_t>::digits (To and From are signed) or std::numeric_limits<intmax_t>::digits (else) bits. This function includes checks for these two assumptions using static_assert()s.
To | Type to be casted to. |
From | Type to be casted from, will be auto inferred. |
value | Value you want to cast. |
true
if value can be safely casted into type To, that is, value is in To's range. false
otherwise. auto & kamping::internal::select_parameter_type | ( | Args &... | args | ) |
Returns parameter with requested parameter type.
"Specialization" for internal::ParameterType.
ParameterTypeConstant | Type and value of the parameter type for which a parameter should be found(required for parameter selection within plugins). |
Args | All parameter types to be searched for type ParameterTypeConstant::value . |
args | All parameters from which a parameter with the correct type is selected. |
auto & kamping::internal::select_parameter_type_in_tuple | ( | std::tuple< Args... > & | tuple | ) |
Returns parameter with requested parameter type.
parameter_type | The parameter type with which a parameter should be found. |
Args | All parameter types to be searched for type parameter_type . |
tuple | std::tuple with containing all parameters from which a parameter with the correct type is selected. |
auto const & kamping::internal::select_parameter_type_in_tuple | ( | std::tuple< Args... > const & | tuple | ) |
Returns parameter with requested parameter type.
parameter_type | The parameter type with which a parameter should be found. |
Args | All parameter types to be searched for type parameter_type . |
tuple | std::tuple with containing all parameters from which a parameter with the correct type is selected. |
decltype(auto) kamping::internal::select_parameter_type_or_default | ( | std::tuple< DefaultArguments... > | default_arguments, |
Args &... | args ) |
Checks if parameter with requested parameter type exists, if not constructs a default value.
"Specialization" for internal::ParameterType.
ParameterTypeConstant | Type and value of the parameter type for which a parameter should be found(required for parameter selection within plugins). |
Args | All parameter types to be searched for parameter type ParameterTypeConstant::value . |
DefaultParameterType | The type of the default parameter to be constructed. |
DefaultArguments | The types of parameters passed to the constructor DefaultParameterType . |
default_arguments | Tuple of the arguments passed to the constructor of DefaultParameterType . |
args | All parameters from which a parameter with the correct type is selected. |
Casts an integer value to the integer type To. If the value is outside To's range, throws an exception.
Alternatively, assertions can be used instead of exceptions by using asserting_cast().
This function works only for integer types which have at most std::numeric_limits<intmax_t>::digits (To and From are signed) or std::numeric_limits<intmax_t>::digits (else) bits. These two assumptions are checked by in_range() using static_assert()s.
To | Type to cast to. |
From | Type to cast from, will be auto inferred. |
value | Value you want to cast. |
|
inlineconstexpr |
Trait for the underlying value of the parameter type of.
Arg. |