MeDiPack  1.2.2
A Message Differentiation Package
SciComp TU Kaiserslautern
Loading...
Searching...
No Matches
mpiTools.h
Go to the documentation of this file.
1/*
2 * MeDiPack, a Message Differentiation Package
3 *
4 * Copyright (C) 2015-2023 Chair for Scientific Computing (SciComp), University of Kaiserslautern-Landau
5 * Homepage: http://www.scicomp.uni-kl.de
6 * Contact: Prof. Nicolas R. Gauger (codi@scicomp.uni-kl.de)
7 *
8 * Lead developers: Max Sagebaum (SciComp, University of Kaiserslautern-Landau)
9 *
10 * This file is part of MeDiPack (http://www.scicomp.uni-kl.de/software/codi).
11 *
12 * MeDiPack is free software: you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation, either
15 * version 3 of the License, or (at your option) any later version.
16 *
17 * MeDiPack is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 * See the GNU Lesser General Public License for more details.
22 * You should have received a copy of the GNU
23 * Lesser General Public License along with MeDiPack.
24 * If not, see <http://www.gnu.org/licenses/>.
25 *
26 * Authors: Max Sagebaum, Tim Albring (SciComp, University of Kaiserslautern-Landau)
27 */
28
29#pragma once
30
31
32#include <mpi.h>
33
34#include "macros.h"
35#include "typeDefinitions.h"
36
40namespace medi {
41
42 namespace common {
43 typedef int Range[3];
44 }
45
46
52 inline int getCommRank(MPI_Comm comm) {
53 int rank;
54 MEDI_CHECK_ERROR(MPI_Comm_rank(comm, &rank));
55
56 return rank;
57 }
58
64 inline int getCommSize(MPI_Comm comm) {
65 int size;
66 MEDI_CHECK_ERROR(MPI_Comm_size(comm, &size));
67
68 return size;
69 }
70}
#define MEDI_CHECK_ERROR(expr)
Definition: macros.h:109
int Range[3]
Definition: mpiTools.h:43
Global namespace for MeDiPack - Message Differentiation Package.
Definition: adjointInterface.hpp:37
int getCommSize(MPI_Comm comm)
Helper function that gets the number of ranks from the communicator.
Definition: mpiTools.h:64
int getCommRank(MPI_Comm comm)
Helper function that gets the own rank number from the communicator.
Definition: mpiTools.h:52