-
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.
better MPI management and possibility to use Flock files in bedrock-q…
…uery and bedrock-shutdown
- Loading branch information
Showing
10 changed files
with
132 additions
and
47 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
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
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,15 @@ | ||
/* | ||
* (C) 2024 The University of Chicago | ||
* | ||
* See COPYRIGHT in top-level directory. | ||
*/ | ||
#include "MPI.hpp" | ||
|
||
namespace bedrock { | ||
|
||
#ifdef ENABLE_MPI | ||
bool MPI::s_initialized_mpi; | ||
size_t MPI::s_initiaze_mpi_count; | ||
#endif | ||
|
||
} // namespace bedrock |
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,53 @@ | ||
/* | ||
* (C) 2024 The University of Chicago | ||
* | ||
* See COPYRIGHT in top-level directory. | ||
*/ | ||
#ifndef __BEDROCK_MPI_H | ||
#define __BEDROCK_MPI_H | ||
|
||
#include <iostream> | ||
#ifdef ENABLE_MPI | ||
#include <mpi.h> | ||
#endif | ||
|
||
namespace bedrock { | ||
|
||
class MPI { | ||
|
||
#ifdef ENABLE_MPI | ||
static bool s_initialized_mpi; | ||
static size_t s_initiaze_mpi_count; | ||
#endif | ||
|
||
public: | ||
|
||
MPI() { | ||
#ifdef ENABLE_MPI | ||
int mpi_is_initialized; | ||
MPI_Initialized(&mpi_is_initialized); | ||
if(!mpi_is_initialized) { | ||
MPI_Init(nullptr, nullptr); | ||
s_initialized_mpi = true; | ||
} | ||
if(s_initialized_mpi) | ||
s_initiaze_mpi_count += 1; | ||
#endif | ||
} | ||
|
||
~MPI() { | ||
#ifdef ENABLE_MPI | ||
if(s_initialized_mpi) { | ||
s_initiaze_mpi_count -= 1; | ||
if(s_initiaze_mpi_count == 0) { | ||
//MPI_Finalize(); | ||
} | ||
s_initialized_mpi = false; | ||
} | ||
#endif | ||
} | ||
}; | ||
|
||
} // namespace bedrock | ||
|
||
#endif |
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
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