forked from trilinos/Trilinos
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #110 from NexGenAnalytics/96-pamgen-remove-use-of-…
…MPI_COMM_WORLD #96: Remove use of MPI_COMM_WORLD in Pamgen package
- Loading branch information
Showing
3 changed files
with
36 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
#ifndef PAMGEN_GLOBAL_COMM_HPP | ||
#define PAMGEN_GLOBAL_COMM_HPP | ||
|
||
#ifdef HAVE_MPI | ||
|
||
#include <mpi.h> | ||
#include <mutex> | ||
|
||
namespace PAMGEN_NEVADA { | ||
|
||
static std::mutex mpi_mutex; | ||
static MPI_Comm Global_MPI_Comm = MPI_COMM_WORLD; | ||
|
||
inline void initialize_global_comm(MPI_Comm comm) { | ||
std::lock_guard<std::mutex> guard(mpi_mutex); | ||
Global_MPI_Comm = comm; | ||
} | ||
|
||
inline MPI_Comm get_global_comm() { | ||
std::lock_guard<std::mutex> guard(mpi_mutex); | ||
return Global_MPI_Comm; | ||
} | ||
|
||
} | ||
|
||
#endif // HAVE_MPI | ||
#endif // PAMGEN_GLOBAL_COMM_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters