TRIQS/mpi
2.0.0
C++ interface to MPI
Toggle main menu visibility
Loading...
Searching...
No Matches
pair.hpp
Go to the documentation of this file.
1
// Copyright (c) 2021-2024 Simons Foundation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0.txt
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
//
15
// Authors: Thomas Hahn, Nils Wentzell
16
21
22
#pragma once
23
24
#include "
./mpi.hpp
"
25
26
#include <mpi.h>
27
28
#include <utility>
29
30
namespace
mpi {
31
36
48
template
<
typename
T1,
typename
T2>
void
mpi_broadcast
(std::pair<T1, T2> &p,
communicator
c = {},
int
root = 0) {
49
broadcast
(p.first, c, root);
50
broadcast
(p.second, c, root);
51
}
52
67
template
<
typename
T1,
typename
T2>
68
auto
mpi_reduce
(std::pair<T1, T2>
const
&p,
communicator
c = {},
int
root = 0,
bool
all =
false
, MPI_Op op = MPI_SUM) {
69
return
std::make_pair(
reduce
(p.first, c, root, all, op),
reduce
(p.second, c, root, all, op));
70
}
71
73
74
}
// namespace mpi
mpi::communicator
C++ wrapper around MPI_Comm providing various convenience functions.
Definition
communicator.hpp:51
mpi::mpi_reduce
auto mpi_reduce(std::array< T, N > const &arr, communicator c={}, int root=0, bool all=false, MPI_Op op=MPI_SUM)
Implementation of an MPI reduce for a std::array.
Definition
array.hpp:74
mpi::reduce
decltype(auto) reduce(T &&x, communicator c={}, int root=0, bool all=false, MPI_Op op=MPI_SUM)
Generic MPI reduce.
Definition
generic_communication.hpp:90
mpi::mpi_broadcast
void mpi_broadcast(std::array< T, N > &arr, communicator c={}, int root=0)
Implementation of an MPI broadcast for a std::array.
Definition
array.hpp:53
mpi::broadcast
void broadcast(T &&x, communicator c={}, int root=0)
Generic MPI broadcast.
Definition
generic_communication.hpp:68
mpi.hpp
Includes all relevant mpi headers.
mpi
pair.hpp
Generated by
1.17.0