miompi.h Source File

CPP API: miompi.h Source File
miompi.h
Go to the documentation of this file.
1 /*
2 * Copyright (C) 2020-2026 MEmilio
3 *
4 * Authors: Daniel Abele
5 *
6 * Contact: Martin J. Kuehn <Martin.Kuehn@DLR.de>
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20 #ifndef MIO_UTILS_MPI_H
21 #define MIO_UTILS_MPI_H
22 
23 #include "memilio/config.h" // IWYU pragma: keep
24 
25 #ifdef MEMILIO_ENABLE_MPI
26 #include "mpi.h"
27 #endif
28 
29 namespace mio
30 {
31 namespace mpi
32 {
37 #ifdef MEMILIO_ENABLE_MPI
38 using Comm = MPI_Comm;
39 #else
40 using Comm = void*;
41 #endif
42 
46 Comm get_world();
47 
51 void init();
52 
56 void finalize();
57 
61 bool is_root();
62 
67 int rank(Comm comm);
68 
73 int size(Comm comm);
74 
75 } // namespace mpi
76 } // namespace mio
77 
78 #endif
Comm get_world()
Get the global MPI communicator.
Definition: miompi.cpp:32
bool is_root()
Returns true if the calling process is the root process.
Definition: miompi.cpp:58
void * Comm
Alias for MPI_Comm, to be used in APIs to avoid having to use #ifdef everywhere.
Definition: miompi.h:40
int size(Comm comm)
Return the size of the given communicator.
Definition: miompi.cpp:75
int rank(Comm comm)
Return the rank of the calling process on the given communicator.
Definition: miompi.cpp:63
void init()
Initialize MPI.
Definition: miompi.cpp:42
void finalize()
Finalize MPI.
Definition: miompi.cpp:51
A collection of classes to simplify handling of matrix shapes in meta programming.
Definition: models/abm/analyze_result.h:30