KaMPIng 0.1.0
(Near) zero-overhead C++ MPI bindings.
Loading...
Searching...
No Matches
ibarrier.hpp
1// This file is part of KaMPIng.
2//
3// Copyright 2023 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
18#include "kamping/communicator.hpp"
25#include "kamping/request.hpp"
26#include "kamping/result.hpp"
27
28/// @addtogroup kamping_collectives
29/// @{
30
31/// @brief Perform a non-blocking barrier synchronization on this communicator using \c MPI_Ibarrier. The call is
32/// associated with a \ref kamping::Request (either allocated by KaMPIng or provided by the user). Only when the request
33/// has completed, it is guaranteed that all ranks have reached the barrier.
34///
35/// The following parameters are optional:
36/// - \ref kamping::request() The request object to associate this operation with. Defaults to a library allocated
37/// request object, which can be accessed via the returned result.
38///
39/// @tparam Args Automatically deduced template parameters.
40/// @param args All required and any number of the optional buffers described above.
41template <
42 template <typename...>
43 typename DefaultContainerType,
44 template <typename, template <typename...> typename>
45 typename... Plugins>
46template <typename... Args>
48 using namespace kamping::internal;
50
51 using default_request_param = decltype(kamping::request());
52 auto&& request_param =
53 internal::select_parameter_type_or_default<internal::ParameterType::request, default_request_param>(
54 std::tuple{},
55 args...
56 );
57
59 mpi_communicator(), // comm
60 &request_param.underlying().mpi_request() // request
61 );
62 this->mpi_error_hook(err, "MPI_Ibarrier");
63
64 return internal::make_nonblocking_result<std::tuple<Args...>>(std::move(request_param));
65}
66/// @}
STL-compatible allocator for requesting memory using the builtin MPI allocator.
Definition allocator.hpp:32
Code for error handling.
auto ibarrier(Args... args) const
Perform a non-blocking barrier synchronization on this communicator using MPI_Ibarrier....
Definition ibarrier.hpp:47
auto request()
Internally allocate a request object and return it to the user.
Definition named_parameters.hpp:1122
Template magic to check named parameters passed to wrappers at compile time.
#define KAMPING_REQUIRED_PARAMETERS(...)
Wrapper to pass (possibly empty) list of parameter type names as required parameters to KAMPING_CHECK...
Definition named_parameter_check.hpp:52
#define KAMPING_OPTIONAL_PARAMETERS(...)
Wrapper to pass (possibly empty) list of parameter type names as optional parameters to KAMPING_CHECK...
Definition named_parameter_check.hpp:58
#define KAMPING_CHECK_PARAMETERS(args, required, optional)
Assertion macro that checks if passed parameters are correct, i.e., all parameter types are unique,...
Definition named_parameter_check.hpp:80
Template magic to implement named parameters in cpp.
File containing the parameter types used by the KaMPIng library.
Factory methods for buffer wrappers.
Internal namespace marking the code that is not user-facing.
Definition collectives_helpers.hpp:20
auto make_nonblocking_result(Args... args)
Factory for creating a kamping::NonBlockingResult.
Definition result.hpp:1121
Parameter objects return by named parameter factory functions.
Some functions and types simplifying/enabling the development of wrapped MPI calls in KaMPIng.