KaMPIng 0.1.1
Flexible and (near) zero-overhead C++ bindings for MPI
Loading...
Searching...
No Matches
barrier.hpp
1// This file is part of KaMPIng.
2//
3// Copyright 2022-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
18#include "kamping/communicator.hpp"
20/// @addtogroup kamping_collectives
21/// @{
22
23/// @brief Perform a \c MPI_Barrier on this communicator.
24///
25/// Barrier takes no parameters. Any parameters passed will cause a compilation error.
26///
27/// The parameter pack prohibits the compiler from compiling this function when it's not used.
28template <
29 template <typename...>
30 typename DefaultContainerType,
31 template <typename, template <typename...> typename>
32 typename... Plugins>
33template <typename... Args>
35 using namespace kamping::internal;
36 static_assert(sizeof...(args) == 0, "You may not pass any arguments to barrier().");
37
38 [[maybe_unused]] int err = MPI_Barrier(mpi_communicator());
39 this->mpi_error_hook(err, "MPI_Barrier");
40}
41/// @}
STL-compatible allocator for requesting memory using the builtin MPI allocator.
Definition allocator.hpp:32
Code for error handling.
void barrier(Args... args) const
Perform a MPI_Barrier on this communicator.
Definition barrier.hpp:34
Internal namespace marking the code that is not user-facing.
Definition collectives_helpers.hpp:20