Skip to content

Commit

Permalink
query max supported tag by MPI
Browse files Browse the repository at this point in the history
  • Loading branch information
gshipman committed Oct 19, 2023
1 parent e857c88 commit 2d4f0ac
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/bvals/comms/tag_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,18 @@ void TagMap::AddMeshDataToMap(std::shared_ptr<MeshData<Real>> &md) {
}

void TagMap::ResolveMap() {
#ifdef MPI_PARALLEL
void *max_tag; // largest supported MPI tag value
MPI_Comm_get_attr( MPI_COMM_WORLD, MPI_TAG_UB, &max_tag, &flag);
#endif
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++; });
#ifdef MPI_PARALLEL
if (idx > 32767)
PARTHENON_FAIL("Number of tags exceeds the maximum allowed by the MPI standard.");
if (idx > (*(int*)max_tag))
PARTHENON_FAIL("Number of tags exceeds the maximum allowed by this MPI version.");
#endif
}
}
Expand Down

0 comments on commit 2d4f0ac

Please sign in to comment.