KaMPIng 0.1.1
Flexible and (near) zero-overhead C++ bindings for MPI
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
39namespace params {
40
41//// @addtogroup kamping_named_parameters
42/// @{
43
44/// @brief Generates a dummy send buf that wraps a \c nullptr.
45///
46/// This is useful for operations where a send_buf is required on some PEs, such as the root PE,
47/// but not all PEs that participate in the collective communication.
48///
49/// @tparam Data Data type for elements in the send buffer. This must be the same type as in the actual send_buf.
50/// @param ignore Tag parameter for overload dispatching, pass in `kamping::ignore<Data>`.
51/// @return Object wrapping a \c nullptr as a send buffer.
52template <typename Data>
54 return internal::
55 make_empty_data_buffer_builder<Data, internal::ParameterType::send_buf, internal::BufferType::ignore>();
56}
57
58/// @brief Passes a container/single value as a send buffer to the underlying MPI call.
59///
60/// If data provides \c data(), it is assumed that it is a container and all elements in the
61/// container are considered for the operation. In this case, the container has to provide a \c size() member functions
62/// and expose the contained \c value_type. If no \c data() member function exists, a single value is assumed
63/// @tparam Data Data type representing the element(s) to send.
64/// @param data Data (either a container which contains the elements or the element directly) to send
65/// @return Parameter object referring to the storage containing the data elements to send.
66/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
67template <typename Data, typename Enable = std::enable_if_t<!internal::is_serialization_buffer_v<Data>>>
68auto send_buf(Data&& data) {
71 internal::BufferModifiability::constant,
72 internal::BufferType::in_buffer,
73 BufferResizePolicy::no_resize>(std::forward<Data>(data));
74}
75
76/// @brief Passes a container/single value as a send buffer to the underlying MPI call. Additionally indicates to use
77/// serialization to transfer the data.
78/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
79template <
81 std::enable_if_t<internal::is_serialization_buffer_v<SerializationBufferType>, bool> = true>
85 internal::BufferModifiability::modifiable,
86 internal::BufferType::in_buffer,
87 BufferResizePolicy::no_resize>(std::forward<SerializationBufferType>(data));
88}
89
90/// @brief Passes the data provided as an initializer list as a send buffer to the underlying MPI call.
91///
92/// @tparam T The type of the elements in the initializer list.
93/// @param data An initializer list of the data elements.
94/// @return Parameter object referring to the storage containing the data elements to send.
95/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
96template <typename T>
97auto send_buf(std::initializer_list<T> data) {
100 internal::BufferModifiability::constant,
101 internal::BufferType::in_buffer,
102 BufferResizePolicy::no_resize>(std::move(data));
103}
104
105/// @brief Passes a container/single value as rvalue as a send buffer to the underlying MPI call.
106/// This transfers ownership of the data to the call and re-returns ownership to the caller as part of the result
107/// object.
108///
109/// If data provides \c data(), it is assumed that it is a container and all elements in the
110/// container are considered for the operation. In this case, the container has to provide a \c size() member functions
111/// and expose the contained \c value_type. If no \c data() member function exists, a single value is assumed
112/// @tparam Data Data type representing the element(s) to send.
113/// @param data Data (either a container which contains the elements or the element directly) to send
114/// @return Parameter object referring to the storage containing the data elements to send.
115/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
116template <typename Data, typename Enable = std::enable_if_t<std::is_rvalue_reference_v<Data&&>>>
117auto send_buf_out(Data&& data) {
120 internal::BufferModifiability::constant,
121 internal::BufferType::in_out_buffer,
122 BufferResizePolicy::no_resize>(std::forward<Data>(data));
123}
124
125/// @brief Passes a container/single value as a send or receive buffer to the underlying MPI call.
126///
127/// @tparam resize_policy Policy specifying whether (and if so, how) the underlying container shall be resized. If
128/// omitted, the resize policy is BufferResizePolicy::no_resize, indicating that the container should not be resized by
129/// kamping.
130/// @tparam Data Data type representing the element(s) to send/receive.
131/// @param data Data (either a container which contains the elements or the element directly) to send or the buffer to
132/// receive into.
133/// @return Parameter object referring to the storage containing the data elements to send or receive.
134/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
135template <
137 typename Data,
138 typename Enable = std::enable_if_t<!internal::is_serialization_buffer_v<Data>>>
139auto send_recv_buf(Data&& data) {
140 constexpr internal::BufferModifiability modifiability = std::is_const_v<std::remove_reference_t<Data>>
141 ? internal::BufferModifiability::constant
142 : internal::BufferModifiability::modifiable;
146 internal::BufferType::in_out_buffer,
147 resize_policy>(std::forward<Data>(data));
148}
149
150/// @brief Passes a container/single value as a send or receive buffer to the underlying MPI call. Additionally
151/// indicates to use serialization to transfer the data.
152/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
153template <
155 typename Enable = std::enable_if_t<internal::is_serialization_buffer_v<SerializationBufferType>>>
158 std::is_const_v<std::remove_reference_t<SerializationBufferType>> ? internal::BufferModifiability::constant
159 : internal::BufferModifiability::modifiable;
163 internal::BufferType::in_out_buffer,
164 BufferResizePolicy::resize_to_fit>(std::forward<SerializationBufferType>(buffer));
165}
166
167/// @brief Indicates to use an object of type \tparam Container as `send_recv_buf`.
168/// Container must provide \c data(), \c size(), \c resize(unsigned int) member functions and expose the contained \c
169/// value_type.
170/// @return Parameter object referring to the storage containing the data elements to send or receive.
171template <typename Container>
175 internal::BufferModifiability::modifiable,
176 internal::BufferType::in_out_buffer,
178}
179
180/// @brief Indicates to use a parameter object encapsulating an underlying container with a \c value_type \tparam
181/// ValueType as `send_recv_buf`. The type of the underlying container is determined by the MPI operation and usually
182/// defaults to \ref Communicator::default_container_type.
183/// @tparam ValueType The type of the elements in the buffer.
184/// @return Parameter object referring to the storage containing the data elements to send or receive.
185/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
186template <typename ValueType>
190 internal::BufferModifiability::modifiable,
191 internal::BufferType::in_out_buffer,
193}
194
195/// @brief Passes a container as send counts to the underlying call, i.e. the container's storage must
196/// contain the send count to each relevant PE.
197///
198/// The underlying container must provide \c data() and \c size() member functions and expose the contained \c
199/// value_type.
200/// @tparam Container Container type which contains the send counts.
201/// @param container Container which contains the send counts.
202/// @return Parameter object referring to the storage containing the send counts.
203/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
204template <typename Container>
208 internal::BufferModifiability::constant,
209 internal::BufferType::in_buffer,
211 int>(std::forward<Container>(container));
212}
213
214/// @brief Passes the initializer list as send counts to the underlying call.
215///
216/// @tparam Type The type of the initializer list.
217/// @param counts The send counts.
218/// @return Parameter object referring to the storage containing the send counts.
219/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
220template <typename T>
221auto send_counts(std::initializer_list<T> counts) {
224 internal::BufferModifiability::constant,
225 internal::BufferType::in_buffer,
227 int>(std::move(counts));
228}
229
230/// @brief Passes a \p container, into which the send counts deduced by KaMPIng will be written, to the underlying call.
231/// \p Container must satisfy the following constraints:
232/// - provide a \c data() member function
233/// - provide a \c size() member function
234/// - expose \c value_type (which must be int).
235/// - if \p resize_policy is not BufferResizePolicy::no_resize, \p container additionally has to expose a
236/// `resize(unsigned int)` member function.
237///
238/// The send counts container will be returned as part of the underlying call's result object if it is moved/passed by
239/// value (e.g. `send_counts_out(std::move(container))`).
240///
241/// @tparam resize_policy Policy specifying whether (and if so, how) the underlying buffer shall be resized. The default
242/// resize policy is BufferResizePolicy::no_resize, indicating that the buffer should not be resized by KaMPIng.
243/// @tparam Container Container type which will contain the send counts.
244/// @param container Container which will contain the send counts.
245/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
246template <BufferResizePolicy resize_policy = BufferResizePolicy::no_resize, typename Container>
250 internal::BufferModifiability::modifiable,
251 internal::BufferType::out_buffer,
252 resize_policy,
253 int>(std::forward<Container>(container));
254}
255
256/// @brief Indicates to construct an object of type \p Container, into which the send counts deduced by KaMPIng will be
257/// written, in the underlying call.
258/// \p Container must satisfy the following constraints:
259/// - provide a \c data() member function
260/// - provide a \c size() member function
261/// - provide a \c resize(unsigned int) member function
262/// - expose \c value_type (which must be int).
263///
264/// The send counts container will be returned as part of the underlying call's result object.
265///
266/// @tparam Container Container type which will contains the send counts.
267/// @return Parameter object referring to the storage which will contain the send counts.
268/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
269template <typename Container>
273 internal::BufferModifiability::modifiable,
274 internal::BufferType::out_buffer,
277}
278
279/// @brief Indicates to construct a container with type \p Container<int>, into which the send counts deduced by KaMPIng
280/// will be written, in the underlying call.
281///
282/// \p Container<int> must satisfy the following constraints:
283/// - provide a \c data() member function
284/// - provide a \c size() member function
285/// - provide a \c resize(unsigned int) member function
286/// - expose \c value_type.
287///
288/// The send counts container will be returned as part of the underlying call's result object.
289///
290/// @tparam Container Container type which will contains the send counts.
291/// @return Parameter object referring to the storage which will contain the send counts.
292/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
293template <template <typename...> typename Container>
297 internal::BufferModifiability::modifiable,
298 internal::BufferType::out_buffer,
301}
302
303/// @brief Indicates to construct a container with type \ref kamping::Communicator::default_container_type<int>, into
304/// which the send counts deduced by KaMPIng will be written, in the underlying call.
305///
306/// The send counts container will be returned as part of the underlying call's result object.
307///
308/// @tparam Container Container type which will contains the send counts.
309/// @return Parameter object referring to the storage which will contain the send counts.
310/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
311inline auto send_counts_out() {
314 internal::BufferModifiability::modifiable,
315 internal::BufferType::out_buffer,
317}
318
319/// @brief Passes \p count as send count to the underlying call.
320/// @param count The send count.
321/// @return The corresponding parameter object.
322/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
323inline auto send_count(int count) {
326 internal::BufferModifiability::constant,
327 internal::BufferType::in_buffer,
329 int>(std::move(count));
330}
331
332/// @brief Passes \p count, into which the send count deduced by KaMPIng will be written, to the underlying call.
333/// @param count Reference to the location at which the send count will be stored.
334/// @return The corresponding parameter object.
335/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
336inline auto send_count_out(int& count) {
339 internal::BufferModifiability::modifiable,
340 internal::BufferType::out_buffer,
342 int>(count);
343}
344
345/// @brief Indicates to deduce the send count and return it to the caller as part of the underlying call's result
346/// object.
347/// @return The corresponding parameter object.
348/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
349inline auto send_count_out() {
352 internal::BufferModifiability::modifiable,
353 internal::BufferType::out_buffer,
355 int>(alloc_new<int>);
356}
357
358/// @brief Passes a container as recv counts to the underlying call, i.e. the container's storage must
359/// contain the recv count from each relevant PE.
360///
361/// The underlying container must provide \c data() and \c size() member functions and expose the contained \c
362/// value_type.
363/// @tparam Container Container type which contains the send counts.
364/// @param container Container which contains the recv counts.
365/// @return Parameter object referring to the storage containing the recv counts.
366/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
367template <typename Container>
371 internal::BufferModifiability::constant,
372 internal::BufferType::in_buffer,
374 int>(std::forward<Container>(container));
375}
376
377/// @brief Passes the initializer list as recv counts to the underlying call.
378///
379/// @tparam Type The type of the initializer list.
380/// @param counts The recv counts.
381/// @return Parameter object referring to the storage containing the recv counts.
382/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
383template <typename T>
384auto recv_counts(std::initializer_list<T> counts) {
387 internal::BufferModifiability::constant,
388 internal::BufferType::in_buffer,
390 int>(std::move(counts));
391}
392
393/// @brief Indicates that the recv counts are ignored.
395 return internal::
396 make_empty_data_buffer_builder<int, internal::ParameterType::recv_counts, internal::BufferType::ignore>();
397}
398
399/// @brief Passes a \p container, into which the recv counts deduced by KaMPIng will be written, to the underlying call.
400/// \p Container must satisfy the following constraints:
401/// - provide a \c data() member function
402/// - provide a \c size() member function
403/// - expose \c value_type (which must be int).
404/// - if \p resize_policy is not BufferResizePolicy::no_resize, \p container additionally has to expose a
405/// `resize(unsigned int)` member function.
406///
407/// The recv counts container will be returned as part of the underlying call's result object if it is moved/passed by
408/// value (e.g. `recv_counts_out(std::move(container))`).
409///
410/// @tparam resize_policy Policy specifying whether (and if so, how) the underlying buffer shall be resized. The default
411/// resize policy is BufferResizePolicy::no_resize, indicating that the buffer should not be resized by KaMPIng.
412/// @tparam Container Container type which will contain the recv counts.
413/// @param container Container which will contain the recv counts.
414/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
415template <BufferResizePolicy resize_policy = BufferResizePolicy::no_resize, typename Container>
419 internal::BufferModifiability::modifiable,
420 internal::BufferType::out_buffer,
421 resize_policy,
422 int>(std::forward<Container>(container));
423}
424
425/// @brief Indicates to construct an object of type \p Container, into which the recv counts deduced by KaMPIng will be
426/// written, in the underlying call.
427/// \p Container must satisfy the following constraints:
428/// - provide a \c data() member function
429/// - provide a \c size() member function
430/// - provide a \c resize(unsigned int) member function
431/// - expose \c value_type (which must be int).
432///
433/// The recv counts container will be returned as part of the underlying call's result object.
434///
435/// @tparam Container Container type which will contains the recv counts.
436/// @return Parameter object referring to the storage which will contain the recv counts.
437/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
438template <typename Data>
442 internal::BufferModifiability::modifiable,
443 internal::BufferType::out_buffer,
445 int>(container);
446}
447
448/// @brief Indicates to construct a container with type \p Container<int>, into which the recv counts deduced by KaMPIng
449/// will be written, in the underlying call.
450///
451/// \p Container<int> must satisfy the following constraints:
452/// - provide a \c data() member function
453/// - provide a \c size() member function
454/// - provide a \c resize(unsigned int) member function
455/// - expose \c value_type.
456///
457/// The recv counts container will be returned as part of the underlying call's result object.
458///
459/// @tparam Container Container type which will contains the recv counts.
460/// @return Parameter object referring to the storage which will contain the recv counts.
461/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
462template <template <typename...> typename Data>
466 internal::BufferModifiability::modifiable,
467 internal::BufferType::out_buffer,
469 int>(container);
470}
471
472/// @brief Indicates to construct a container with type \ref kamping::Communicator::default_container_type<int>, into
473/// which the recv counts deduced by KaMPIng will be written, in the underlying call.
474///
475/// The recv counts container will be returned as part of the underlying call's result object.
476///
477/// @tparam Container Container type which will contains the recv counts.
478/// @return Parameter object referring to the storage which will contain the recv counts.
479/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
480inline auto recv_counts_out() {
483 internal::BufferModifiability::modifiable,
484 internal::BufferType::out_buffer,
486}
487
488/// @brief Passes \p count as recv count to the underlying call.
489/// @param count The recv count.
490/// @return The corresponding parameter object.
491/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
492inline auto recv_count(int count) {
495 internal::BufferModifiability::constant,
496 internal::BufferType::in_buffer,
498 int>(std::move(count));
499}
500
501/// @brief Passes \p count, into which the recv count deduced by KaMPIng will be written, to the underlying call.
502/// @param count Reference to the location at which the recv count will be stored.
503/// @return The corresponding parameter object.
504/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
505inline auto recv_count_out(int& count) {
508 internal::BufferModifiability::modifiable,
509 internal::BufferType::out_buffer,
511 int>(count);
512}
513
514/// @brief Indicates to deduce the recv count and return it to the caller as part of the underlying call's result
515/// object.
516/// @return The corresponding parameter object.
517/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
518inline auto recv_count_out() {
521 internal::BufferModifiability::modifiable,
522 internal::BufferType::out_buffer,
524 int>(alloc_new<int>);
525}
526
527/// @brief Passes \p count as send/recv count to the underlying call.
528/// @param count The send/recv count.
529/// @return The corresponding parameter object.
530/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
531inline auto send_recv_count(int count) {
534 internal::BufferModifiability::constant,
535 internal::BufferType::in_buffer,
537 int>(std::move(count));
538}
539
540/// @brief Passes \p count, into which the send/recv count deduced by KaMPIng will be written, to the underlying call.
541/// @param count Reference to the location at which the send/recv count will be stored.
542/// @return The corresponding parameter object.
543/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
544inline auto send_recv_count_out(int& count) {
547 internal::BufferModifiability::modifiable,
548 internal::BufferType::out_buffer,
550 int>(count);
551}
552
553/// @brief Indicates to deduce the send/recv count and return it to the caller as part of the underlying call's result
554/// object.
555/// @return The corresponding parameter object.
556/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
557inline auto send_recv_count_out() {
560 internal::BufferModifiability::modifiable,
561 internal::BufferType::out_buffer,
563 int>(alloc_new<int>);
564}
565
566/// @brief Passes a container as send displacements to the underlying call, i.e. the container's storage must
567/// contain the send displacement for each relevant PE.
568///
569/// The underlying container must provide \c data() and \c size() member functions and expose the contained \c
570/// value_type.
571/// @tparam Container Container type which contains the send displacements.
572/// @param container Container which contains the send displacements.
573/// @return Parameter object referring to the storage containing the send displacements.
574/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
575template <typename Container>
579 internal::BufferModifiability::constant,
580 internal::BufferType::in_buffer,
582 int>(std::forward<Container>(container));
583}
584
585/// @brief Passes the initializer list as send displacements to the underlying call.
586///
587/// @tparam Type The type of the initializer list.
588/// @param displs The send displacements.
589/// @return Parameter object referring to the storage containing the send displacements.
590/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
591template <typename T>
592auto send_displs(std::initializer_list<T> displs) {
595 internal::BufferModifiability::constant,
596 internal::BufferType::in_buffer,
598 int>(std::move(displs));
599}
600
601/// @brief Passes a \p container, into which the send displacements deduced by KaMPIng will be written, to the
602/// underlying call. \p Container must satisfy the following constraints:
603/// - provide a \c data() member function
604/// - provide a \c size() member function
605/// - expose \c value_type (which must be int).
606/// - if \p resize_policy is not BufferResizePolicy::no_resize, \p container additionally has to expose a
607/// `resize(unsigned int)` member function.
608///
609/// The send displacements container will be returned as part of the underlying call's result object if it is
610/// moved/passed by value (e.g. `send_displs_out(std::move(container))`).
611///
612/// @tparam resize_policy Policy specifying whether (and if so, how) the underlying buffer shall be resized. The default
613/// resize policy is BufferResizePolicy::no_resize, indicating that the buffer should not be resized by KaMPIng.
614/// @tparam Container Container type which will contain the send displacements.
615/// @param container Container which will contain the send displacements.
616/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
617template <BufferResizePolicy resize_policy = BufferResizePolicy::no_resize, typename Container>
621 internal::BufferModifiability::modifiable,
622 internal::BufferType::out_buffer,
623 resize_policy,
624 int>(std::forward<Container>(container));
625}
626
627/// @brief Indicates to construct an object of type \p Container, into which the send displacements deduced by KaMPIng
628/// will be written, in the underlying call. \p Container must satisfy the following constraints:
629/// - provide a \c data() member function
630/// - provide a \c size() member function
631/// - provide a \c resize(unsigned int) member function
632/// - expose \c value_type (which must be int).
633///
634/// The send displacements container will be returned as part of the underlying call's result object.
635///
636/// @tparam Container Container type which will contains the send displacements.
637/// @return Parameter object referring to the storage which will contain the send displacements.
638/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
639template <typename Container>
643 internal::BufferModifiability::modifiable,
644 internal::BufferType::out_buffer,
647}
648
649/// @brief Indicates to construct a container with type \p Container<int>, into which the send displacements deduced by
650/// KaMPIng will be written, in the underlying call.
651///
652/// \p Container<int> must satisfy the following constraints:
653/// - provide a \c data() member function
654/// - provide a \c size() member function
655/// - provide a \c resize(unsigned int) member function
656/// - expose \c value_type.
657///
658/// The send displacements container will be returned as part of the underlying call's result object.
659///
660/// @tparam Container Container type which will contains the send displacements.
661/// @return Parameter object referring to the storage which will contain the send displacements.
662/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
663template <template <typename...> typename Container>
667 internal::BufferModifiability::modifiable,
668 internal::BufferType::out_buffer,
671}
672
673/// @brief Indicates to construct a container with type \ref kamping::Communicator::default_container_type<int>, into
674/// which the send displacements deduced by KaMPIng will be written, in the underlying call.
675///
676/// The send displacements container will be returned as part of the underlying call's result object.
677///
678/// @tparam Container Container type which will contains the send displacements.
679/// @return Parameter object referring to the storage which will contain the send displacements.
680/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
681inline auto send_displs_out() {
684 internal::BufferModifiability::modifiable,
685 internal::BufferType::out_buffer,
687}
688
689/// @brief Passes a container as receive displacements to the underlying call, i.e. the container's storage must
690/// contain the receive displacement for each relevant PE.
691///
692/// The underlying container must provide \c data() and \c size() member functions and expose the contained \c
693/// value_type.
694/// @tparam Container Container type which contains the receive displacements.
695/// @param container Container which contains the receive displacements.
696/// @return Parameter object referring to the storage containing the receive displacements.
697/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
698template <typename Container>
702 internal::BufferModifiability::constant,
703 internal::BufferType::in_buffer,
705 int>(std::forward<Container>(container));
706}
707
708/// @brief Passes the initializer list as receive displacements to the underlying call.
709///
710/// @tparam Type The type of the initializer list.
711/// @param displs The receive displacements.
712/// @return Parameter object referring to the storage containing the receive displacements.
713/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
714template <typename T>
715auto recv_displs(std::initializer_list<T> displs) {
718 internal::BufferModifiability::constant,
719 internal::BufferType::in_buffer,
721 int>(std::move(displs));
722}
723
724/// @brief Passes a \p container, into which the receive displacements deduced by KaMPIng will be written, to the
725/// underlying call. \p Container must satisfy the following constraints:
726/// - provide a \c data() member function
727/// - provide a \c size() member function
728/// - expose \c value_type (which must be int).
729/// - if \p resize_policy is not BufferResizePolicy::no_resize, \p container additionally has to expose a
730/// `resize(unsigned int)` member function.
731///
732/// The receive displacements container will be returned as part of the underlying call's result object if it is
733/// moved/passed by value (e.g. `receive_displs_out(std::move(container))`).
734///
735/// @tparam resize_policy Policy specifying whether (and if so, how) the underlying buffer shall be resized. The default
736/// resize policy is BufferResizePolicy::no_resize, indicating that the buffer should not be resized by KaMPIng.
737/// @tparam Container Container type which will contain the receive displacements.
738/// @param container Container which will contain the receive displacements.
739/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
740template <BufferResizePolicy resize_policy = BufferResizePolicy::no_resize, typename Container>
744 internal::BufferModifiability::modifiable,
745 internal::BufferType::out_buffer,
746 resize_policy,
747 int>(std::forward<Container>(container));
748}
749
750/// @brief Indicates to construct an object of type \p Container, into which the receive displacements deduced by
751/// KaMPIng will be written, in the underlying call. \p Container must satisfy the following constraints:
752/// - provide a \c data() member function
753/// - provide a \c size() member function
754/// - provide a \c resize(unsigned int) member function
755/// - expose \c value_type (which must be int).
756///
757/// The receive displacements container will be returned as part of the underlying call's result object.
758///
759/// @tparam Container Container type which will contains the receive displacements.
760/// @return Parameter object referring to the storage which will contain the receive displacements.
761/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
762template <typename Container>
766 internal::BufferModifiability::modifiable,
767 internal::BufferType::out_buffer,
770}
771
772/// @brief Indicates to construct a container with type \p Container<int>, into which the receive displacements deduced
773/// by KaMPIng will be written, in the underlying call.
774///
775/// \p Container<int> must satisfy the following constraints:
776/// - provide a \c data() member function
777/// - provide a \c size() member function
778/// - provide a \c resize(unsigned int) member function
779/// - expose \c value_type.
780///
781/// The receive displacements container will be returned as part of the underlying call's result object.
782///
783/// @tparam Container Container type which will contains the receive displacements.
784/// @return Parameter object referring to the storage which will contain the receive displacements.
785/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
786template <template <typename...> typename Container>
790 internal::BufferModifiability::modifiable,
791 internal::BufferType::out_buffer,
794}
795
796/// @brief Indicates to construct a container with type \ref kamping::Communicator::default_container_type<int>, into
797/// which the receive displacements deduced by KaMPIng will be written, in the underlying call.
798///
799/// The receive displacements container will be returned as part of the underlying call's result object.
800///
801/// @tparam Container Container type which will contains the receive displacements.
802/// @return Parameter object referring to the storage which will contain the receive displacements.
803/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
804inline auto recv_displs_out() {
807 internal::BufferModifiability::modifiable,
808 internal::BufferType::out_buffer,
810}
811
812/// @brief Passes a \p container, into which the received elements will be written, to the
813/// underlying call. \p Container must satisfy the following constraints:
814/// - provide a \c data() member function
815/// - provide a \c size() member function
816/// - expose \c value_type (which must be int).
817/// - if \p resize_policy is not BufferResizePolicy::no_resize, \p container additionally has to expose a
818/// `resize(unsigned int)` member function.
819///
820/// The receive buffer will be returned as part of the underlying call's result object if it is
821/// moved/passed by value (e.g. `recv_buf_out(std::move(container))`).
822///
823/// @tparam resize_policy Policy specifying whether (and if so, how) the underlying buffer shall be resized. The default
824/// resize policy is BufferResizePolicy::no_resize, indicating that the buffer should not be resized by KaMPIng.
825/// @tparam Container Container type which will contain the send displacements.
826/// @param container Container which will contain the send displacements.
827/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
828template <
830 typename Container,
831 typename Enable = std::enable_if_t<!internal::is_serialization_buffer_v<Container>>>
835 internal::BufferModifiability::modifiable,
836 internal::BufferType::out_buffer,
837 resize_policy>(std::forward<Container>(container));
838}
839
840/// @brief Passes a \p container, into which the received elements will be written, to the
841/// underlying call. \p Container must satisfy the following constraints:
842/// - provide a \c data() member function
843/// - provide a \c size() member function
844/// - expose \c value_type (which must be int).
845/// - if \p resize_policy is not BufferResizePolicy::no_resize, \p container additionally has to expose a
846/// `resize(unsigned int)` member function.
847///
848/// The receive buffer will be returned as part of the underlying call's result object if it is
849/// moved/passed by value (e.g. `recv_buf(std::move(container))`).
850///
851/// @tparam resize_policy Policy specifying whether (and if so, how) the underlying buffer shall be resized. The default
852/// resize policy is BufferResizePolicy::no_resize, indicating that the buffer should not be resized by KaMPIng.
853/// @tparam Container Container type which will contain the send displacements.
854/// @param container Container which will contain the send displacements.
855/// @see Alias for \ref recv_buf_out(Container&&).
856/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
857template <
859 typename Container,
860 typename Enable = std::enable_if_t<!internal::is_serialization_buffer_v<Container>>>
862 return recv_buf_out<resize_policy>(std::forward<Container>(container));
863}
864
865/// @brief Indicates to deserialize the received elements in the underlying call.
866///
867/// Example usage:
868/// ```cpp
869/// using dict_type = std::unordered_map<int, double>;
870/// recv_buf_out(kamping::as_deserializable<dict_type>());
871/// ```
872/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
873template <
875 typename Enable = std::enable_if_t<internal::is_serialization_buffer_v<SerializationBufferType>>>
879 internal::BufferModifiability::modifiable,
880 internal::BufferType::out_buffer,
881 BufferResizePolicy::resize_to_fit>(std::forward<SerializationBufferType>(buffer));
882}
883
884/// @brief Indicates to deserialize the received elements in the underlying call.
885///
886/// Example usage:
887/// ```cpp
888/// using dict_type = std::unordered_map<int, double>;
889/// recv_buf(kamping::as_deserializable<dict_type>());
890/// ```
891///
892/// @see Alias for \ref recv_buf_out(Container&&).
893/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
894template <
896 typename Enable = std::enable_if_t<internal::is_serialization_buffer_v<SerializationBufferType>>>
898 return recv_buf_out(std::forward<SerializationBufferType>(buffer));
899}
900
901/// @brief Indicates to construct a container of type \p Container, into which the received elements
902/// will be written, in the underlying call.
903///
904/// \p Container<int> must satisfy the following constraints:
905/// - provide a \c data() member function
906/// - provide a \c size() member function
907/// - provide a \c resize(unsigned int) member function
908/// - expose \c value_type.
909///
910/// The receive buffer will be returned as part of the underlying call's result object
911///
912/// @tparam Container Container type which will contains the send displacements.
913/// @return Parameter object referring to the storage which will contain the received elements.
914/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
915template <typename Container>
919 internal::BufferModifiability::modifiable,
920 internal::BufferType::out_buffer,
921 internal::maximum_viable_resize_policy<Container>>(alloc_new<Container>);
922}
923
924/// @brief Indicates to construct a container of type \p Container, into which the received elements
925/// will be written, in the underlying call.
926///
927/// \p Container<int> must satisfy the following constraints:
928/// - provide a \c data() member function
929/// - provide a \c size() member function
930/// - provide a \c resize(unsigned int) member function
931/// - expose \c value_type.
932///
933/// The receive buffer will be returned as part of the underlying call's result object.
934///
935/// @tparam Container Container type which will contains the send displacements.
936/// @return Parameter object referring to the storage which will contain the received elements.
937/// @see Alias for \ref recv_buf_out(Container&&).
938/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
939template <typename Container>
943
944/// @brief Indicates to construct a container with type \ref kamping::Communicator::default_container_type<\p
945/// ValueType>, into which the received elements will be written, in the underlying call.
946///
947/// The receive buffer will be returned as part of the underlying call's result object.
948///
949/// defaults to \ref Communicator::default_container_type.
950/// @tparam ValueType The type of the elements in the buffer.
951/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
952template <typename ValueType>
956 internal::BufferModifiability::modifiable,
957 internal::BufferType::out_buffer,
959}
960
961/// @brief Indicates to construct a container with type \ref kamping::Communicator::default_container_type<\p
962/// ValueType>, into which the received elements will be written, in the underlying call.
963///
964/// The receive buffer will be returned as part of the underlying call's result object.
965///
966/// defaults to \ref Communicator::default_container_type.
967/// @tparam ValueType The type of the elements in the buffer.
968/// @see Alias for \ref recv_buf_out(Container&&).
969/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
970template <typename ValueType>
974
975/// @brief Passes \p rank as root rank to the underlying call.
976/// This parameter is needed in functions like \c MPI_Gather.
977///
978/// @param rank The root rank.
979/// @return The corresponding parameter object.
980/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
981inline auto root(int rank) {
982 return internal::RootDataBuffer(rank);
983}
984
985/// @brief Passes \p rank as root rank to the underlying call.
986/// This parameter is needed in functions like \c MPI_Gather.
987///
988/// @param rank The root rank.
989/// @return The corresponding parameter object.
990/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
991inline auto root(size_t rank) {
992 return root(asserting_cast<int>(rank));
993}
994
995/// @brief Passes \p rank as destination rank to the underlying call.
996/// This parameter is needed in point-to-point exchange routines like \c MPI_Send.
997///
998/// @param rank The destination rank.
999/// @return The corresponding parameter object.
1000/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1004
1005/// @brief Passes \p rank as destination rank to the underlying call.
1006/// This parameter is needed in point-to-point exchange routines like \c MPI_Send.
1007///
1008/// @param rank The destination rank.
1009/// @return The corresponding parameter object.
1010/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1011inline auto destination(size_t rank) {
1012 return destination(asserting_cast<int>(rank));
1013}
1014
1015/// @brief Passes \c MPI_PROC_NULL as destination rank to the underlying call.
1016/// This parameter is needed in point-to-point exchange routines like \c MPI_Send.
1017///
1018/// @return The corresponding parameter object.
1019/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1023
1024/// @brief Passes \p rank as source rank to the underlying call.
1025/// This parameter is needed in point-to-point exchange routines like \c MPI_Recv.
1026///
1027/// @param rank The source rank.
1028/// @return The corresponding parameter object.
1029/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1033
1034/// @brief Passes \p rank as source rank to the underlying call.
1035/// This parameter is needed in point-to-point exchange routines like \c MPI_Recv.
1036///
1037/// @param rank The source rank.
1038/// @return The corresponding parameter object.
1039/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1040inline auto source(size_t rank) {
1041 return source(asserting_cast<int>(rank));
1042}
1043
1044/// @brief Indicates to use \c MPI_ANY_SOURCE as source rank in the underlying call, i.e. accepting any rank as source
1045/// rank. This parameter is needed in point-to-point exchange routines like \c MPI_Recv.
1046///
1047/// @return The corresponding parameter object.
1048/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1052
1053/// @brief Passes \c MPI_PROC_NULL as source rank to the underlying call.
1054/// This parameter is needed in point-to-point exchange routines like \c MPI_Recv.
1055///
1056/// @return The corresponding parameter object.
1057/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1061
1062/// @brief Indicates to use \c MPI_ANY_TAG as tag in the underlying call.
1063///
1064/// @return The corresponding parameter object.
1065/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1069
1070/// @brief Passes \p value as tag to the underlying call.
1071///
1072/// @param value The tag value.
1073/// @return The corresponding parameter object.
1074/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1075inline auto tag(int value) {
1077}
1078
1079/// @brief Converts the passed enum \p value to its integer representation and passes this value to the underlying call.
1080///
1081/// @param value The tag value.
1082/// @return The corresponding parameter object.
1083/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1084template <typename EnumType, typename = std::enable_if_t<std::is_enum_v<EnumType>>>
1085inline auto tag(EnumType value) {
1086 static_assert(
1087 std::is_convertible_v<std::underlying_type_t<EnumType>, int>,
1088 "The underlying enum type must be implicitly convertible to int."
1089 );
1090 return tag(static_cast<int>(value));
1091}
1092
1093/// @brief Indicates to use \c MPI_ANY_TAG as send tag in the underlying call.
1094///
1095/// @return The corresponding parameter object.
1096/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1100
1101/// @brief Passes \p value as send tag to the underlying call.
1102///
1103/// @param value The tag value.
1104/// @return The corresponding parameter object.
1105/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1109
1110/// @brief Converts the passed enum \p value to its integer representation and passes this value to the underlying call.
1111///
1112/// @param value The send tag value.
1113/// @return The corresponding parameter object.
1114/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1115template <typename EnumType, typename = std::enable_if_t<std::is_enum_v<EnumType>>>
1116inline auto send_tag(EnumType value) {
1117 static_assert(
1118 std::is_convertible_v<std::underlying_type_t<EnumType>, int>,
1119 "The underlying enum type must be implicitly convertible to int."
1120 );
1121 return send_tag(static_cast<int>(value));
1122}
1123
1124/// @brief Indicates to use \c MPI_ANY_TAG as recv tag in the underlying call.
1125///
1126/// @return The corresponding parameter object.
1127/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1131
1132/// @brief Passes \p value as recv tag to the underlying call.
1133///
1134/// @param value The tag value.
1135/// @return The corresponding parameter object.
1136/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1140
1141/// @brief Converts the passed enum \p value to its integer representation and passes this value to the underlying call.
1142///
1143/// @param value The recv tag value.
1144/// @return The corresponding parameter object.
1145/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1146template <typename EnumType, typename = std::enable_if_t<std::is_enum_v<EnumType>>>
1147inline auto recv_tag(EnumType value) {
1148 static_assert(
1149 std::is_convertible_v<std::underlying_type_t<EnumType>, int>,
1150 "The underlying enum type must be implicitly convertible to int."
1151 );
1152 return recv_tag(static_cast<int>(value));
1153}
1154
1155/// @brief Passes a request handle to the underlying MPI call.
1156/// @param request The request handle.
1157/// @return The corresponding parameter object.
1158/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1159inline auto request(Request& request) {
1163 internal::BufferModifiability::modifiable,
1164 internal::BufferType::out_buffer,
1166}
1167
1168/// @brief Passes a request from a \ref RequestPool to the underlying MPI call.
1169/// @param request The request handle.
1170/// @tparam IndexType The type of the index used by the \ref RequestPool for requests.
1171/// @return The corresponding parameter object.
1172/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1173template <typename IndexType>
1178 internal::BufferModifiability::modifiable,
1179 internal::BufferType::out_buffer,
1181}
1182
1183/// @brief Internally allocate a request object and return it to the user.
1184/// @return The corresponding parameter object.
1185/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1186inline auto request() {
1190 internal::BufferModifiability::modifiable,
1191 internal::BufferType::out_buffer,
1193}
1194
1195/// @brief Passes the send mode parameter for point to point communication to the underlying call.
1196/// Pass any of the tags from the \c kamping::send_modes namespace.
1197///
1198/// @return The corresponding parameter object.
1199/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1200template <typename SendModeTag>
1204
1205/// @brief Passes a reduction operation to ther underlying call. Accepts function objects, lambdas, function pointers or
1206/// native \c MPI_Op as argument.
1207///
1208/// @tparam Op the type of the operation
1209/// @tparam Commutative tag whether the operation is commutative
1210/// @param op the operation
1211/// @param commute the commutativity tag
1212/// May be any instance of \c commutative, \c or non_commutative. Passing \c undefined_commutative is only
1213/// supported for builtin and native operations. This is used to streamline the interface so that the use does not
1214/// have to provide commutativity info when the operation is builtin.
1215/// @return The corresponding parameter object.
1216/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1217template <typename Op, typename Commutative = ops::internal::undefined_commutative_tag>
1222
1223/// @brief Passes a container containing the value(s) to return on the first rank to \ref
1224/// kamping::Communicator::exscan().
1225///
1226/// @tparam Container Container type.
1227/// @param container Value(s) to return on the first rank.
1228/// @return The corresponding parameter object.
1229/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1230template <typename Container>
1234 internal::BufferModifiability::constant,
1235 internal::BufferType::in_buffer,
1236 BufferResizePolicy::no_resize>(std::forward<Container>(container));
1237}
1238
1239/// @brief Passes the data to be returned on the first rank in \c MPI_Exscan which is provided as an initializer list to
1240/// \ref kamping::Communicator::exscan().
1241///
1242/// @param values Value(s) to return on the first rank.
1243/// @return The corresponding parameter object.
1244/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1245template <typename T>
1246inline auto values_on_rank_0(std::initializer_list<T> values) {
1249 internal::BufferModifiability::constant,
1250 internal::BufferType::in_buffer,
1252}
1253
1254/// @brief Passes \p send_type as send type to the underlying call.
1255///
1256/// @param send_type MPI_Datatype to use in the wrapped \c MPI operation.
1257/// @return The corresponding parameter object.
1258/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1262 internal::BufferModifiability::constant,
1263 internal::BufferType::in_buffer,
1265 MPI_Datatype>(std::move(send_type));
1266}
1267
1268/// @brief Indicates to deduce the send type in the underlying call and return it as part of underlying call's result
1269/// object.
1270///
1271/// @return The corresponding parameter object.
1272/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1273inline auto send_type_out() {
1276 internal::BufferModifiability::modifiable,
1277 internal::BufferType::out_buffer,
1280}
1281
1282/// @brief Passes \p send_type, into which the send type deduced by KaMPIng will be written, to the underlying call.
1283/// The type will be stored at the location referred to by the provided reference.
1284///
1285/// @param send_type Reference to the location at which the deduced MPI_Datatype will be stored.
1286/// @return The corresponding parameter object.
1287/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1291 internal::BufferModifiability::modifiable,
1292 internal::BufferType::out_buffer,
1295}
1296
1297/// @brief Passes \p recv_type as recv type to the underlying call.
1298///
1299/// @param recv_type MPI_Datatype to use in the wrapped \c MPI function.
1300/// @return The corresponding parameter object.
1301/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1305 internal::BufferModifiability::constant,
1306 internal::BufferType::in_buffer,
1308 MPI_Datatype>(std::move(recv_type));
1309}
1310
1311/// @brief Indicates to deduce the receive type in the underlying call and return it as part of underlying call's result
1312/// object.
1313///
1314/// @return The corresponding parameter object.
1315/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1316inline auto recv_type_out() {
1319 internal::BufferModifiability::modifiable,
1320 internal::BufferType::out_buffer,
1323}
1324
1325/// @brief Passes \p recv_type, into which the recv type deduced by KaMPIng will be written, to the underlying call.
1326/// The type will be stored at the location referred to by the provided reference.
1327///
1328/// @param recv_type Reference to the location at which the deduced MPI_Datatype will be stored.
1329/// @return The corresponding parameter object.
1330/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1334 internal::BufferModifiability::modifiable,
1335 internal::BufferType::out_buffer,
1338}
1339
1340/// @brief Passes \p send_recv_type as send/recv type to the underlying call.
1341/// (This parameter is in \c MPI routines such as \c MPI_Bcast, ... .)
1342///
1343/// @param send_recv_type MPI_Datatype to use in the wrapped \c MPI operation.
1344/// @return The corresponding parameter object.
1345/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1349 internal::BufferModifiability::constant,
1350 internal::BufferType::in_buffer,
1352 MPI_Datatype>(std::move(send_recv_type));
1353}
1354
1355/// @brief Indicates to deduce the send/recv type in the underlying call and return it as part of underlying call's
1356/// result object.
1357/// (This parameter is used in \c MPI routines such as \c MPI_Bcast, ... .)
1358///
1359/// @return The corresponding parameter object.
1360/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1361inline auto send_recv_type_out() {
1364 internal::BufferModifiability::modifiable,
1365 internal::BufferType::out_buffer,
1368}
1369
1370/// @brief Passes \p send_recv_type, into which the send/recv type deduced by KaMPIng will be written, to the underlying
1371/// call. The type will be stored at the location referred to by the provided reference. (This parameter is used in \c
1372/// MPI routines such as \c MPI_Bcast, ... .)
1373///
1374/// @param send_recv_type Reference to the location at which the deduced MPI_Datatype will be stored.
1375/// @return The corresponding parameter object.
1376/// @see \ref docs/parameter_handling.md for general information about parameter handling in KaMPIng.
1380 internal::BufferModifiability::modifiable,
1381 internal::BufferType::out_buffer,
1384}
1385/// @}
1386
1387} // namespace params
1388using namespace params;
1389} // 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
Parameter wrapping an operation passed to reduce-like MPI collectives. This wraps an MPI operation wi...
Definition operation_builder.hpp:38
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:514
constexpr BufferResizePolicy resize_to_fit
Definition data_buffer.hpp:305
BufferResizePolicy
Enum to specify in which cases a buffer is resized.
Definition data_buffer.hpp:291
@ no_resize
Policy indicating that the underlying buffer shall never be resized.
auto send_mode(SendModeTag)
Passes the send mode parameter for point to point communication to the underlying call....
Definition named_parameters.hpp:1201
auto recv_displs_out()
Indicates to construct a container with type kamping::Communicator::default_container_type<int>,...
Definition named_parameters.hpp:804
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:699
auto request()
Internally allocate a request object and return it to the user.
Definition named_parameters.hpp:1186
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:576
auto tag(internal::any_tag_t)
Indicates to use MPI_ANY_TAG as tag in the underlying call.
Definition named_parameters.hpp:1066
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 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:981
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:205
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_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:1361
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:1273
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:1316
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:139
auto send_count(int count)
Passes count as send count to the underlying call.
Definition named_parameters.hpp:323
auto send_displs_out()
Indicates to construct a container with type kamping::Communicator::default_container_type<int>,...
Definition named_parameters.hpp:681
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:832
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:557
auto recv_count(int count)
Passes count as recv count to the underlying call.
Definition named_parameters.hpp:492
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:1346
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 send_counts_out()
Indicates to construct a container with type kamping::Communicator::default_container_type<int>,...
Definition named_parameters.hpp:311
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_counts_out()
Indicates to construct a container with type kamping::Communicator::default_container_type<int>,...
Definition named_parameters.hpp:480
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:1219
auto recv_type(MPI_Datatype recv_type)
Passes recv_type as recv type to the underlying call.
Definition named_parameters.hpp:1302
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:368
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 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:117
auto send_recv_count(int count)
Passes count as send/recv count to the underlying call.
Definition named_parameters.hpp:531
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 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:1231
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
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:275
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:798
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