21#include <kassert/kassert.hpp>
24#include "kamping/communicator.hpp"
26#include "kamping/implementation_helpers.hpp"
31#include "kamping/p2p/helpers.hpp"
32#include "kamping/p2p/probe.hpp"
35#include "kamping/status.hpp"
89 template <
typename...>
90 typename DefaultContainerType,
91 template <
typename,
template <
typename...>
typename>
93template <
typename recv_value_type_tparam ,
typename... Args>
112 auto send_buf = internal::select_parameter_type<internal::ParameterType::send_buf>(
args...)
117 internal::select_parameter_type_or_default<internal::ParameterType::send_count, default_send_count_type>(
121 .construct_buffer_or_rebind();
122 if constexpr (has_to_be_computed<
decltype(
send_count)>) {
127 auto send_type = internal::determine_mpi_send_datatype<send_value_type>(
args...);
129 auto const&
destination = internal::select_parameter_type<internal::ParameterType::destination>(
args...);
130 constexpr auto rank_type = std::remove_reference_t<
decltype(
destination)>::rank_type;
132 rank_type == RankType::value || rank_type == RankType::null,
133 "Please provide an explicit destination or destination(ranks::null)."
138 internal::select_parameter_type_or_default<internal::ParameterType::send_tag, default_send_tag_type>(
139 std::tuple(this->default_tag()),
145 std::remove_reference_t<
decltype(
send_tag_param)>::tag_type == TagType::value,
146 "Please provide a send tag for the message."
156 internal::select_parameter_type_or_default<internal::ParameterType::recv_buf, default_recv_buf_type>(
164 internal::select_parameter_type_or_default<internal::ParameterType::recv_count, default_recv_count_type>(
168 .construct_buffer_or_rebind();
172 !std::is_same_v<recv_value_type, internal::unused_tparam>,
173 "No recv_buf parameter provided and no receive value given as template parameter. One of these is required."
175 auto recv_type = internal::determine_mpi_recv_datatype<recv_value_type, decltype(recv_buf)>(
args...);
180 internal::select_parameter_type_or_default<internal::ParameterType::recv_tag, default_recv_tag_type>(
184 constexpr auto tag_type = std::remove_reference_t<
decltype(
recv_tag_param)>::tag_type;
195 internal::select_parameter_type_or_default<internal::ParameterType::status, default_status_param_type>(
199 .construct_buffer_or_rebind();
203 internal::select_parameter_type_or_default<internal::ParameterType::source, default_source_buf_type>(
235 "Recv buffer is not large enough to hold all received elements.",
251 this->mpi_communicator(),
254 this->mpi_error_hook(
err,
"MPI_Sendrecv");
Wrapper for MPI functions that don't require a communicator. If the template parameter init_finalize_...
Definition environment.hpp:52
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
auto status(internal::ignore_t< void >)
pass MPI_STATUS_IGNORE to the underlying MPI call.
Definition status_parameters.hpp:54
static constexpr auto alloc_new
Convenience wrapper for creating library allocated containers. See AllocNewT for details.
Definition data_buffer.hpp:194
auto send_tag(internal::any_tag_t)
Indicates to use MPI_ANY_TAG as send tag in the underlying call.
Definition named_parameters.hpp:1097
auto source(int rank)
Passes rank as source rank to the underlying call. This parameter is needed in point-to-point exchang...
Definition named_parameters.hpp:1030
auto send_count(int count)
Passes count as send count to the underlying call.
Definition named_parameters.hpp:323
auto recv_count(int count)
Passes count as recv count to the underlying call.
Definition named_parameters.hpp:492
auto destination(int rank)
Passes rank as destination rank to the underlying call. This parameter is needed in point-to-point ex...
Definition named_parameters.hpp:1001
auto recv_buf(Container &&container)
Passes a container, into which the received elements will be written, to the underlying call....
Definition named_parameters.hpp:861
auto recv_type(MPI_Datatype recv_type)
Passes recv_type as recv type to the underlying call.
Definition named_parameters.hpp:1302
auto send_type(MPI_Datatype send_type)
Passes send_type as send type to the underlying call.
Definition named_parameters.hpp:1259
auto send_count_out()
Indicates to deduce the send count and return it to the caller as part of the underlying call's resul...
Definition named_parameters.hpp:349
auto recv_count_out()
Indicates to deduce the recv count and return it to the caller as part of the underlying call's resul...
Definition named_parameters.hpp:518
auto recv_tag(internal::any_tag_t)
Indicates to use MPI_ANY_TAG as recv tag in the underlying call.
Definition named_parameters.hpp:1128
auto send_buf(internal::ignore_t< Data > ignore)
Generates a dummy send buf that wraps a nullptr.
Definition named_parameters.hpp:53
auto sendrecv(Args... args) const
Definition sendrecv.hpp:94
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
@ value
holds an actual value
@ null
holds MPI_PROC_NULL
constexpr bool is_valid_rank_in_comm(RankDataBufferClass const &rank_data_buffer, Comm const &comm, bool const allow_null=false, bool const allow_any=false)
Checks whether a RankDataBuffer contains a valid rank in the given communicator.
Definition implementation_helpers.hpp:30
auto make_mpi_result(Buffers &&... buffers)
Construct result object for a wrapped MPI call. Four different cases are handled: a) The recv_buffer ...
Definition result.hpp:1019
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
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
Parameter objects return by named parameter factory functions.
Some functions and types simplifying/enabling the development of wrapped MPI calls in KaMPIng.