7#ifdef NF_WITH_MPI_SUPPORT
21#ifdef NF_WITH_MPI_SUPPORT
38 Init(
int argc,
char** argv)
40#ifdef NF_REQUIRE_MPI_THREAD_SUPPORT
42 MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &provided);
44 provided == MPI_THREAD_MULTIPLE,
"The MPI library does not have full thread support"
47 MPI_Init(&argc, &argv);
54 ~Init() { MPI_Finalize(); }
71 Environment(MPI_Comm commGroup = MPI_COMM_WORLD) : communicator(commGroup)
73 MPI_Initialized(&mpiInitialized);
75 if (std::getenv(
"NEON_FORCE_HOST_BUFFER") !=
nullptr) gpuAwareMpi_ =
false;
81 ~Environment() =
default;
88 bool isInitialized()
const {
return mpiInitialized == 1; }
109 MPI_Comm comm()
const {
return communicator; }
117 bool gpuAwareMpi()
const {
return gpuAwareMpi_; }
122 bool& gpuAwareMpi() {
return gpuAwareMpi_; }
126 MPI_Comm communicator {MPI_COMM_NULL};
127 int mpiInitialized {0};
130 bool gpuAwareMpi_ {
true};
135 void updateRankData()
139 MPI_Comm_rank(communicator, &mpiRank);
140 MPI_Comm_size(communicator, &mpiSize);
#define NF_ASSERT(condition, message)
Macro for asserting a condition and printing an error message if the condition is false.
Integer types used throughout NeoN.