From b3807f5cff250b43be90f10cd932007f2c186189 Mon Sep 17 00:00:00 2001 From: Angelyr Date: Fri, 31 Jan 2025 19:28:01 -0500 Subject: [PATCH] changed change reverse partition map signiture --- src/pcms/dummy_field_adapter.h | 2 +- src/pcms/field_communicator.h | 4 +++- src/pcms/omega_h_field.h | 5 ++--- src/pcms/partition.h | 4 ++-- src/pcms/xgc_field_adapter.h | 5 ++--- test/test_ohClassPtn_appRibPtn.cpp | 2 -- 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/pcms/dummy_field_adapter.h b/src/pcms/dummy_field_adapter.h index 8a2110c1..2bbdabff 100644 --- a/src/pcms/dummy_field_adapter.h +++ b/src/pcms/dummy_field_adapter.h @@ -8,7 +8,7 @@ class DummyFieldAdapter using value_type = int; [[nodiscard]] std::vector GetGids() const { return {}; } [[nodiscard]] ReversePartitionMap GetReversePartitionMap( - const redev::Partition& partition) const + const Partition& partition) const { return {}; } diff --git a/src/pcms/field_communicator.h b/src/pcms/field_communicator.h index d45b1573..4b52448a 100644 --- a/src/pcms/field_communicator.h +++ b/src/pcms/field_communicator.h @@ -5,6 +5,8 @@ #include #include "pcms/inclusive_scan.h" #include "pcms/profile.h" +#include "pcms/partition.h" + namespace pcms { @@ -203,7 +205,7 @@ struct FieldCommunicator auto gids = field_adapter_.GetGids(); if (redev_.GetProcessType() == redev::ProcessType::Client) { const ReversePartitionMap reverse_partition = - field_adapter_.GetReversePartitionMap(redev_.GetPartition()); + field_adapter_.GetReversePartitionMap(Partition{redev_.GetPartition()}); auto out_message = ConstructOutMessage(reverse_partition); comm_.SetOutMessageLayout(out_message.dest, out_message.offset); gid_comm_.SetOutMessageLayout(out_message.dest, out_message.offset); diff --git a/src/pcms/omega_h_field.h b/src/pcms/omega_h_field.h index 36963a7e..3f09898a 100644 --- a/src/pcms/omega_h_field.h +++ b/src/pcms/omega_h_field.h @@ -535,7 +535,7 @@ class OmegaHFieldAdapter } // REQUIRED [[nodiscard]] ReversePartitionMap GetReversePartitionMap( - const redev::Partition& partition) const + const Partition& partition) const { PCMS_FUNCTION_TIMER; auto classIds_h = Omega_h::HostRead(field_.GetClassIDs()); @@ -549,12 +549,11 @@ class OmegaHFieldAdapter std::array coord; pcms::ReversePartitionMap reverse_partition; pcms::LO local_index = 0; - Partition part{partition}; for (auto i = 0; i < classIds_h.size(); i++) { coord[0] = coords[i * dim]; coord[1] = coords[i * dim + 1]; coord[2] = (dim == 3) ? coords[i * dim + 2] : 0.0; - auto dr = part.GetDr(classIds_h[i], classDims_h[i], coord); + auto dr = partition.GetDr(classIds_h[i], classDims_h[i], coord); reverse_partition[dr].emplace_back(local_index++); } return reverse_partition; diff --git a/src/pcms/partition.h b/src/pcms/partition.h index d9a3c8c6..d5683909 100644 --- a/src/pcms/partition.h +++ b/src/pcms/partition.h @@ -7,7 +7,7 @@ namespace pcms { struct GetRank { - GetRank(LO id, LO dim, std::array& coord) + GetRank(const LO id, const LO dim, const std::array& coord) : id_(id), dim_(dim), coord_(coord) { PCMS_FUNCTION_TIMER; @@ -35,7 +35,7 @@ namespace pcms PCMS_FUNCTION_TIMER; } - auto GetDr(LO id, LO dim, std::array coord = {}) + auto GetDr(const LO id, const LO dim, const std::array coord = {}) const { return std::visit(GetRank{id, dim, coord}, partition_); } diff --git a/src/pcms/xgc_field_adapter.h b/src/pcms/xgc_field_adapter.h index 3b49bfe9..dd8976e5 100644 --- a/src/pcms/xgc_field_adapter.h +++ b/src/pcms/xgc_field_adapter.h @@ -112,7 +112,7 @@ class XGCFieldAdapter // REQUIRED [[nodiscard]] ReversePartitionMap GetReversePartitionMap( - const redev::Partition& partition) const + const Partition& partition) const { PCMS_FUNCTION_TIMER; if (RankParticipatesCouplingCommunication()) { @@ -120,12 +120,11 @@ class XGCFieldAdapter pcms::ReversePartitionMap reverse_partition; // in_overlap_ must contain a function! PCMS_ALWAYS_ASSERT(static_cast(in_overlap_)); - Partition part{partition}; for (const auto& geom : reverse_classification_) { // if the geometry is in specified overlap region if (in_overlap_(geom.first.dim, geom.first.id)) { - auto dr = part.GetDr(geom.first.id, geom.first.dim); + auto dr = partition.GetDr(geom.first.id, geom.first.dim); auto [it, inserted] = reverse_partition.try_emplace(dr); // the map gives the local iteration order of the global ids auto map = mask_.GetMap(); diff --git a/test/test_ohClassPtn_appRibPtn.cpp b/test/test_ohClassPtn_appRibPtn.cpp index 612df09b..eb4446c9 100644 --- a/test/test_ohClassPtn_appRibPtn.cpp +++ b/test/test_ohClassPtn_appRibPtn.cpp @@ -49,8 +49,6 @@ int main(int argc, char** argv) static_cast(isRdv)); const std::string name = "meshVtxIds"; - const int rdvRanks = 2; - const int appRanks = 2; adios2::Params params{{"Streaming", "On"}, {"OpenTimeoutSecs", "60"}}; auto channel =