From 33d92a47bd181035bd9dcf58ca4cf3cfa6817ab0 Mon Sep 17 00:00:00 2001 From: Ben Ryan Date: Thu, 16 May 2024 10:09:11 -0600 Subject: [PATCH] Revert "Trying to split off swarm tags from field tags" This reverts commit 09a62fa30900cd5bbc226f3ef307b7e98ffcf471. --- src/bvals/bvals.cpp | 4 ++-- src/bvals/comms/tag_map.cpp | 22 +--------------------- src/bvals/comms/tag_map.hpp | 2 -- 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/src/bvals/bvals.cpp b/src/bvals/bvals.cpp index 0cac7c5de03a..bef53380dc05 100644 --- a/src/bvals/bvals.cpp +++ b/src/bvals/bvals.cpp @@ -75,8 +75,8 @@ void BoundarySwarm::SetupPersistentMPI() { NeighborBlock &nb = pmb->neighbors[n]; // Neighbor on different MPI process if (nb.rank != Globals::my_rank) { - send_tag[nb.bufid] = pmb->pmy_mesh->tag_map.GetSwarmTag(pmb.get(), nb); - recv_tag[nb.bufid] = pmb->pmy_mesh->tag_map.GetSwarmTag(pmb.get(), nb); + send_tag[nb.bufid] = pmb->pmy_mesh->tag_map.GetTag(pmb.get(), nb); + recv_tag[nb.bufid] = pmb->pmy_mesh->tag_map.GetTag(pmb.get(), nb); if (bd_var_.req_send[nb.bufid] != MPI_REQUEST_NULL) { MPI_Request_free(&bd_var_.req_send[nb.bufid]); } diff --git a/src/bvals/comms/tag_map.cpp b/src/bvals/comms/tag_map.cpp index 268e715c6547..e03c8a7df70b 100644 --- a/src/bvals/comms/tag_map.cpp +++ b/src/bvals/comms/tag_map.cpp @@ -63,10 +63,6 @@ void TagMap::AddMeshDataToMap(std::shared_ptr> &md) { auto &pair_map = map_[other_rank]; // Add channel key with an invalid tag pair_map[MakeChannelPair(pmb, nb)] = -1; - if (swarm_map_.count(other_rank) < 1) swarm_map_[other_rank] = rank_pair_map_t(); - auto &swarm_pair_map = swarm_map_[other_rank]; - // Add channel key with an invalid tag - swarm_pair_map[MakeChannelPair(pmb, nb)] = -1; } } } @@ -92,22 +88,15 @@ void TagMap::ResolveMap() { PARTHENON_FAIL("MPI error, cannot query largest supported MPI tag value."); } #endif - auto it = map_.begin(); - auto swarm_it = swarm_map_.begin(); - while (it != map_.end() && swarm_it != swarm_map_.end()) { + for (auto it = map_.begin(); it != map_.end(); ++it) { auto &pair_map = it->second; int idx = 0; std::for_each(pair_map.begin(), pair_map.end(), [&idx](auto &pair) { pair.second = idx++; }); - auto &swarm_pair_map = swarm_it->second; - std::for_each(swarm_pair_map.begin(), swarm_pair_map.end(), - [&idx](auto &swarm_pair) { swarm_pair.second = idx++; }); #ifdef MPI_PARALLEL if (idx > (*reinterpret_cast(max_tag)) && it->first != Globals::my_rank) PARTHENON_FAIL("Number of tags exceeds the maximum allowed by this MPI version."); #endif - ++it; - ++swarm_it; } } @@ -120,13 +109,4 @@ int TagMap::GetTag(const MeshBlock *pmb, const NeighborBlock &nb) { return pair_map[cpair]; } -int TagMap::GetSwarmTag(const MeshBlock *pmb, const NeighborBlock &nb) { - const int other_rank = nb.rank; - auto &swarm_pair_map = swarm_map_[other_rank]; - auto cpair = MakeChannelPair(pmb, nb); - PARTHENON_REQUIRE(swarm_pair_map.count(cpair) == 1, - "Trying to get tag for key that hasn't been entered.\n"); - return swarm_pair_map[cpair]; -} - } // namespace parthenon diff --git a/src/bvals/comms/tag_map.hpp b/src/bvals/comms/tag_map.hpp index 49a6790c5353..d7552d1d69ad 100644 --- a/src/bvals/comms/tag_map.hpp +++ b/src/bvals/comms/tag_map.hpp @@ -85,7 +85,6 @@ class TagMap { using tag_map_t = std::unordered_map; tag_map_t map_; - tag_map_t swarm_map_; // Given the two blocks (one described by the MeshBlock and the other described by the // firsts NeighborBlock information) return an ordered pair of BlockGeometricElementIds @@ -109,7 +108,6 @@ class TagMap { // After the map has been resolved, get the tag for a particular MeshBlock NeighborBlock // pair int GetTag(const MeshBlock *pmb, const NeighborBlock &nb); - int GetSwarmTag(const MeshBlock *pmb, const NeighborBlock &nb); }; } // namespace parthenon