2#include "kamping/collectives/alltoall.hpp"
3#include "kamping/collectives/barrier.hpp"
4#include "kamping/collectives/ibarrier.hpp"
5#include "kamping/communicator.hpp"
7#include "kamping/named_parameter_filtering.hpp"
10#include "kamping/p2p/iprobe.hpp"
11#include "kamping/p2p/isend.hpp"
12#include "kamping/p2p/recv.hpp"
13#include "kamping/plugin/plugin_helpers.hpp"
14#include "kamping/request_pool.hpp"
21namespace kamping::plugin {
23namespace sparse_alltoall {
25template <
typename T,
typename Communicator>
42 internal::select_parameter_type_or_default<internal::ParameterType::recv_buf, default_recv_buf_type>(
50 auto&&
recv_type = internal::determine_mpi_recv_datatype<recv_value_type, decltype(recv_buf)>(
args...);
116 template <
typename Arg>
120 std::integral_constant<sparse_alltoall::ParameterType, sparse_alltoall::ParameterType::sparse_send_buf>,
121 std::integral_constant<sparse_alltoall::ParameterType, sparse_alltoall::ParameterType::on_message>,
122 std::integral_constant<kamping::internal::ParameterType, kamping::internal::ParameterType::tag>,
123 std::integral_constant<kamping::internal::ParameterType, kamping::internal::ParameterType::destination>>;
125 return ptypes_to_ignore::contains<ptype_entry>;
139template <
typename Data>
143 std::is_rvalue_reference_v<Data&&> ? BufferOwnership::owning : BufferOwnership::referencing;
146 std::remove_reference_t<Data>,
148 sparse_alltoall::ParameterType::sparse_send_buf,
149 BufferModifiability::constant,
151 BufferType::in_buffer>(std::forward<Data>(data));
156template <
typename Callback>
160 std::is_rvalue_reference_v<Callback&&> ? BufferOwnership::owning : BufferOwnership::referencing;
163 ? BufferModifiability::constant
164 : BufferModifiability::modifiable;
167 std::remove_reference_t<Callback>,
169 sparse_alltoall::ParameterType::on_message,
172 BufferType::in_buffer>(std::forward<Callback>(
cb));
181 template <
typename...
Args>
215template <
typename...
Args>
217 auto&
self = this->to_communicator();
220 std::integral_constant<sparse_alltoall::ParameterType, sparse_alltoall::ParameterType::sparse_send_buf>;
224 using message_type =
typename std::tuple_element_t<1, dst_message_container_type>;
227 ValueTypeWrapper<kamping::internal::has_data_member_v<message_type>,
message_type>::value_type;
237 std::integral_constant<sparse_alltoall::ParameterType, sparse_alltoall::ParameterType::on_message>;
238 auto const&
on_message_cb = kamping::internal::select_parameter_type<on_message_param_type>(
args...);
ParameterType
Parameter types used for the SparseAlltoall plugin.
Definition alltoall_sparse.hpp:100
auto on_message(Callback &&cb)
Generates wrapper for an callback to be called on the probed messages in SparseAlltoall::alltoallv_sp...
Definition alltoall_sparse.hpp:157
auto sparse_send_buf(Data &&data)
Generates buffer wrapper based on the data in the sparse send buffer.
Definition alltoall_sparse.hpp:140
Helper functions that make casts safer.
Wrapper for MPI communicator providing access to rank() and size() of the communicator....
Definition communicator.hpp:49
STL-compatible allocator for requesting memory using the builtin MPI allocator.
Definition allocator.hpp:32
Wrapper for MPI request handles (aka. MPI_Request).
Definition request.hpp:145
Wrapper for MPI_Status.
Definition status.hpp:28
int tag() const
Definition status.hpp:47
int source_signed() const
Definition status.hpp:37
size_t source() const
Definition status.hpp:42
int count_signed(MPI_Datatype data_type) const
Definition status.hpp:54
A more generic version of a DataBuffer which stores an object of type.
Definition data_buffer.hpp:641
Plugin providing a sparse alltoall exchange method.
Definition alltoall_sparse.hpp:179
void alltoallv_sparse(Args... args) const
Sparse alltoall exchange using the NBX algorithm(Hoefler et al., "Scalable communication protocols fo...
Definition alltoall_sparse.hpp:216
Class encapsulating a probed message that is ready to be received in a sparse alltoall exchange.
Definition alltoall_sparse.hpp:26
ProbedMessage(Status &&status, Communicator const &comm)
Constructor of a probed message.
Definition alltoall_sparse.hpp:29
size_t source() const
Returns the source of the probed message.
Definition alltoall_sparse.hpp:90
auto recv(Args... args) const
Actually receive the probed message into a contiguous memory either provided by the user or allocated...
Definition alltoall_sparse.hpp:34
size_t recv_count(MPI_Datatype datatype=MPI_DATATYPE_NULL) const
Computes the size of the probed message depending on the used datatype.
Definition alltoall_sparse.hpp:80
int recv_count_signed(MPI_Datatype datatype=MPI_DATATYPE_NULL) const
Computes the size of the probed message depending on the used datatype.
Definition alltoall_sparse.hpp:72
int source_signed() const
Returns the source of the probed message.
Definition alltoall_sparse.hpp:85
Wrapper for MPI functions that don't require a communicator.
auto status_out()
Constructs a status object internally, which may then be retrieved from kamping::MPIResult returned b...
Definition status_parameters.hpp:43
auto status(internal::ignore_t< void >)
pass MPI_STATUS_IGNORE to the underlying MPI call.
Definition status_parameters.hpp:52
static constexpr auto alloc_new
Convenience wrapper for creating library allocated containers. See AllocNewT for details.
Definition data_buffer.hpp:194
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_count(int count)
Passes count as send count to the underlying call.
Definition named_parameters.hpp:321
auto recv_type_out()
Indicates to deduce the receive type in the underlying call and return it as part of underlying call'...
Definition named_parameters.hpp:1252
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:1028
auto request()
Internally allocate a request object and return it to the user.
Definition named_parameters.hpp:1122
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 recv_count(int count)
Passes count as recv count to the underlying call.
Definition named_parameters.hpp:490
auto recv_type(MPI_Datatype recv_type)
Passes recv_type as recv type to the underlying call.
Definition named_parameters.hpp:1238
auto recv(Args... args) const
Definition recv.hpp:83
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
@ tag
Tag used to represent the message tag in a MPI call.
#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.
Internal namespace marking the code that is not user-facing.
Definition collectives_helpers.hpp:20
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:1017
BufferOwnership
Enum to specify whether a buffer owns its data.
Definition data_buffer.hpp:277
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
BufferModifiability
Enum to specify whether a buffer is modifiable.
Definition data_buffer.hpp:275
Some functions and types simplifying/enabling the development of wrapped MPI calls in KaMPIng.
Helper type for representing a type list.
Definition parameter_objects.hpp:326
Helper class for using CRTP for mixins. Which are used to implement kamping plugins.
Definition plugin_helpers.hpp:32
Predicate to check whether an argument provided to sparse_alltoall shall be discarded in the internal...
Definition alltoall_sparse.hpp:110
static constexpr bool discard()
Function to check whether an argument provided to SparseAlltoall::alltoallv_sparse() shall be discard...
Definition alltoall_sparse.hpp:117