KaMPIng 0.1.0
(Near) zero-overhead C++ MPI bindings.
Loading...
Searching...
No Matches
named_parameters.hpp
Go to the documentation of this file.
1// This file is part of KaMPIng.
2//
3// Copyright 2021-2024 The KaMPIng Authors
4//
5// KaMPIng is free software : you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
7// version. KaMPIng is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
8// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
9// for more details.
10//
11// You should have received a copy of the GNU Lesser General Public License along with KaMPIng. If not, see
12// <https://www.gnu.org/licenses/>.
13/// @file
14/// @brief Factory methods for buffer wrappers
15
16#pragma once
17
18#include <cstddef>
19#include <initializer_list>
20#include <type_traits>
21#include <utility>
22
24#include "kamping/mpi_ops.hpp"
26#include "kamping/named_parameters_detail/status_parameters.hpp"
29#include "kamping/request.hpp"
30#include "kamping/serialization.hpp"
31
32namespace kamping {
33
34namespace internal {
35/// @brief An unused template parameter
36struct unused_tparam {};
37} // namespace internal
38
39//// @addtogroup kamping_named_parameters
40/// @{
41
42/// @brief Generates a dummy send buf that wraps a \c nullptr.
43///
44/// This is useful for operations where a send_buf is required on some PEs, such as the root PE,
45/// but not all PEs that participate in the collective communication.
46///
47/// @tparam Data Data type for elements in the send buffer. This must be the same type as in the actual send_buf.
48/// @param ignore Tag parameter for overload dispatching, pass in `kamping::ignore<Data>`.
49/// @return Object wrapping a \c nullptr as a send buffer.
50template <typename Data>
52 return internal::
53 make_empty_data_buffer_builder<Data, internal::ParameterType::send_buf, internal::BufferType::ignore>();
54}
55
56/// @brief Passes a container/single value as a send buffer to the underlying MPI call.
57///
58/// If data provides \c data(), it is assumed that it is a container and all elements in the
59/// container are considered for the operation. In this case, the container has to provide a \c size() member functions
60/// and expose the contained \c value_type. If no \c data() member function exists, a single value is assumed
61/// @tparam Data Data type representing the element(s) to send.
62/// @param data Data (either a container which contains the elements or the element directly) to send
63/// @return Parameter object referring to the storage containing the data elements to send.
64/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
65template <typename Data, typename Enable = std::enable_if_t<!internal::is_serialization_buffer_v<Data>>>
66auto send_buf(Data&& data) {
69 internal::BufferModifiability::constant,
70 internal::BufferType::in_buffer,
71 BufferResizePolicy::no_resize>(std::forward<Data>(data));
72}
73
74/// @brief Passes a container/single value as a send buffer to the underlying MPI call. Additionally indicates to use
75/// serialization to transfer the data.
76/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
77template <
78 typename SerializationBufferType,
79 std::enable_if_t<internal::is_serialization_buffer_v<SerializationBufferType>, bool> = true>
83 internal::BufferModifiability::modifiable,
84 internal::BufferType::in_buffer,
85 BufferResizePolicy::no_resize>(std::forward<SerializationBufferType>(data));
86}
87
88/// @brief Passes the data provided as an initializer list as a send buffer to the underlying MPI call.
89///
90/// @tparam T The type of the elements in the initializer list.
91/// @param data An initializer list of the data elements.
92/// @return Parameter object referring to the storage containing the data elements to send.
93/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
94template <typename T>
95auto send_buf(std::initializer_list<T> data) {
98 internal::BufferModifiability::constant,
99 internal::BufferType::in_buffer,
100 BufferResizePolicy::no_resize>(std::move(data));
101}
102
103/// @brief Passes a container/single value as rvalue as a send buffer to the underlying MPI call.
104/// This transfers ownership of the data to the call and re-returns ownership to the caller as part of the result
105/// object.
106///
107/// If data provides \c data(), it is assumed that it is a container and all elements in the
108/// container are considered for the operation. In this case, the container has to provide a \c size() member functions
109/// and expose the contained \c value_type. If no \c data() member function exists, a single value is assumed
110/// @tparam Data Data type representing the element(s) to send.
111/// @param data Data (either a container which contains the elements or the element directly) to send
112/// @return Parameter object referring to the storage containing the data elements to send.
113/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
114template <typename Data, typename Enable = std::enable_if_t<std::is_rvalue_reference_v<Data&&>>>
115auto send_buf_out(Data&& data) {
118 internal::BufferModifiability::constant,
119 internal::BufferType::in_out_buffer,
120 BufferResizePolicy::no_resize>(std::forward<Data>(data));
121}
122
123/// @brief Passes a container/single value as a send or receive buffer to the underlying MPI call.
124///
125/// @tparam resize_policy Policy specifying whether (and if so, how) the underlying container shall be resized. If
126/// omitted, the resize policy is BufferResizePolicy::no_resize, indicating that the container should not be resized by
127/// kamping.
128/// @tparam Data Data type representing the element(s) to send/receive.
129/// @param data Data (either a container which contains the elements or the element directly) to send or the buffer to
130/// receive into.
131/// @return Parameter object referring to the storage containing the data elements to send or receive.
132/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
133template <
135 typename Data,
136 typename Enable = std::enable_if_t<!internal::is_serialization_buffer_v<Data>>>
137auto send_recv_buf(Data&& data) {
138 constexpr internal::BufferModifiability modifiability = std::is_const_v<std::remove_reference_t<Data>>
139 ? internal::BufferModifiability::constant
140 : internal::BufferModifiability::modifiable;
144 internal::BufferType::in_out_buffer,
145 resize_policy>(std::forward<Data>(data));
146}
147
148/// @brief Passes a container/single value as a send or receive buffer to the underlying MPI call. Additionally
149/// indicates to use serialization to transfer the data.
150/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
151template <
152 typename SerializationBufferType,
153 typename Enable = std::enable_if_t<internal::is_serialization_buffer_v<SerializationBufferType>>>
156 std::is_const_v<std::remove_reference_t<SerializationBufferType>> ? internal::BufferModifiability::constant
157 : internal::BufferModifiability::modifiable;
161 internal::BufferType::in_out_buffer,
162 BufferResizePolicy::resize_to_fit>(std::forward<SerializationBufferType>(buffer));
163}
164
165/// @brief Indicates to use an object of type \tparam Container as `send_recv_buf`.
166/// Container must provide \c data(), \c size(), \c resize(unsigned int) member functions and expose the contained \c
167/// value_type.
168/// @return Parameter object referring to the storage containing the data elements to send or receive.
169template <typename Container>
173 internal::BufferModifiability::modifiable,
174 internal::BufferType::in_out_buffer,
176}
177
178/// @brief Indicates to use a parameter object encapsulating an underlying container with a \c value_type \tparam
179/// ValueType as `send_recv_buf`. The type of the underlying container is determined by the MPI operation and usually
180/// defaults to \ref Communicator::default_container_type.
181/// @tparam ValueType The type of the elements in the buffer.
182/// @return Parameter object referring to the storage containing the data elements to send or receive.
183/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
184template <typename ValueType>
188 internal::BufferModifiability::modifiable,
189 internal::BufferType::in_out_buffer,
191}
192
193/// @brief Passes a container as send counts to the underlying call, i.e. the container's storage must
194/// contain the send count to each relevant PE.
195///
196/// The underlying container must provide \c data() and \c size() member functions and expose the contained \c
197/// value_type.
198/// @tparam Container Container type which contains the send counts.
199/// @param container Container which contains the send counts.
200/// @return Parameter object referring to the storage containing the send counts.
201/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
202template <typename Container>
206 internal::BufferModifiability::constant,
207 internal::BufferType::in_buffer,
209 int>(std::forward<Container>(container));
210}
211
212/// @brief Passes the initializer list as send counts to the underlying call.
213///
214/// @tparam Type The type of the initializer list.
215/// @param counts The send counts.
216/// @return Parameter object referring to the storage containing the send counts.
217/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
218template <typename T>
219auto send_counts(std::initializer_list<T> counts) {
222 internal::BufferModifiability::constant,
223 internal::BufferType::in_buffer,
225 int>(std::move(counts));
226}
227
228/// @brief Passes a \p container, into which the send counts deduced by KaMPIng will be written, to the underlying call.
229/// \p Container must satisfy the following constraints:
230/// - provide a \c data() member function
231/// - provide a \c size() member function
232/// - expose \c value_type (which must be int).
233/// - if \p resize_policy is not BufferResizePolicy::no_resize, \p container additionally has to expose a
234/// `resize(unsigned int)` member function.
235///
236/// The send counts container will be returned as part of the underlying call's result object if it is moved/passed by
237/// value (e.g. `send_counts_out(std::move(container))`).
238///
239/// @tparam resize_policy Policy specifying whether (and if so, how) the underlying buffer shall be resized. The default
240/// resize policy is BufferResizePolicy::no_resize, indicating that the buffer should not be resized by KaMPIng.
241/// @tparam Container Container type which will contain the send counts.
242/// @param container Container which will contain the send counts.
243/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
244template <BufferResizePolicy resize_policy = BufferResizePolicy::no_resize, typename Container>
248 internal::BufferModifiability::modifiable,
249 internal::BufferType::out_buffer,
250 resize_policy,
251 int>(std::forward<Container>(container));
252}
253
254/// @brief Indicates to construct an object of type \p Container, into which the send counts deduced by KaMPIng will be
255/// written, in the underlying call.
256/// \p Container must satisfy the following constraints:
257/// - provide a \c data() member function
258/// - provide a \c size() member function
259/// - provide a \c resize(unsigned int) member function
260/// - expose \c value_type (which must be int).
261///
262/// The send counts container will be returned as part of the underlying call's result object.
263///
264/// @tparam Container Container type which will contains the send counts.
265/// @return Parameter object referring to the storage which will contain the send counts.
266/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
267template <typename Container>
271 internal::BufferModifiability::modifiable,
272 internal::BufferType::out_buffer,
275}
276
277/// @brief Indicates to construct a container with type \p Container<int>, into which the send counts deduced by KaMPIng
278/// will be written, in the underlying call.
279///
280/// \p Container<int> must satisfy the following constraints:
281/// - provide a \c data() member function
282/// - provide a \c size() member function
283/// - provide a \c resize(unsigned int) member function
284/// - expose \c value_type.
285///
286/// The send counts container will be returned as part of the underlying call's result object.
287///
288/// @tparam Container Container type which will contains the send counts.
289/// @return Parameter object referring to the storage which will contain the send counts.
290/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
291template <template <typename...> typename Container>
295 internal::BufferModifiability::modifiable,
296 internal::BufferType::out_buffer,
299}
300
301/// @brief Indicates to construct a container with type \ref kamping::Communicator::default_container_type<int>, into
302/// which the send counts deduced by KaMPIng will be written, in the underlying call.
303///
304/// The send counts container will be returned as part of the underlying call's result object.
305///
306/// @tparam Container Container type which will contains the send counts.
307/// @return Parameter object referring to the storage which will contain the send counts.
308/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
309inline auto send_counts_out() {
312 internal::BufferModifiability::modifiable,
313 internal::BufferType::out_buffer,
315}
316
317/// @brief Passes \p count as send count to the underlying call.
318/// @param count The send count.
319/// @return The corresponding parameter object.
320/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
321inline auto send_count(int count) {
324 internal::BufferModifiability::constant,
325 internal::BufferType::in_buffer,
327 int>(std::move(count));
328}
329
330/// @brief Passes \p count, into which the send count deduced by KaMPIng will be written, to the underlying call.
331/// @param count Reference to the location at which the send count will be stored.
332/// @return The corresponding parameter object.
333/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
334inline auto send_count_out(int& count) {
337 internal::BufferModifiability::modifiable,
338 internal::BufferType::out_buffer,
340 int>(count);
341}
342
343/// @brief Indicates to deduce the send count and return it to the caller as part of the underlying call's result
344/// object.
345/// @return The corresponding parameter object.
346/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
347inline auto send_count_out() {
350 internal::BufferModifiability::modifiable,
351 internal::BufferType::out_buffer,
353 int>(alloc_new<int>);
354}
355
356/// @brief Passes a container as recv counts to the underlying call, i.e. the container's storage must
357/// contain the recv count from each relevant PE.
358///
359/// The underlying container must provide \c data() and \c size() member functions and expose the contained \c
360/// value_type.
361/// @tparam Container Container type which contains the send counts.
362/// @param container Container which contains the recv counts.
363/// @return Parameter object referring to the storage containing the recv counts.
364/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
365template <typename Container>
369 internal::BufferModifiability::constant,
370 internal::BufferType::in_buffer,
372 int>(std::forward<Container>(container));
373}
374
375/// @brief Passes the initializer list as recv counts to the underlying call.
376///
377/// @tparam Type The type of the initializer list.
378/// @param counts The recv counts.
379/// @return Parameter object referring to the storage containing the recv counts.
380/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
381template <typename T>
382auto recv_counts(std::initializer_list<T> counts) {
385 internal::BufferModifiability::constant,
386 internal::BufferType::in_buffer,
388 int>(std::move(counts));
389}
390
391/// @brief Indicates that the recv counts are ignored.
393 return internal::
394 make_empty_data_buffer_builder<int, internal::ParameterType::recv_counts, internal::BufferType::ignore>();
395}
396
397/// @brief Passes a \p container, into which the recv counts deduced by KaMPIng will be written, to the underlying call.
398/// \p Container must satisfy the following constraints:
399/// - provide a \c data() member function
400/// - provide a \c size() member function
401/// - expose \c value_type (which must be int).
402/// - if \p resize_policy is not BufferResizePolicy::no_resize, \p container additionally has to expose a
403/// `resize(unsigned int)` member function.
404///
405/// The recv counts container will be returned as part of the underlying call's result object if it is moved/passed by
406/// value (e.g. `recv_counts_out(std::move(container))`).
407///
408/// @tparam resize_policy Policy specifying whether (and if so, how) the underlying buffer shall be resized. The default
409/// resize policy is BufferResizePolicy::no_resize, indicating that the buffer should not be resized by KaMPIng.
410/// @tparam Container Container type which will contain the recv counts.
411/// @param container Container which will contain the recv counts.
412/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
413template <BufferResizePolicy resize_policy = BufferResizePolicy::no_resize, typename Container>
417 internal::BufferModifiability::modifiable,
418 internal::BufferType::out_buffer,
419 resize_policy,
420 int>(std::forward<Container>(container));
421}
422
423/// @brief Indicates to construct an object of type \p Container, into which the recv counts deduced by KaMPIng will be
424/// written, in the underlying call.
425/// \p Container must satisfy the following constraints:
426/// - provide a \c data() member function
427/// - provide a \c size() member function
428/// - provide a \c resize(unsigned int) member function
429/// - expose \c value_type (which must be int).
430///
431/// The recv counts container will be returned as part of the underlying call's result object.
432///
433/// @tparam Container Container type which will contains the recv counts.
434/// @return Parameter object referring to the storage which will contain the recv counts.
435/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
436template <typename Data>
440 internal::BufferModifiability::modifiable,
441 internal::BufferType::out_buffer,
443 int>(container);
444}
445
446/// @brief Indicates to construct a container with type \p Container<int>, into which the recv counts deduced by KaMPIng
447/// will be written, in the underlying call.
448///
449/// \p Container<int> must satisfy the following constraints:
450/// - provide a \c data() member function
451/// - provide a \c size() member function
452/// - provide a \c resize(unsigned int) member function
453/// - expose \c value_type.
454///
455/// The recv counts container will be returned as part of the underlying call's result object.
456///
457/// @tparam Container Container type which will contains the recv counts.
458/// @return Parameter object referring to the storage which will contain the recv counts.
459/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
460template <template <typename...> typename Data>
464 internal::BufferModifiability::modifiable,
465 internal::BufferType::out_buffer,
467 int>(container);
468}
469
470/// @brief Indicates to construct a container with type \ref kamping::Communicator::default_container_type<int>, into
471/// which the recv counts deduced by KaMPIng will be written, in the underlying call.
472///
473/// The recv counts container will be returned as part of the underlying call's result object.
474///
475/// @tparam Container Container type which will contains the recv counts.
476/// @return Parameter object referring to the storage which will contain the recv counts.
477/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
478inline auto recv_counts_out() {
481 internal::BufferModifiability::modifiable,
482 internal::BufferType::out_buffer,
484}
485
486/// @brief Passes \p count as recv count to the underlying call.
487/// @param count The recv count.
488/// @return The corresponding parameter object.
489/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
490inline auto recv_count(int count) {
493 internal::BufferModifiability::constant,
494 internal::BufferType::in_buffer,
496 int>(std::move(count));
497}
498
499/// @brief Passes \p count, into which the recv count deduced by KaMPIng will be written, to the underlying call.
500/// @param count Reference to the location at which the recv count will be stored.
501/// @return The corresponding parameter object.
502/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
503inline auto recv_count_out(int& count) {
506 internal::BufferModifiability::modifiable,
507 internal::BufferType::out_buffer,
509 int>(count);
510}
511
512/// @brief Indicates to deduce the recv count and return it to the caller as part of the underlying call's result
513/// object.
514/// @return The corresponding parameter object.
515/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
516inline auto recv_count_out() {
519 internal::BufferModifiability::modifiable,
520 internal::BufferType::out_buffer,
522 int>(alloc_new<int>);
523}
524
525/// @brief Passes \p count as send/recv count to the underlying call.
526/// @param count The send/recv count.
527/// @return The corresponding parameter object.
528/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
529inline auto send_recv_count(int count) {
532 internal::BufferModifiability::constant,
533 internal::BufferType::in_buffer,
535 int>(std::move(count));
536}
537
538/// @brief Passes \p count, into which the send/recv count deduced by KaMPIng will be written, to the underlying call.
539/// @param count Reference to the location at which the send/recv count will be stored.
540/// @return The corresponding parameter object.
541/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
542inline auto send_recv_count_out(int& count) {
545 internal::BufferModifiability::modifiable,
546 internal::BufferType::out_buffer,
548 int>(count);
549}
550
551/// @brief Indicates to deduce the send/recv count and return it to the caller as part of the underlying call's result
552/// object.
553/// @return The corresponding parameter object.
554/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
555inline auto send_recv_count_out() {
558 internal::BufferModifiability::modifiable,
559 internal::BufferType::out_buffer,
561 int>(alloc_new<int>);
562}
563
564/// @brief Passes a container as send displacements to the underlying call, i.e. the container's storage must
565/// contain the send displacement for each relevant PE.
566///
567/// The underlying container must provide \c data() and \c size() member functions and expose the contained \c
568/// value_type.
569/// @tparam Container Container type which contains the send displacements.
570/// @param container Container which contains the send displacements.
571/// @return Parameter object referring to the storage containing the send displacements.
572/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
573template <typename Container>
577 internal::BufferModifiability::constant,
578 internal::BufferType::in_buffer,
580 int>(std::forward<Container>(container));
581}
582
583/// @brief Passes the initializer list as send displacements to the underlying call.
584///
585/// @tparam Type The type of the initializer list.
586/// @param displs The send displacements.
587/// @return Parameter object referring to the storage containing the send displacements.
588/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
589template <typename T>
590auto send_displs(std::initializer_list<T> displs) {
593 internal::BufferModifiability::constant,
594 internal::BufferType::in_buffer,
596 int>(std::move(displs));
597}
598
599/// @brief Passes a \p container, into which the send displacements deduced by KaMPIng will be written, to the
600/// underlying call. \p Container must satisfy the following constraints:
601/// - provide a \c data() member function
602/// - provide a \c size() member function
603/// - expose \c value_type (which must be int).
604/// - if \p resize_policy is not BufferResizePolicy::no_resize, \p container additionally has to expose a
605/// `resize(unsigned int)` member function.
606///
607/// The send displacements container will be returned as part of the underlying call's result object if it is
608/// moved/passed by value (e.g. `send_displs_out(std::move(container))`).
609///
610/// @tparam resize_policy Policy specifying whether (and if so, how) the underlying buffer shall be resized. The default
611/// resize policy is BufferResizePolicy::no_resize, indicating that the buffer should not be resized by KaMPIng.
612/// @tparam Container Container type which will contain the send displacements.
613/// @param container Container which will contain the send displacements.
614/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
615template <BufferResizePolicy resize_policy = BufferResizePolicy::no_resize, typename Container>
619 internal::BufferModifiability::modifiable,
620 internal::BufferType::out_buffer,
621 resize_policy,
622 int>(std::forward<Container>(container));
623}
624
625/// @brief Indicates to construct an object of type \p Container, into which the send displacements deduced by KaMPIng
626/// will be written, in the underlying call. \p Container must satisfy the following constraints:
627/// - provide a \c data() member function
628/// - provide a \c size() member function
629/// - provide a \c resize(unsigned int) member function
630/// - expose \c value_type (which must be int).
631///
632/// The send displacements container will be returned as part of the underlying call's result object.
633///
634/// @tparam Container Container type which will contains the send displacements.
635/// @return Parameter object referring to the storage which will contain the send displacements.
636/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
637template <typename Container>
641 internal::BufferModifiability::modifiable,
642 internal::BufferType::out_buffer,
645}
646
647/// @brief Indicates to construct a container with type \p Container<int>, into which the send displacements deduced by
648/// KaMPIng will be written, in the underlying call.
649///
650/// \p Container<int> must satisfy the following constraints:
651/// - provide a \c data() member function
652/// - provide a \c size() member function
653/// - provide a \c resize(unsigned int) member function
654/// - expose \c value_type.
655///
656/// The send displacements container will be returned as part of the underlying call's result object.
657///
658/// @tparam Container Container type which will contains the send displacements.
659/// @return Parameter object referring to the storage which will contain the send displacements.
660/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
661template <template <typename...> typename Container>
665 internal::BufferModifiability::modifiable,
666 internal::BufferType::out_buffer,
669}
670
671/// @brief Indicates to construct a container with type \ref kamping::Communicator::default_container_type<int>, into
672/// which the send displacements deduced by KaMPIng will be written, in the underlying call.
673///
674/// The send displacements container will be returned as part of the underlying call's result object.
675///
676/// @tparam Container Container type which will contains the send displacements.
677/// @return Parameter object referring to the storage which will contain the send displacements.
678/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
679inline auto send_displs_out() {
682 internal::BufferModifiability::modifiable,
683 internal::BufferType::out_buffer,
685}
686
687/// @brief Passes a container as receive displacements to the underlying call, i.e. the container's storage must
688/// contain the receive displacement for each relevant PE.
689///
690/// The underlying container must provide \c data() and \c size() member functions and expose the contained \c
691/// value_type.
692/// @tparam Container Container type which contains the receive displacements.
693/// @param container Container which contains the receive displacements.
694/// @return Parameter object referring to the storage containing the receive displacements.
695/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
696template <typename Container>
700 internal::BufferModifiability::constant,
701 internal::BufferType::in_buffer,
703 int>(std::forward<Container>(container));
704}
705
706/// @brief Passes the initializer list as receive displacements to the underlying call.
707///
708/// @tparam Type The type of the initializer list.
709/// @param displs The receive displacements.
710/// @return Parameter object referring to the storage containing the receive displacements.
711/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
712template <typename T>
713auto recv_displs(std::initializer_list<T> displs) {
716 internal::BufferModifiability::constant,
717 internal::BufferType::in_buffer,
719 int>(std::move(displs));
720}
721
722/// @brief Passes a \p container, into which the receive displacements deduced by KaMPIng will be written, to the
723/// underlying call. \p Container must satisfy the following constraints:
724/// - provide a \c data() member function
725/// - provide a \c size() member function
726/// - expose \c value_type (which must be int).
727/// - if \p resize_policy is not BufferResizePolicy::no_resize, \p container additionally has to expose a
728/// `resize(unsigned int)` member function.
729///
730/// The receive displacements container will be returned as part of the underlying call's result object if it is
731/// moved/passed by value (e.g. `receive_displs_out(std::move(container))`).
732///
733/// @tparam resize_policy Policy specifying whether (and if so, how) the underlying buffer shall be resized. The default
734/// resize policy is BufferResizePolicy::no_resize, indicating that the buffer should not be resized by KaMPIng.
735/// @tparam Container Container type which will contain the receive displacements.
736/// @param container Container which will contain the receive displacements.
737/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
738template <BufferResizePolicy resize_policy = BufferResizePolicy::no_resize, typename Container>
742 internal::BufferModifiability::modifiable,
743 internal::BufferType::out_buffer,
744 resize_policy,
745 int>(std::forward<Container>(container));
746}
747
748/// @brief Indicates to construct an object of type \p Container, into which the receive displacements deduced by
749/// KaMPIng will be written, in the underlying call. \p Container must satisfy the following constraints:
750/// - provide a \c data() member function
751/// - provide a \c size() member function
752/// - provide a \c resize(unsigned int) member function
753/// - expose \c value_type (which must be int).
754///
755/// The receive displacements container will be returned as part of the underlying call's result object.
756///
757/// @tparam Container Container type which will contains the receive displacements.
758/// @return Parameter object referring to the storage which will contain the receive displacements.
759/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
760template <typename Container>
764 internal::BufferModifiability::modifiable,
765 internal::BufferType::out_buffer,
768}
769
770/// @brief Indicates to construct a container with type \p Container<int>, into which the receive displacements deduced
771/// by KaMPIng will be written, in the underlying call.
772///
773/// \p Container<int> must satisfy the following constraints:
774/// - provide a \c data() member function
775/// - provide a \c size() member function
776/// - provide a \c resize(unsigned int) member function
777/// - expose \c value_type.
778///
779/// The receive displacements container will be returned as part of the underlying call's result object.
780///
781/// @tparam Container Container type which will contains the receive displacements.
782/// @return Parameter object referring to the storage which will contain the receive displacements.
783/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
784template <template <typename...> typename Container>
788 internal::BufferModifiability::modifiable,
789 internal::BufferType::out_buffer,
792}
793
794/// @brief Indicates to construct a container with type \ref kamping::Communicator::default_container_type<int>, into
795/// which the receive displacements deduced by KaMPIng will be written, in the underlying call.
796///
797/// The receive displacements container will be returned as part of the underlying call's result object.
798///
799/// @tparam Container Container type which will contains the receive displacements.
800/// @return Parameter object referring to the storage which will contain the receive displacements.
801/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
802inline auto recv_displs_out() {
805 internal::BufferModifiability::modifiable,
806 internal::BufferType::out_buffer,
808}
809
810/// @brief Passes a \p container, into which the received elements will be written, to the
811/// underlying call. \p Container must satisfy the following constraints:
812/// - provide a \c data() member function
813/// - provide a \c size() member function
814/// - expose \c value_type (which must be int).
815/// - if \p resize_policy is not BufferResizePolicy::no_resize, \p container additionally has to expose a
816/// `resize(unsigned int)` member function.
817///
818/// The receive buffer will be returned as part of the underlying call's result object if it is
819/// moved/passed by value (e.g. `recv_buf_out(std::move(container))`).
820///
821/// @tparam resize_policy Policy specifying whether (and if so, how) the underlying buffer shall be resized. The default
822/// resize policy is BufferResizePolicy::no_resize, indicating that the buffer should not be resized by KaMPIng.
823/// @tparam Container Container type which will contain the send displacements.
824/// @param container Container which will contain the send displacements.
825/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
826template <
828 typename Container,
829 typename Enable = std::enable_if_t<!internal::is_serialization_buffer_v<Container>>>
833 internal::BufferModifiability::modifiable,
834 internal::BufferType::out_buffer,
835 resize_policy>(std::forward<Container>(container));
836}
837
838/// @brief Passes a \p container, into which the received elements will be written, to the
839/// underlying call. \p Container must satisfy the following constraints:
840/// - provide a \c data() member function
841/// - provide a \c size() member function
842/// - expose \c value_type (which must be int).
843/// - if \p resize_policy is not BufferResizePolicy::no_resize, \p container additionally has to expose a
844/// `resize(unsigned int)` member function.
845///
846/// The receive buffer will be returned as part of the underlying call's result object if it is
847/// moved/passed by value (e.g. `recv_buf(std::move(container))`).
848///
849/// @tparam resize_policy Policy specifying whether (and if so, how) the underlying buffer shall be resized. The default
850/// resize policy is BufferResizePolicy::no_resize, indicating that the buffer should not be resized by KaMPIng.
851/// @tparam Container Container type which will contain the send displacements.
852/// @param container Container which will contain the send displacements.
853/// @see Alias for \ref recv_buf_out(Container&&).
854/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
855template <
857 typename Container,
858 typename Enable = std::enable_if_t<!internal::is_serialization_buffer_v<Container>>>
860 return recv_buf_out<resize_policy>(std::forward<Container>(container));
861}
862
863/// @brief Indicates to deserialize the received elements in the underlying call.
864///
865/// Example usage:
866/// ```cpp
867/// using dict_type = std::unordered_map<int, double>;
868/// recv_buf_out(kamping::as_deserializable<dict_type>());
869/// ```
870/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
871template <
872 typename SerializationBufferType,
873 typename Enable = std::enable_if_t<internal::is_serialization_buffer_v<SerializationBufferType>>>
877 internal::BufferModifiability::modifiable,
878 internal::BufferType::out_buffer,
879 BufferResizePolicy::resize_to_fit>(std::forward<SerializationBufferType>(buffer));
880}
881
882/// @brief Indicates to deserialize the received elements in the underlying call.
883///
884/// Example usage:
885/// ```cpp
886/// using dict_type = std::unordered_map<int, double>;
887/// recv_buf(kamping::as_deserializable<dict_type>());
888/// ```
889///
890/// @see Alias for \ref recv_buf_out(Container&&).
891/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
892template <
893 typename SerializationBufferType,
894 typename Enable = std::enable_if_t<internal::is_serialization_buffer_v<SerializationBufferType>>>
896 return recv_buf_out(std::forward<SerializationBufferType>(buffer));
897}
898
899/// @brief Indicates to construct a container of type \p Container, into which the received elements
900/// will be written, in the underlying call.
901///
902/// \p Container<int> must satisfy the following constraints:
903/// - provide a \c data() member function
904/// - provide a \c size() member function
905/// - provide a \c resize(unsigned int) member function
906/// - expose \c value_type.
907///
908/// The receive buffer will be returned as part of the underlying call's result object
909///
910/// @tparam Container Container type which will contains the send displacements.
911/// @return Parameter object referring to the storage which will contain the received elements.
912/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
913template <typename Container>
917 internal::BufferModifiability::modifiable,
918 internal::BufferType::out_buffer,
919 internal::maximum_viable_resize_policy<Container>>(alloc_new<Container>);
920}
921
922/// @brief Indicates to construct a container of type \p Container, into which the received elements
923/// will be written, in the underlying call.
924///
925/// \p Container<int> must satisfy the following constraints:
926/// - provide a \c data() member function
927/// - provide a \c size() member function
928/// - provide a \c resize(unsigned int) member function
929/// - expose \c value_type.
930///
931/// The receive buffer will be returned as part of the underlying call's result object.
932///
933/// @tparam Container Container type which will contains the send displacements.
934/// @return Parameter object referring to the storage which will contain the received elements.
935/// @see Alias for \ref recv_buf_out(Container&&).
936/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
937template <typename Container>
941
942/// @brief Indicates to construct a container with type \ref kamping::Communicator::default_container_type<\p
943/// ValueType>, into which the received elements will be written, in the underlying call.
944///
945/// The receive buffer will be returned as part of the underlying call's result object.
946///
947/// defaults to \ref Communicator::default_container_type.
948/// @tparam ValueType The type of the elements in the buffer.
949/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
950template <typename ValueType>
954 internal::BufferModifiability::modifiable,
955 internal::BufferType::out_buffer,
957}
958
959/// @brief Indicates to construct a container with type \ref kamping::Communicator::default_container_type<\p
960/// ValueType>, into which the received elements will be written, in the underlying call.
961///
962/// The receive buffer will be returned as part of the underlying call's result object.
963///
964/// defaults to \ref Communicator::default_container_type.
965/// @tparam ValueType The type of the elements in the buffer.
966/// @see Alias for \ref recv_buf_out(Container&&).
967/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
968template <typename ValueType>
972
973/// @brief Passes \p rank as root rank to the underlying call.
974/// This parameter is needed in functions like \c MPI_Gather.
975///
976/// @param rank The root rank.
977/// @return The corresponding parameter object.
978/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
979inline auto root(int rank) {
980 return internal::RootDataBuffer(rank);
981}
982
983/// @brief Passes \p rank as root rank to the underlying call.
984/// This parameter is needed in functions like \c MPI_Gather.
985///
986/// @param rank The root rank.
987/// @return The corresponding parameter object.
988/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
989inline auto root(size_t rank) {
990 return root(asserting_cast<int>(rank));
991}
992
993/// @brief Passes \p rank as destination rank to the underlying call.
994/// This parameter is needed in point-to-point exchange routines like \c MPI_Send.
995///
996/// @param rank The destination rank.
997/// @return The corresponding parameter object.
998/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1002
1003/// @brief Passes \p rank as destination rank to the underlying call.
1004/// This parameter is needed in point-to-point exchange routines like \c MPI_Send.
1005///
1006/// @param rank The destination rank.
1007/// @return The corresponding parameter object.
1008/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1009inline auto destination(size_t rank) {
1010 return destination(asserting_cast<int>(rank));
1011}
1012
1013/// @brief Passes \c MPI_PROC_NULL as destination rank to the underlying call.
1014/// This parameter is needed in point-to-point exchange routines like \c MPI_Send.
1015///
1016/// @return The corresponding parameter object.
1017/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1021
1022/// @brief Passes \p rank as source rank to the underlying call.
1023/// This parameter is needed in point-to-point exchange routines like \c MPI_Recv.
1024///
1025/// @param rank The source rank.
1026/// @return The corresponding parameter object.
1027/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1031
1032/// @brief Passes \p rank as source rank to the underlying call.
1033/// This parameter is needed in point-to-point exchange routines like \c MPI_Recv.
1034///
1035/// @param rank The source rank.
1036/// @return The corresponding parameter object.
1037/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1038inline auto source(size_t rank) {
1039 return source(asserting_cast<int>(rank));
1040}
1041
1042/// @brief Indicates to use \c MPI_ANY_SOURCE as source rank in the underlying call, i.e. accepting any rank as source
1043/// rank. This parameter is needed in point-to-point exchange routines like \c MPI_Recv.
1044///
1045/// @return The corresponding parameter object.
1046/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1050
1051/// @brief Passes \c MPI_PROC_NULL as source rank to the underlying call.
1052/// This parameter is needed in point-to-point exchange routines like \c MPI_Recv.
1053///
1054/// @return The corresponding parameter object.
1055/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1059
1060/// @brief Indicates to use \c MPI_ANY_TAG as tag in the underlying call.
1061///
1062/// @return The corresponding parameter object.
1063/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1067
1068/// @brief Passes \p value as tag to the underlying call.
1069///
1070/// @param value The tag value.
1071/// @return The corresponding parameter object.
1072/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1073inline auto tag(int value) {
1075}
1076
1077/// @brief Converts the passed enum \p value to its integer representaiton and passes this value to the underlying call.
1078///
1079/// @param value The tag value.
1080/// @return The corresponding parameter object.
1081/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1082template <typename EnumType, typename = std::enable_if_t<std::is_enum_v<EnumType>>>
1083inline auto tag(EnumType value) {
1084 static_assert(
1085 std::is_convertible_v<std::underlying_type_t<EnumType>, int>,
1086 "The underlying enum type must be implicitly convertible to int."
1087 );
1088 return tag(static_cast<int>(value));
1089}
1090
1091/// @brief Passes a request handle to the underlying MPI call.
1092/// @param request The request handle.
1093/// @return The corresponding parameter object.
1094/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1095inline auto request(Request& request) {
1099 internal::BufferModifiability::modifiable,
1100 internal::BufferType::out_buffer,
1102}
1103
1104/// @brief Passes a request from a \ref RequestPool to the underlying MPI call.
1105/// @param request The request handle.
1106/// @tparam IndexType The type of the index used by the \ref RequestPool for requests.
1107/// @return The corresponding parameter object.
1108/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1109template <typename IndexType>
1114 internal::BufferModifiability::modifiable,
1115 internal::BufferType::out_buffer,
1117}
1118
1119/// @brief Internally allocate a request object and return it to the user.
1120/// @return The corresponding parameter object.
1121/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1122inline auto request() {
1126 internal::BufferModifiability::modifiable,
1127 internal::BufferType::out_buffer,
1129}
1130
1131/// @brief Passes the send mode parameter for point to point communication to the underlying call.
1132/// Pass any of the tags from the \c kamping::send_modes namespace.
1133///
1134/// @return The corresponding parameter object.
1135/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1136template <typename SendModeTag>
1140
1141/// @brief Passes a reduction operation to ther underlying call. Accepts function objects, lambdas, function pointers or
1142/// native \c MPI_Op as argument.
1143///
1144/// @tparam Op the type of the operation
1145/// @tparam Commutative tag whether the operation is commutative
1146/// @param op the operation
1147/// @param commute the commutativity tag
1148/// May be any instance of \c commutative, \c or non_commutative. Passing \c undefined_commutative is only
1149/// supported for builtin and native operations. This is used to streamline the interface so that the use does not
1150/// have to provide commutativity info when the operation is builtin.
1151/// @return The corresponding parameter object.
1152/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1153template <typename Op, typename Commutative = ops::internal::undefined_commutative_tag>
1154internal::OperationBuilder<Op, Commutative>
1156 return internal::OperationBuilder<Op, Commutative>(std::forward<Op>(op), commute);
1157}
1158
1159/// @brief Passes a container containing the value(s) to return on the first rank to \ref
1160/// kamping::Communicator::exscan().
1161///
1162/// @tparam Container Container type.
1163/// @param container Value(s) to return on the first rank.
1164/// @return The corresponding parameter object.
1165/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1166template <typename Container>
1170 internal::BufferModifiability::constant,
1171 internal::BufferType::in_buffer,
1172 BufferResizePolicy::no_resize>(std::forward<Container>(container));
1173}
1174
1175/// @brief Passes the data to be returned on the first rank in \c MPI_Exscan which is provided as an initializer list to
1176/// \ref kamping::Communicator::exscan().
1177///
1178/// @param values Value(s) to return on the first rank.
1179/// @return The corresponding parameter object.
1180/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1181template <typename T>
1182inline auto values_on_rank_0(std::initializer_list<T> values) {
1185 internal::BufferModifiability::constant,
1186 internal::BufferType::in_buffer,
1188}
1189
1190/// @brief Passes \p send_type as send type to the underlying call.
1191///
1192/// @param send_type MPI_Datatype to use in the wrapped \c MPI operation.
1193/// @return The corresponding parameter object.
1194/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1198 internal::BufferModifiability::constant,
1199 internal::BufferType::in_buffer,
1201 MPI_Datatype>(std::move(send_type));
1202}
1203
1204/// @brief Indicates to deduce the send type in the underlying call and return it as part of underlying call's result
1205/// object.
1206///
1207/// @return The corresponding parameter object.
1208/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1209inline auto send_type_out() {
1212 internal::BufferModifiability::modifiable,
1213 internal::BufferType::out_buffer,
1216}
1217
1218/// @brief Passes \p send_type, into which the send type deduced by KaMPIng will be written, to the underlying call.
1219/// The type will be stored at the location referred to by the provided reference.
1220///
1221/// @param send_type Reference to the location at which the deduced MPI_Datatype will be stored.
1222/// @return The corresponding parameter object.
1223/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1227 internal::BufferModifiability::modifiable,
1228 internal::BufferType::out_buffer,
1231}
1232
1233/// @brief Passes \p recv_type as recv type to the underlying call.
1234///
1235/// @param recv_type MPI_Datatype to use in the wrapped \c MPI function.
1236/// @return The corresponding parameter object.
1237/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1241 internal::BufferModifiability::constant,
1242 internal::BufferType::in_buffer,
1244 MPI_Datatype>(std::move(recv_type));
1245}
1246
1247/// @brief Indicates to deduce the receive type in the underlying call and return it as part of underlying call's result
1248/// object.
1249///
1250/// @return The corresponding parameter object.
1251/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1252inline auto recv_type_out() {
1255 internal::BufferModifiability::modifiable,
1256 internal::BufferType::out_buffer,
1259}
1260
1261/// @brief Passes \p recv_type, into which the recv type deduced by KaMPIng will be written, to the underlying call.
1262/// The type will be stored at the location referred to by the provided reference.
1263///
1264/// @param recv_type Reference to the location at which the deduced MPI_Datatype will be stored.
1265/// @return The corresponding parameter object.
1266/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1270 internal::BufferModifiability::modifiable,
1271 internal::BufferType::out_buffer,
1274}
1275
1276/// @brief Passes \p send_recv_type as send/recv type to the underlying call.
1277/// (This parameter is in \c MPI routines such as \c MPI_Bcast, ... .)
1278///
1279/// @param send_recv_type MPI_Datatype to use in the wrapped \c MPI operation.
1280/// @return The corresponding parameter object.
1281/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1285 internal::BufferModifiability::constant,
1286 internal::BufferType::in_buffer,
1288 MPI_Datatype>(std::move(send_recv_type));
1289}
1290
1291/// @brief Indicates to deduce the send/recv type in the underlying call and return it as part of underlying call's
1292/// result object.
1293/// (This parameter is used in \c MPI routines such as \c MPI_Bcast, ... .)
1294///
1295/// @return The corresponding parameter object.
1296/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1297inline auto send_recv_type_out() {
1300 internal::BufferModifiability::modifiable,
1301 internal::BufferType::out_buffer,
1304}
1305
1306/// @brief Passes \p send_recv_type, into which the send/recv type deduced by KaMPIng will be written, to the underlying
1307/// call. The type will be stored at the location referred to by the provided reference. (This parameter is used in \c
1308/// MPI routines such as \c MPI_Bcast, ... .)
1309///
1310/// @param send_recv_type Reference to the location at which the deduced MPI_Datatype will be stored.
1311/// @return The corresponding parameter object.
1312/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1316 internal::BufferModifiability::modifiable,
1317 internal::BufferType::out_buffer,
1320}
1321/// @}
1322} // namespace kamping
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
Encapsulates the rank of a PE. This is needed for p2p communication and rooted MPI collectives like M...
Definition parameter_objects.hpp:358
Encapsulates a message tag.
Definition parameter_objects.hpp:513
constexpr BufferResizePolicy resize_to_fit
Definition data_buffer.hpp:276
BufferResizePolicy
Enum to specify in which cases a buffer is resized.
Definition data_buffer.hpp:262
@ no_resize
Policy indicating that the underlying buffer shall never be resized.
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 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_mode(SendModeTag)
Passes the send mode parameter for point to point communication to the underlying call....
Definition named_parameters.hpp:1137
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 send_count(int count)
Passes count as send count to the underlying call.
Definition named_parameters.hpp:321
auto recv_counts(Container &&container)
Passes a container as recv counts to the underlying call, i.e. the container's storage must contain t...
Definition named_parameters.hpp:366
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 send_type(MPI_Datatype send_type)
Passes send_type as send type to the underlying call.
Definition named_parameters.hpp:1195
auto recv_buf_out(Container &&container)
Passes a container, into which the received elements will be written, to the underlying call....
Definition named_parameters.hpp:830
auto send_buf_out(Data &&data)
Passes a container/single value as rvalue as a send buffer to the underlying MPI call....
Definition named_parameters.hpp:115
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_type_out()
Indicates to deduce the send/recv type in the underlying call and return it as part of underlying cal...
Definition named_parameters.hpp:1297
auto send_counts_out()
Indicates to construct a container with type kamping::Communicator::default_container_type<int>,...
Definition named_parameters.hpp:309
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 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 recv_counts_out()
Indicates to construct a container with type kamping::Communicator::default_container_type<int>,...
Definition named_parameters.hpp:478
auto recv_displs_out()
Indicates to construct a container with type kamping::Communicator::default_container_type<int>,...
Definition named_parameters.hpp:802
auto send_counts(Container &&container)
Passes a container as send counts to the underlying call, i.e. the container's storage must contain t...
Definition named_parameters.hpp:203
auto send_recv_count(int count)
Passes count as send/recv count to the underlying call.
Definition named_parameters.hpp:529
auto recv_displs(Container &&container)
Passes a container as receive displacements to the underlying call, i.e. the container's storage must...
Definition named_parameters.hpp:697
auto recv_count(int count)
Passes count as recv count to the underlying call.
Definition named_parameters.hpp:490
auto send_type_out()
Indicates to deduce the send type in the underlying call and return it as part of underlying call's r...
Definition named_parameters.hpp:1209
auto send_displs_out()
Indicates to construct a container with type kamping::Communicator::default_container_type<int>,...
Definition named_parameters.hpp:679
auto recv_type(MPI_Datatype recv_type)
Passes recv_type as recv type to the underlying call.
Definition named_parameters.hpp:1238
auto send_displs(Container &&container)
Passes a container as send displacements to the underlying call, i.e. the container's storage must co...
Definition named_parameters.hpp:574
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 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:516
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
ParameterType
Each input parameter to one of the MPI calls wrapped by KaMPIng needs to has one of the following tag...
Definition named_parameter_types.hpp:33
@ request
Tag used to represent an MPI_Request.
@ recv_count
Tag used to represent the number of elements to be received.
@ recv_type
Tag used to represent a recv type in an MPI call.
@ send_type
Tag used to represent a send type in an MPI call.
@ send_count
Tag used to represent the number of elements to be sent.
Definitions for builtin MPI operations.
File containing the parameter types used by the KaMPIng library.
RankDataBuffer< RankType::value, ParameterType::root > RootDataBuffer
Helper for roots;.
Definition parameter_objects.hpp:466
auto make_data_buffer_builder(Data &&data)
Factory method for constructing a DataBufferBuilder from the given Container Data.
Definition parameter_objects.hpp:225
BufferModifiability
Enum to specify whether a buffer is modifiable.
Definition data_buffer.hpp:251
auto make_data_buffer(Data &&data)
Creates a user allocated DataBuffer containing the supplied data (a container or a single element)
Definition data_buffer.hpp:753
Parameter objects return by named parameter factory functions.
Parameter object for send_mode encapsulating the send mode compile-time tag.
Definition parameter_objects.hpp:478
tag struct for message tag
Definition parameter_objects.hpp:502
Tag type for parameters that can be omitted on some PEs (e.g., root PE, or non-root PEs).
Definition parameter_objects.hpp:336
tag struct for MPI_ANY_SOURCE
Definition parameter_objects.hpp:345
tag struct for MPI_PROC_NULL
Definition parameter_objects.hpp:346
An unused template parameter.
Definition named_parameters.hpp:36
tag for a reduce operation without manually declared commutativity (this is only used internally for ...
Definition mpi_ops.hpp:194