16#include <kassert/kassert.hpp>
19#include "kamping/assertion_levels.hpp"
21#include "kamping/collectives/collectives_helpers.hpp"
22#include "kamping/comm_helper/is_same_on_all_ranks.hpp"
23#include "kamping/communicator.hpp"
79 template <
typename...>
80 typename DefaultContainerType,
81 template <
typename,
template <
typename...>
typename>
83template <
typename... Args>
88 return exscan_inplace(std::forward<Args>(
args)...);
100 is_same_on_all_ranks(
send_buf.size()),
101 "The send buffer has to be the same size on all ranks.",
122 .construct_buffer_or_rebind();
131 "The send_recv_count has to be the same on all ranks.",
148 "Recv buffer is not large enough to hold all received elements.",
161 this->mpi_error_hook(
err,
"MPI_Exscan");
181 "on_rank_0 has to either be of size 1 or of the same size as the recv_buf.",
193 }
else if constexpr (
operation.is_builtin) {
202 return make_mpi_result<std::tuple<
Args...>>(
242 template <
typename...>
244 template <
typename,
template <
typename...>
typename>
246template <
typename...
Args>
257 using value_type =
typename std::remove_reference_t<
decltype(
send_recv_buf)>::value_type;
266 internal::select_parameter_type_or_default<internal::ParameterType::send_recv_count, default_count_type>(
270 .construct_buffer_or_rebind();
278 is_same_on_all_ranks(count.get_single_element()),
279 "The send_recv_count has to be the same on all ranks.",
295 "Send/Recv buffer is not large enough to hold all received elements.",
303 count.get_single_element(),
304 type.get_single_element(),
308 this->mpi_error_hook(
err,
"MPI_Exscan");
328 "on_rank_0 has to either be of size 1 or of the same size as the recv_buf.",
340 }
else if constexpr (
operation.is_builtin) {
345 return make_mpi_result<std::tuple<
Args...>>(std::move(
send_recv_buf), std::move(count), std::move(type));
372 template <
typename...>
374 template <
typename,
template <
typename...>
typename>
376template <
typename...
Args>
393 send_buf_type::is_single_element,
394 "The underlying container has to be a single element \"container\""
396 using value_type =
typename send_buf_type::value_type;
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 exscan_inplace(Args... args) const
Wrapper for the in-place version of Communicator::exscan().
Definition exscan.hpp:247
auto exscan_single(Args... args) const
Wrapper for MPI_exscan for single elements.
Definition exscan.hpp:377
auto exscan(Args... args) const
Wrapper for MPI_Exscan.
Definition exscan.hpp:84
static constexpr auto alloc_new
Convenience wrapper for creating library allocated containers. See AllocNewT for details.
Definition data_buffer.hpp:194
auto values_on_rank_0(Container &&container)
Passes a container containing the value(s) to return on the first rank to kamping::Communicator::exsc...
Definition named_parameters.hpp:1167
internal::OperationBuilder< Op, Commutative > op(Op &&op, Commutative commute=ops::internal::undefined_commutative_tag{})
Passes a reduction operation to ther underlying call. Accepts function objects, lambdas,...
Definition named_parameters.hpp:1155
auto recv_buf(Container &&container)
Passes a container, into which the received elements will be written, to the underlying call....
Definition named_parameters.hpp:859
auto send_buf(internal::ignore_t< Data > ignore)
Generates a dummy send buf that wraps a nullptr.
Definition named_parameters.hpp:51
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
decltype(auto) 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.
Definition named_parameter_selection.hpp:239
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
constexpr bool has_parameter_type()
Checks if parameter with requested parameter type exists.
Definition named_parameter_selection.hpp:186
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 has_to_be_computed
Checks if the buffer has to be computed by kamping, i.e. if it is an output parameter or the buffer h...
Definition named_parameter_check.hpp:398
Some functions and types simplifying/enabling the development of wrapped MPI calls in KaMPIng.