Belos Version of the Day
Loading...
Searching...
No Matches
BelosGlobalComm.hpp
Go to the documentation of this file.
1// @HEADER
2// *****************************************************************************
3// Belos: Block Linear Solvers Package
4//
5// Copyright 2004-2016 NTESS and the Belos contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8// @HEADER
9
10#ifndef BELOS_GLOBAL_COMM_HPP
11#define BELOS_GLOBAL_COMM_HPP
12
13#ifdef HAVE_MPI
14
15#include <mpi.h>
16#include <mutex>
17
18namespace Belos {
19
20static std::mutex mpi_mutex;
21static MPI_Comm Global_MPI_Comm = MPI_COMM_WORLD; // CHECK: ALLOW MPI_COMM_WORLD
22
23inline void initialize_global_comm(MPI_Comm comm) {
24 std::lock_guard<std::mutex> guard(mpi_mutex);
25 Global_MPI_Comm = comm;
26}
27
28inline MPI_Comm get_global_comm() {
29 std::lock_guard<std::mutex> guard(mpi_mutex);
30 return Global_MPI_Comm;
31}
32
33}
34
35#endif // HAVE_MPI
36#endif // BELOS_GLOBAL_COMM_HPP

Generated for Belos by doxygen 1.9.8