KaMPIng 0.1.1
Flexible and (near) zero-overhead C++ bindings for MPI
Loading...
Searching...
No Matches
status_parameters.hpp
1
2// This file is part of KaMPIng.
3//
4// Copyright 2023-2024 The KaMPIng Authors
5//
6// KaMPIng is free software : you can redistribute it and/or modify it under the terms of the GNU Lesser General Public
7// License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
8// version. KaMPIng is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
9// implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
10// for more details.
11//
12// You should have received a copy of the GNU Lesser General Public License along with KaMPIng. If not, see
13// <https://www.gnu.org/licenses/>.
14
15#pragma once
16
17#include <mpi.h>
18
21#include "kamping/status.hpp"
22
23namespace kamping {
24namespace params {
25/// @addtogroup kamping_mpi_utility
26/// @{
27
28/// @brief Outputs the return status of the operation to the provided status object. The status object may be passed as
29/// lvalue-reference or rvalue.
30/// @tparam StatusObject type of the status object, may either be \c MPI_Status or \ref kamping::Status
31/// @param status The status object.
32template <typename StatusObject>
34 using status_type = std::remove_cv_t<std::remove_reference_t<StatusObject>>;
38 internal::BufferModifiability::modifiable,
39 internal::BufferType::out_buffer,
40 no_resize>(std::forward<StatusObject>(status));
41}
42
43/// @brief Constructs a status object internally, which may then be retrieved from \c kamping::MPIResult returned by the
44/// operation.
45inline auto status_out() {
48 internal::BufferModifiability::modifiable,
49 internal::BufferType::out_buffer,
51}
52
53/// @brief pass \c MPI_STATUS_IGNORE to the underlying MPI call.
55 return internal::
56 make_empty_data_buffer_builder<Status, internal::ParameterType::status, internal::BufferType::ignore>();
57}
58
59/// @brief pass \c MPI_STATUSES_IGNORE to the underlying MPI call.
61 return internal::
62 make_empty_data_buffer_builder<MPI_Status, internal::ParameterType::statuses, internal::BufferType::ignore>();
63}
64
65/// @brief Pass a \p Container of \c MPI_Status to the underlying MPI call in which the statuses are stored upon
66/// completion. The container may be resized according the provided \p resize_policy.
67///
68/// @tparam resize_policy Policy specifying whether (and if so, how) the underlying buffer shall be resized. The default
69/// @tparam Container the container type to use for the statuses.
70template <BufferResizePolicy resize_policy = BufferResizePolicy::no_resize, typename Container>
74 internal::BufferModifiability::modifiable,
75 internal::BufferType::out_buffer,
76 resize_policy,
77 MPI_Status>(std::forward<Container>(container));
78}
79
80/// @brief Internally construct a new \p Container of \c MPI_Status, which will hold the returned statuses.
81template <typename Container>
85 internal::BufferModifiability::modifiable,
86 internal::BufferType::out_buffer,
89}
90
91/// @brief Internally construct a new \p Container<MPI_Status> which will hold the returned statuses.
92template <template <typename...> typename Container>
96 internal::BufferModifiability::modifiable,
97 internal::BufferType::out_buffer,
100}
101
102/// @brief Internally construct a container of \c MPI_Status, which will hold the returned statuses. The container's
103/// type is usually determined by operations called on a \ref RequestPool, and defaults to \ref
104/// RequestPool::default_container_type.
105inline auto statuses_out() {
108 internal::BufferModifiability::modifiable,
109 internal::BufferType::out_buffer,
112}
113
114/// @}
115} // namespace params
116using namespace params;
117} // namespace kamping
STL-compatible allocator for requesting memory using the builtin MPI allocator.
Definition allocator.hpp:32
auto status_out()
Constructs a status object internally, which may then be retrieved from kamping::MPIResult returned b...
Definition status_parameters.hpp:45
constexpr BufferResizePolicy resize_to_fit
Definition data_buffer.hpp:305
auto statuses_out()
Internally construct a container of MPI_Status, which will hold the returned statuses....
Definition status_parameters.hpp:105
auto status(internal::ignore_t< void >)
pass MPI_STATUS_IGNORE to the underlying MPI call.
Definition status_parameters.hpp:54
auto statuses(internal::ignore_t< void >)
pass MPI_STATUSES_IGNORE to the underlying MPI call.
Definition status_parameters.hpp:60
constexpr BufferResizePolicy no_resize
Definition data_buffer.hpp:299
@ status
Tag used to represent the status in a MPI call.
@ statuses
Tag used to represent a container of statuses in a MPI call.
auto make_data_buffer_builder(Data &&data)
Factory method for constructing a DataBufferBuilder from the given Container Data.
Definition parameter_objects.hpp:225
Parameter objects return by named parameter factory functions.
Tag type for parameters that can be omitted on some PEs (e.g., root PE, or non-root PEs).
Definition parameter_objects.hpp:336
Helper type for representing a type list.
Definition parameter_objects.hpp:326