|
DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
|
Singleton that tracks and releases long-lived MPI resources at MPI_Finalize time.
More...
#include <MPI.hpp>
Public Member Functions | |
| void | RegisterCleaner (void *p, std::function< void()> nCleaner) |
Register a cleanup callback keyed by p. | |
| void | RemoveCleaner (void *p) |
| Remove a previously-registered cleaner. | |
| void | clean () |
Invoke all registered cleaners and drop them. Called by MPI::Finalize(). | |
Static Public Member Functions | |
| static ResourceRecycler & | Instance () |
| Access the process-wide singleton. | |
Singleton that tracks and releases long-lived MPI resources at MPI_Finalize time.
MPI communicators, derived datatypes, and persistent requests must be released before MPI_Finalize; otherwise they leak memory and MPICH prints warnings. Several DNDSR objects (MPITypePairHolder, MPIReqHolder) register themselves here so that MPI::Finalize() can call their cleanup callbacks even if the C++ lifetime would outlive the MPI runtime (e.g., static destructors).
Thread-safe C++11 singleton. Intended to be created under MPI_COMM_WORLD.
| void DNDS::MPI::ResourceRecycler::clean | ( | ) |
Invoke all registered cleaners and drop them. Called by MPI::Finalize().
Definition at line 328 of file MPI.cpp.
|
static |
| void DNDS::MPI::ResourceRecycler::RegisterCleaner | ( | void * | p, |
| std::function< void()> | nCleaner | ||
| ) |
Register a cleanup callback keyed by p.
p is destroyed, else dangling pointers will be invoked by clean. Definition at line 316 of file MPI.cpp.
| void DNDS::MPI::ResourceRecycler::RemoveCleaner | ( | void * | p | ) |