KaMPIng 0.1.1
Flexible and (near) zero-overhead C++ bindings for MPI
Loading...
Searching...
No Matches
status_parameters.hpp
1// This file is part of KaMPIng.
2//
3// Copyright 2023-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
14#pragma once
15
16#include <mpi.h>
17
20#include "kamping/status.hpp"
21
22namespace kamping {
23/// @addtogroup kamping_mpi_utility
24/// @{
25
26/// @brief Outputs the return status of the operation to the provided status object. The status object may be passed as
27/// lvalue-reference or rvalue.
28/// @tparam StatusObject type of the status object, may either be \c MPI_Status or \ref kamping::Status
29/// @param status The status object.
30template <typename StatusObject>
32 using status_type = std::remove_cv_t<std::remove_reference_t<StatusObject>>;
36 internal::BufferModifiability::modifiable,
37 internal::BufferType::out_buffer,
38 no_resize>(std::forward<StatusObject>(status));
39}
40
41/// @brief Constructs a status object internally, which may then be retrieved from \c kamping::MPIResult returned by the
42/// operation.
43inline auto status_out() {
46 internal::BufferModifiability::modifiable,
47 internal::BufferType::out_buffer,
49}
50
51/// @brief pass \c MPI_STATUS_IGNORE to the underlying MPI call.
53 return internal::
54 make_empty_data_buffer_builder<Status, internal::ParameterType::status, internal::BufferType::ignore>();
55}
56
57/// @brief pass \c MPI_STATUSES_IGNORE to the underlying MPI call.
59 return internal::
60 make_empty_data_buffer_builder<MPI_Status, internal::ParameterType::statuses, internal::BufferType::ignore>();
61}
62
63/// @brief Pass a \p Container of \c MPI_Status to the underlying MPI call in which the statuses are stored upon
64/// completion. The container may be resized according the provided \p resize_policy.
65///
66/// @tparam resize_policy Policy specifying whether (and if so, how) the underlying buffer shall be resized. The default
67/// @tparam Container the container type to use for the statuses.
68template <BufferResizePolicy resize_policy = BufferResizePolicy::no_resize, typename Container>
72 internal::BufferModifiability::modifiable,
73 internal::BufferType::out_buffer,
74 resize_policy,
75 MPI_Status>(std::forward<Container>(container));
76}
77
78/// @brief Internally construct a new \p Container of \c MPI_Status, which will hold the returned statuses.
79template <typename Container>
83 internal::BufferModifiability::modifiable,
84 internal::BufferType::out_buffer,
87}
88
89/// @brief Internally construct a new \p Container<MPI_Status> which will hold the returned statuses.
90template <template <typename...> typename Container>
94 internal::BufferModifiability::modifiable,
95 internal::BufferType::out_buffer,
98}
99
100/// @brief Internally construct a container of \c MPI_Status, which will hold the returned statuses. The container's
101/// type is usually determined by operations called on a \ref RequestPool, and defaults to \ref
102/// RequestPool::default_container_type.
103inline auto statuses_out() {
106 internal::BufferModifiability::modifiable,
107 internal::BufferType::out_buffer,
110}
111
112/// @}
113} // namespace kamping
STL-compatible allocator for requesting memory using the builtin MPI allocator.
Definition allocator.hpp:32
constexpr BufferResizePolicy resize_to_fit
Definition data_buffer.hpp:305
auto status_out()
Constructs a status object internally, which may then be retrieved from kamping::MPIResult returned b...
Definition status_parameters.hpp:43
auto statuses_out()
Internally construct a container of MPI_Status, which will hold the returned statuses....
Definition status_parameters.hpp:103
auto status(internal::ignore_t< void >)
pass MPI_STATUS_IGNORE to the underlying MPI call.
Definition status_parameters.hpp:52
constexpr BufferResizePolicy no_resize
Definition data_buffer.hpp:299
auto statuses(internal::ignore_t< void >)
pass MPI_STATUSES_IGNORE to the underlying MPI call.
Definition status_parameters.hpp:58
@ 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