MRMD 0.4.0
Multi Resolution Molecular Dynamics
Loading...
Searching...
No Matches
MPIInfo.hpp
Go to the documentation of this file.
1// Copyright 2024 Sebastian Eibl
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// https://www.apache.org/licenses/LICENSE-2.0
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#pragma once
16
17#include "mpi_helper.hpp"
18
19namespace mrmd::data
20{
21#ifdef MRMD_ENABLE_MPI
22struct MPIInfo
23{
24 MPI_Comm comm = MPI_COMM_NULL;
25 int rank = -1;
26 int size = -1;
27
28 explicit MPIInfo(MPI_Comm communicator = MPI_COMM_WORLD)
29 {
30 comm = communicator;
31 CHECK_MPI(MPI_Comm_rank(communicator, &rank));
32 CHECK_MPI(MPI_Comm_size(communicator, &size));
33 }
34};
35#else
36struct MPIInfo
37{
38 int comm = -1;
39 int rank = 1;
40 int size = 1;
41};
42#endif
43} // namespace mrmd::data
Definition Array.hpp:18
void CHECK_MPI(const int &status)
Definition mpi_helper.hpp:22
Definition MPIInfo.hpp:37
int size
Definition MPIInfo.hpp:40
int rank
Definition MPIInfo.hpp:39
int comm
Definition MPIInfo.hpp:38