Skip to content

Commit

Permalink
edits from review
Browse files Browse the repository at this point in the history
  • Loading branch information
kab163 committed Feb 4, 2025
1 parent b5d0fdf commit 06b344e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/umpire/Umpire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,16 +256,17 @@ void* find_pointer_from_name(Allocator allocator, const std::string& name)

#if defined(UMPIRE_ENABLE_MPI)
namespace {
static std::map<int, MPI_Comm> cached_communicators{};

std::map<int, MPI_Comm>& get_cached_communicators()
{
static std::map<int, MPI_Comm> cached_communicators{};
return cached_communicators;
}
} // namespace

MPI_Comm get_communicator_for_allocator(Allocator a, MPI_Comm comm)
{
std::map<int, MPI_Comm>& cached_communicators = get_cached_communicators();

MPI_Comm c;
auto scope = a.getAllocationStrategy()->getTraits().scope;
int id = a.getId();
Expand All @@ -292,6 +293,8 @@ void cleanup_cached_communicators()
for (auto c : comm) {
MPI_Comm_free(&c.second);
}

comm.clear();
}
#endif

Expand Down

0 comments on commit 06b344e

Please sign in to comment.