27#include "kamping/serialization.hpp"
28#include "kamping/status.hpp"
59 template <
typename Data_>
81 using Data_no_ref = std::remove_const_t<std::remove_reference_t<Data>>;
82 static constexpr bool support_serialization = std::is_same_v<Flag, internal::serialization_support_tag>;
85 "\n ---> Serialization buffers are not supported here."
100 DataBufferType::is_out_buffer;
103 DataBufferType::is_owning;
105 DataBufferType::is_lib_allocated;
107 DataBufferType::is_single_element;
182 "RebindContainerType is required."
196 DataBufferType::is_out_buffer;
199 DataBufferType::is_owning;
201 DataBufferType::is_lib_allocated;
203 DataBufferType::is_single_element;
223 typename ValueType = default_value_type_tag,
227 std::forward<Data>(data)
241 if constexpr (std::is_same_v<Data, bool>) {
242 return std::vector<kabool>(data.begin(), data.end());
248 return std::vector<Data>{data};
262 typename ValueType = default_value_type_tag,
280 typename ValueType = default_value_type_tag,
281 template <
typename...>
312template <
typename ValueType, ParameterType parameter_type, BufferType buffer_type>
317 BufferModifiability::constant,
325template <
typename...
Args>
329 template <
typename T>
357template <RankType rank_type, ParameterType parameter_type>
369template <ParameterType type>
374 BufferModifiability::modifiable,
375 BufferOwnership::owning,
376 BufferType::in_buffer,
377 BufferResizePolicy::no_resize,
378 BufferAllocation::user_allocated> {
384 BufferModifiability::modifiable,
385 BufferOwnership::owning,
386 BufferType::in_buffer,
388 BufferAllocation::user_allocated>;
412 return {BaseClass::underlying()};
421template <ParameterType type>
446template <ParameterType type>
477template <
typename SendModeTag>
479 static_assert(send_mode_list::contains<SendModeTag>,
"Unsupported send mode.");
488template <
typename StatusParam>
492 if constexpr (StatusParam::buffer_type == BufferType::ignore) {
494 }
else if constexpr (std::is_same_v<typename StatusParam::value_type, MPI_Status>) {
498 return &
param.underlying().native();
512template <TagType tag_type>
561namespace send_modes {
569template <
typename T =
void>
Helper functions that make casts safer.
STL-compatible allocator for requesting memory using the builtin MPI allocator.
Definition allocator.hpp:32
Class optionally containing a copy constructor while supporting move assignment/construction.
Definition data_buffer.hpp:85
Data buffer used for named parameters.
Definition data_buffer.hpp:371
Empty buffer that can be used as default argument for optional buffer parameters.
Definition data_buffer.hpp:722
RankDataBuffer< rank_type, parameter_type > clone()
Get a copy of this RankDataBuffer.
Definition parameter_objects.hpp:436
int rank_signed() const
Returns the rank as int.
Definition parameter_objects.hpp:429
RankDataBuffer< rank_type, parameter_type > clone()
Get a copy of this RankDataBuffer.
Definition parameter_objects.hpp:461
int rank_signed() const
Returns the rank as int.
Definition parameter_objects.hpp:454
RankDataBuffer(int rank)
Constructor for Rank.
Definition parameter_objects.hpp:400
RankDataBuffer< rank_type, parameter_type > clone()
Get a copy of this RankDataBuffer.
Definition parameter_objects.hpp:411
int rank_signed() const
Returns the rank as int.
Definition parameter_objects.hpp:404
RankDataBuffer(size_t rank)
Constructor for Rank.
Definition parameter_objects.hpp:396
Encapsulates the rank of a PE. This is needed for p2p communication and rooted MPI collectives like M...
Definition parameter_objects.hpp:358
TagParam< tag_type > clone()
Get a copy of this TagParam.
Definition parameter_objects.hpp:553
int tag() const
Definition parameter_objects.hpp:546
TagParam(int tag)
Definition parameter_objects.hpp:520
int tag() const
Definition parameter_objects.hpp:524
TagParam< tag_type > clone()
Get a copy of this TagParam.
Definition parameter_objects.hpp:531
Encapsulates a message tag.
Definition parameter_objects.hpp:513
BufferResizePolicy
Enum to specify in which cases a buffer is resized.
Definition data_buffer.hpp:291
constexpr BufferResizePolicy no_resize
Definition data_buffer.hpp:299
@ no_resize
Policy indicating that the underlying buffer shall never be resized.
ParameterType
Each input parameter to one of the MPI calls wrapped by KaMPIng needs to has one of the following tag...
Definition named_parameter_types.hpp:33
constexpr To asserting_cast(From value) KAMPING_NOEXCEPT
Casts an integer value to the integer type To. If the value is outside To's range,...
Definition checking_casts.hpp:116
@ send_mode
Tag used to represent the send mode used by a send operation.
@ status
Tag used to represent the status in a MPI call.
@ tag
Tag used to represent the message tag in a MPI call.
File containing the parameter types used by the KaMPIng library.
Internal namespace marking the code that is not user-facing.
Definition collectives_helpers.hpp:20
TagType
Possible types of tag.
Definition parameter_objects.hpp:505
@ any
special value MPI_ANY_TAG}
@ value
holds an actual value
auto make_empty_data_buffer_builder()
Factory method for constructing an DataBufferBuilder for an EmptyDataBuffer.
Definition parameter_objects.hpp:313
RankType
Indicator if a rank parameter holds and actual value or MPI_ANY_SOURCE or MPI_PROC_NULL.
Definition parameter_objects.hpp:339
@ any
holds MPI_ANY_SOURCE
@ null
holds MPI_PROC_NULL
auto make_data_buffer_builder(Data &&data)
Factory method for constructing a DataBufferBuilder from the given Container Data.
Definition parameter_objects.hpp:225
BufferModifiability
Enum to specify whether a buffer is modifiable.
Definition data_buffer.hpp:275
auto make_data_buffer(Data &&data)
Creates a user allocated DataBuffer containing the supplied data (a container or a single element)
Definition data_buffer.hpp:798
BufferType
Enum to specify whether a buffer is an in buffer of an out buffer. Out buffer will be used to directl...
Definition data_buffer.hpp:287
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
static constexpr internal::buffered_mode_t buffered
global constant for buffered send mode
Definition parameter_objects.hpp:563
static constexpr internal::any_tag_t any
global constant for any tag
Definition parameter_objects.hpp:573
static constexpr internal::synchronous_mode_t synchronous
global constant for synchronous send mode
Definition parameter_objects.hpp:564
static constexpr internal::rank_null_t null
global constant for rank NULL
Definition parameter_objects.hpp:578
static constexpr internal::standard_mode_t standard
global constant for standard send mode
Definition parameter_objects.hpp:562
constexpr internal::ignore_t< T > ignore
Tag for parameters that can be omitted on some PEs (e.g., root PE, or non-root PEs).
Definition parameter_objects.hpp:570
static constexpr internal::ready_mode_t ready
global constant for ready send mode
Definition parameter_objects.hpp:565
Parameter object representing a data buffer to be allocated by KaMPIng. This is a specialization of D...
Definition parameter_objects.hpp:136
auto construct_buffer_or_rebind()
Constructs the data buffer.
Definition parameter_objects.hpp:162
size_t size() const
The size of the underlying container.
Definition parameter_objects.hpp:207
static constexpr bool is_owning
Indicates whether the buffer owns its underlying storage.
Definition parameter_objects.hpp:198
static constexpr ParameterType parameter_type
The parameter type.
Definition parameter_objects.hpp:137
static constexpr bool is_out_buffer
Definition parameter_objects.hpp:195
decltype(make_data_buffer< ParameterType, parameter_type, modifiability, buffer_type, buffer_resize_policy, ValueType >( std::conditional_t< is_alloc_container_of_v< AllocType >, AllocNewT< std::vector< ValueType > >, AllocType >{})) DataBufferType
The type of the constructed data buffer (potentially rebinded to std::vector).
Definition parameter_objects.hpp:139
static constexpr bool is_lib_allocated
Indicates whether the buffer is allocated by KaMPIng.
Definition parameter_objects.hpp:200
typename DataBufferType::value_type value_type
The constructed data buffer's value type.
Definition parameter_objects.hpp:204
static constexpr bool is_single_element
Indicated whether the buffer is a single element buffer.
Definition parameter_objects.hpp:202
Parameter object representing a data buffer. This is an intermediate object which only holds the data...
Definition parameter_objects.hpp:53
static constexpr ParameterType parameter_type
The parameter type.
Definition parameter_objects.hpp:54
DataBufferBuilder(Data_ &&data)
Constructor for DataBufferBuilder.
Definition parameter_objects.hpp:60
size_t size() const
The size of the underlying container.
Definition parameter_objects.hpp:111
static constexpr bool is_owning
Indicates whether the buffer owns its underlying storage.
Definition parameter_objects.hpp:102
static constexpr bool is_lib_allocated
Indicates whether the buffer is allocated by KaMPIng.
Definition parameter_objects.hpp:104
typename DataBufferType::value_type value_type
The constructed data buffer's value type.
Definition parameter_objects.hpp:108
static constexpr bool is_out_buffer
Definition parameter_objects.hpp:99
static constexpr bool is_single_element
Indicated whether the buffer is a single element buffer.
Definition parameter_objects.hpp:106
decltype(make_data_buffer< ParameterType, parameter_type, modifiability, buffer_type, buffer_resize_policy, ValueType >(std::forward< Data >(data_))) DataBufferType
The type of the constructed data buffer.
Definition parameter_objects.hpp:66
auto construct_buffer_or_rebind()
Constructs the data buffer.
Definition parameter_objects.hpp:80
Parameter object for send_mode encapsulating the send mode compile-time tag.
Definition parameter_objects.hpp:478
static constexpr ParameterType parameter_type
The parameter type.
Definition parameter_objects.hpp:480
Dummy template for representing the absence of a container to rebind to.
Definition parameter_objects.hpp:35
tag struct for message tag
Definition parameter_objects.hpp:502
tag for buffered send mode
Definition parameter_objects.hpp:469
tag type to indicate that the value_type should be inferred from the container
Definition data_buffer.hpp:320
Tag type for parameters that can be omitted on some PEs (e.g., root PE, or non-root PEs).
Definition parameter_objects.hpp:336
tag struct for MPI_ANY_SOURCE
Definition parameter_objects.hpp:345
tag struct for MPI_PROC_NULL
Definition parameter_objects.hpp:346
tag for ready send mode
Definition parameter_objects.hpp:471
tag for standard send mode
Definition parameter_objects.hpp:468
tag for synchronous send mode
Definition parameter_objects.hpp:470
Helper type for representing a type list.
Definition parameter_objects.hpp:326
static constexpr bool contains
Member attribute to check if a type is contained in the list.
Definition parameter_objects.hpp:330