18#include <kassert/kassert.hpp>
21#include "kamping/assertion_levels.hpp"
23#include "kamping/collectives/collectives_helpers.hpp"
24#include "kamping/comm_helper/is_same_on_all_ranks.hpp"
25#include "kamping/communicator.hpp"
70 template <
typename...>
71 typename DefaultContainerType,
72 template <
typename,
template <
typename...>
typename>
74template <
typename recv_value_type_tparam ,
typename... Args>
85 std::tuple(this->
root()),
90 is_same_on_all_ranks(
root.rank_signed()),
91 "root() parameter must be the same on all ranks.",
98 internal::select_parameter_type_or_default<internal::ParameterType::send_recv_buf, default_send_recv_buf_type>(
107 if (this->is_root(
root.rank_signed())) {
114 !std::is_same_v<value_type, internal::unused_tparam>,
115 "No send_recv_buf parameter provided and no receive value given as template parameter. One of these is "
126 "send_recv_buf must be modifiable on all non-root ranks.",
132 auto&&
count_param = internal::select_parameter_type_or_default<ParameterType::send_recv_count, default_count_type>(
136 .construct_buffer_or_rebind();
141 "send_recv_count() parameter is either deduced on all ranks or must be explicitly provided on all ranks.",
147 if (this->is_root(
root.rank_signed())) {
166 this->mpi_communicator()
168 this->mpi_error_hook(
err,
"MPI_Bcast");
180 "send_recv_buf must be provided on the root rank.",
187 if (!this->is_root(
root.rank_signed())) {
196 "send/receive buffer is not large enough to hold all received elements on a non-root rank.",
207 this->mpi_communicator()
209 this->mpi_error_hook(
err,
"MPI_Bcast");
211 return make_mpi_result<std::tuple<
Args...>>(
241 template <
typename...>
243 template <
typename,
template <
typename...>
typename>
256 std::tuple(this->
root()),
264 this->mpi_error_hook(
err,
"MPI_Bcast");
268 if constexpr (has_parameter_type<ParameterType::send_recv_buf,
Args...>()) {
271 send_recv_buf_type::is_single_element,
272 "The underlying container has to be a single element \"container\""
Helper functions that make casts safer.
STL-compatible allocator for requesting memory using the builtin MPI allocator.
Definition allocator.hpp:32
T value_type
The value type.
Definition allocator.hpp:53
constexpr int light
Assertion level for lightweight assertions.
Definition assertion_levels.hpp:13
constexpr int light_communication
Assertions that perform lightweight communication.
Definition assertion_levels.hpp:25
auto bcast(Args... args) const
Wrapper for MPI_Bcast.
Definition bcast.hpp:75
auto bcast_single(Args... args) const
Wrapper for MPI_Bcast.
Definition bcast.hpp:246
MPI_Datatype mpi_datatype() KAMPING_NOEXCEPT
Translate template parameter T to an MPI_Datatype. If no corresponding MPI_Datatype exists,...
Definition mpi_datatype.hpp:294
static constexpr auto alloc_new
Convenience wrapper for creating library allocated containers. See AllocNewT for details.
Definition data_buffer.hpp:194
auto root(int rank)
Passes rank as root rank to the underlying call. This parameter is needed in functions like MPI_Gathe...
Definition named_parameters.hpp:979
auto send_recv_buf(Data &&data)
Passes a container/single value as a send or receive buffer to the underlying MPI call.
Definition named_parameters.hpp:137
auto send_recv_count(int count)
Passes count as send/recv count to the underlying call.
Definition named_parameters.hpp:529
auto send_recv_type(MPI_Datatype send_recv_type)
Passes send_recv_type as send/recv type to the underlying call. (This parameter is in MPI routines su...
Definition named_parameters.hpp:1282
auto send_recv_count_out()
Indicates to deduce the send/recv count and return it to the caller as part of the underlying call's ...
Definition named_parameters.hpp:555
std:: tuple_element_t< find_pos< std::integral_constant< ParameterType, parameter_type >, 0, Args... >(), std::tuple< Args... > > buffer_type_with_requested_parameter_type
Type of Buffer with requested.
Definition named_parameter_selection.hpp:176
Utility that maps C++ types to types that can be understood by MPI.
Template magic to check named parameters passed to wrappers at compile time.
#define KAMPING_REQUIRED_PARAMETERS(...)
Wrapper to pass (possibly empty) list of parameter type names as required parameters to KAMPING_CHECK...
Definition named_parameter_check.hpp:52
#define KAMPING_OPTIONAL_PARAMETERS(...)
Wrapper to pass (possibly empty) list of parameter type names as optional parameters to KAMPING_CHECK...
Definition named_parameter_check.hpp:58
#define KAMPING_CHECK_PARAMETERS(args, required, optional)
Assertion macro that checks if passed parameters are correct, i.e., all parameter types are unique,...
Definition named_parameter_check.hpp:80
Template magic to implement named parameters in cpp.
File containing the parameter types used by the KaMPIng library.
Factory methods for buffer wrappers.
Internal namespace marking the code that is not user-facing.
Definition collectives_helpers.hpp:20
static constexpr bool buffer_uses_serialization
Checks if DataBufferType is a serialization buffer.
Definition named_parameter_check.hpp:415
Some functions and types simplifying/enabling the development of wrapped MPI calls in KaMPIng.