Skip to content

Commit

Permalink
changed change reverse partition map signiture
Browse files Browse the repository at this point in the history
  • Loading branch information
Angelyr committed Feb 1, 2025
1 parent ec90f79 commit b3807f5
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/pcms/dummy_field_adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class DummyFieldAdapter
using value_type = int;
[[nodiscard]] std::vector<GO> GetGids() const { return {}; }
[[nodiscard]] ReversePartitionMap GetReversePartitionMap(
const redev::Partition& partition) const
const Partition& partition) const
{
return {};
}
Expand Down
4 changes: 3 additions & 1 deletion src/pcms/field_communicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <numeric>
#include "pcms/inclusive_scan.h"
#include "pcms/profile.h"
#include "pcms/partition.h"

namespace pcms
{

Expand Down Expand Up @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions src/pcms/omega_h_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<Omega_h::ClassId>(field_.GetClassIDs());
Expand All @@ -549,12 +549,11 @@ class OmegaHFieldAdapter
std::array<pcms::Real, 3> 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;
Expand Down
4 changes: 2 additions & 2 deletions src/pcms/partition.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace pcms
{
struct GetRank
{
GetRank(LO id, LO dim, std::array<Real,3>& coord)
GetRank(const LO id, const LO dim, const std::array<Real,3>& coord)
: id_(id), dim_(dim), coord_(coord)
{
PCMS_FUNCTION_TIMER;
Expand Down Expand Up @@ -35,7 +35,7 @@ namespace pcms
PCMS_FUNCTION_TIMER;
}

auto GetDr(LO id, LO dim, std::array<Real,3> coord = {})
auto GetDr(const LO id, const LO dim, const std::array<Real,3> coord = {}) const
{
return std::visit(GetRank{id, dim, coord}, partition_);
}
Expand Down
5 changes: 2 additions & 3 deletions src/pcms/xgc_field_adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,19 @@ class XGCFieldAdapter

// REQUIRED
[[nodiscard]] ReversePartitionMap GetReversePartitionMap(
const redev::Partition& partition) const
const Partition& partition) const
{
PCMS_FUNCTION_TIMER;
if (RankParticipatesCouplingCommunication()) {

pcms::ReversePartitionMap reverse_partition;
// in_overlap_ must contain a function!
PCMS_ALWAYS_ASSERT(static_cast<bool>(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();
Expand Down
2 changes: 0 additions & 2 deletions test/test_ohClassPtn_appRibPtn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ int main(int argc, char** argv)
static_cast<redev::ProcessType>(isRdv));

const std::string name = "meshVtxIds";
const int rdvRanks = 2;
const int appRanks = 2;

adios2::Params params{{"Streaming", "On"}, {"OpenTimeoutSecs", "60"}};
auto channel =
Expand Down

0 comments on commit b3807f5

Please sign in to comment.