20#include <kassert/kassert.hpp>
23#include "kamping/communicator.hpp"
25#include "kamping/implementation_helpers.hpp"
31#include "kamping/p2p/helpers.hpp"
33#include "kamping/request.hpp"
75 template <
typename...>
76 typename DefaultContainerType,
77 template <
typename,
template <
typename...>
typename>
79template <
typename... Args>
89 internal::select_parameter_type<internal::ParameterType::send_buf>(
args...).construct_buffer_or_rebind();
92 auto&&
send_type = internal::determine_mpi_send_datatype<send_value_type>(
args...);
96 internal::select_parameter_type_or_default<internal::ParameterType::send_count, default_send_count_type>(
100 .construct_buffer_or_rebind();
101 if constexpr (has_to_be_computed<
decltype(
send_count)>) {
105 auto const&
destination = internal::select_parameter_type<internal::ParameterType::destination>(
args...);
106 constexpr auto rank_type = std::remove_reference_t<
decltype(
destination)>::rank_type;
108 rank_type == RankType::value || rank_type == RankType::null,
109 "Please provide an explicit destination or destination(ranks::null)."
113 internal::select_parameter_type_or_default<internal::ParameterType::request, default_request_param>(
120 auto&&
tag_param = internal::select_parameter_type_or_default<internal::ParameterType::tag, default_tag_buf_type>(
121 std::tuple(this->default_tag()),
127 std::remove_reference_t<
decltype(
tag_param)>::tag_type == TagType::value,
128 "Please provide a tag for the message."
139 using send_mode =
typename std::remove_reference_t<send_mode_obj_type>::send_mode;
142 KASSERT(is_valid_rank_in_comm(
destination, *
this,
true,
false),
"Invalid destination rank.");
149 internal::select_parameter_type_in_tuple<internal::ParameterType::send_buf>(*buffers_on_heap).data();
151 if constexpr (std::is_same_v<send_mode, internal::standard_mode_t>) {
158 this->mpi_communicator(),
161 this->mpi_error_hook(
err,
"MPI_Isend");
162 }
else if constexpr (std::is_same_v<send_mode, internal::buffered_mode_t>) {
169 this->mpi_communicator(),
172 this->mpi_error_hook(
err,
"MPI_Ibsend");
173 }
else if constexpr (std::is_same_v<send_mode, internal::synchronous_mode_t>) {
180 this->mpi_communicator(),
183 this->mpi_error_hook(
err,
"MPI_Issend");
184 }
else if constexpr (std::is_same_v<send_mode, internal::ready_mode_t>) {
191 this->mpi_communicator(),
194 this->mpi_error_hook(
err,
"MPI_Irsend");
202 template <
typename...>
204 template <
typename,
template <
typename...>
typename>
206template <
typename...
Args>
208 return this->isend(std::forward<Args>(
args)...,
send_mode(send_modes::buffered));
214 template <
typename...>
216 template <
typename,
template <
typename...>
typename>
218template <
typename...
Args>
220 return this->isend(std::forward<Args>(
args)...,
send_mode(send_modes::synchronous));
226 template <
typename...>
228 template <
typename,
template <
typename...>
typename>
230template <
typename...
Args>
232 return this->isend(std::forward<Args>(
args)...,
send_mode(send_modes::ready));
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
auto tag(internal::any_tag_t)
Indicates to use MPI_ANY_TAG as tag in the underlying call.
Definition named_parameters.hpp:1064
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:999
auto send_mode(SendModeTag)
Passes the send mode parameter for point to point communication to the underlying call....
Definition named_parameters.hpp:1137
auto send_count(int count)
Passes count as send count to the underlying call.
Definition named_parameters.hpp:321
auto request()
Internally allocate a request object and return it to the user.
Definition named_parameters.hpp:1122
auto send_type(MPI_Datatype send_type)
Passes send_type as send type to the underlying call.
Definition named_parameters.hpp:1195
auto send_buf(internal::ignore_t< Data > ignore)
Generates a dummy send buf that wraps a nullptr.
Definition named_parameters.hpp:51
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:347
auto ibsend(Args... args) const
Convenience wrapper for MPI_Ibsend. Calls kamping::Communicator::isend() with the appropriate send mo...
Definition isend.hpp:207
auto issend(Args... args) const
Convenience wrapper for MPI_Issend. Calls kamping::Communicator::isend() with the appropriate send mo...
Definition isend.hpp:219
auto isend(Args... args) const
Definition isend.hpp:80
auto irsend(Args... args) const
Convenience wrapper for MPI_Irsend. Calls kamping::Communicator::isend() with the appropriate send mo...
Definition isend.hpp:231
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
@ send_mode
Tag used to represent the send mode used by a send operation.
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
auto make_nonblocking_result(RequestDataBuffer &&request, std::unique_ptr< std::tuple< Buffers... > > buffers_on_heap)
Factory for creating a kamping::NonBlockingResult.
Definition result.hpp:1308
Parameter objects return by named parameter factory functions.
Some functions and types simplifying/enabling the development of wrapped MPI calls in KaMPIng.
Parameter object for send_mode encapsulating the send mode compile-time tag.
Definition parameter_objects.hpp:478