Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/cmake-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
test-build:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
timeout-minutes: 30

defaults:
Expand All @@ -31,7 +31,7 @@ jobs:
run: sudo apt-get update

- name: Install mpi
run: sudo apt-get install -yq mpich libmpich-dev
run: sudo apt-get install -yq mpich

- uses: actions/checkout@v4

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/perlmutter/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module load cray-fftw
# # kokkos
# rm build-kokkos -rf
# # rm kokkos -rf
# git clone -b 4.2.00 https://github.com/kokkos/kokkos.git
# git clone -b 4.5.00 https://github.com/kokkos/kokkos.git
# cmake -S kokkos -B build-kokkos \
# -DCMAKE_INSTALL_PREFIX=build-kokkos/install \
# -DCMAKE_BUILD_TYPE="Release" \
Expand Down Expand Up @@ -100,7 +100,7 @@ cmake -S pcms -B build-pcms \
-DCMAKE_C_COMPILER=cc \
-DCMAKE_CXX_COMPILER=CC \
-DCMAKE_BUILD_TYPE=Release \
-DPCMS_TIMEOUT=0 \
-DPCMS_TIMEOUT=100 \
-Dperfstubs_DIR=$PWD/build-perfstubs \
-Dredev_DIR=$PWD/build-redev/install/lib64/cmake/redev \
-DOmega_h_DIR=$PWD/build-omega_h/install/lib64/cmake/Omega_h/ \
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.19)
project(pcms VERSION 0.1.1 LANGUAGES CXX)
project(pcms VERSION 0.1.2 LANGUAGES CXX)

include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ set(PCMS_HEADERS
pcms/inclusive_scan.h
pcms/profile.h
pcms/print.h
pcms/partition.h
)

set(PCMS_SOURCES
Expand Down
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
29 changes: 3 additions & 26 deletions src/pcms/omega_h_field.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "pcms/transfer_field.h"
#include "pcms/memory_spaces.h"
#include "pcms/profile.h"
#include "pcms/partition.h"

// FIXME add executtion spaces (don't use kokkos exe spaces directly)

Expand Down Expand Up @@ -85,29 +86,6 @@ Omega_h::Read<T> filter_array(Omega_h::Read<T> array,
});
return filtered_field;
}
struct GetRankOmegaH
{
GetRankOmegaH(int i, Omega_h::I8 dim, Omega_h::ClassId id, std::array<pcms::Real,3> & coord)
: i_(i), id_(id), dim_(dim), coord_(coord)
{
PCMS_FUNCTION_TIMER;
}
auto operator()(const redev::ClassPtn& ptn) const
{
PCMS_FUNCTION_TIMER;
const auto ent = redev::ClassPtn::ModelEnt({dim_, id_});
return ptn.GetRank(ent);
}
auto operator()(const redev::RCBPtn& ptn)
{
PCMS_FUNCTION_TIMER;
return ptn.GetRank(coord_);
}
int i_;
Omega_h::ClassId id_;
Omega_h::I8 dim_;
std::array<pcms::Real,3> coord_;
};
} // namespace detail

template <typename T,
Expand Down Expand Up @@ -557,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 @@ -575,8 +553,7 @@ class OmegaHFieldAdapter
coord[0] = coords[i * dim];
coord[1] = coords[i * dim + 1];
coord[2] = (dim == 3) ? coords[i * dim + 2] : 0.0;
auto dr = std::visit(detail::GetRankOmegaH{i, classDims_h[i], classIds_h[i], coord},
partition);
auto dr = partition.GetDr(classIds_h[i], classDims_h[i], coord);
reverse_partition[dr].emplace_back(local_index++);
}
return reverse_partition;
Expand Down
47 changes: 47 additions & 0 deletions src/pcms/partition.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#ifndef PCMS_PARTITION_H
#define PCMS_PARTITION_H
#include "pcms/common.h"


namespace pcms
{
struct GetRank
{
GetRank(const LO id, const LO dim, const std::array<Real,3>& coord)
: id_(id), dim_(dim), coord_(coord)
{
PCMS_FUNCTION_TIMER;
}
auto operator()(const redev::ClassPtn& ptn) const
{
PCMS_FUNCTION_TIMER;
const auto ent = redev::ClassPtn::ModelEnt({dim_, id_});
return ptn.GetRank(ent);
}
auto operator()(const redev::RCBPtn& ptn)
{
PCMS_FUNCTION_TIMER;
return ptn.GetRank(coord_);
}
LO id_;
LO dim_;
std::array<Real,3> coord_;
};

struct Partition
{
Partition(const redev::Partition& partition) : partition_(partition)
{
PCMS_FUNCTION_TIMER;
}

auto GetDr(const LO id, const LO dim, const std::array<Real,3> coord = {}) const
{
return std::visit(GetRank{id, dim, coord}, partition_);
}

redev::Partition partition_;
};
} // namespace pcms

#endif //PCMS_PARTITION_H
28 changes: 2 additions & 26 deletions src/pcms/xgc_field_adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,6 @@

namespace pcms
{
namespace detail
{
// Needed since NVHPC doesn't work with overloaded
struct GetRank
{
using GeomType = DimID;
GetRank(const GeomType& geom) : geom_(geom) {}
auto operator()(const redev::ClassPtn& ptn) const
{
PCMS_FUNCTION_TIMER;
const auto ent = redev::ClassPtn::ModelEnt({geom_.dim, geom_.id});
return ptn.GetRank(ent);
}
auto operator()(const redev::RCBPtn& /*unused*/) const
{
PCMS_FUNCTION_TIMER;
std::cerr << "RCB partition not handled yet\n";
std::terminate();
return 0;
}
const GeomType& geom_;
};
} // namespace detail

template <typename T, typename CoordinateElementType = Real>
class XGCFieldAdapter
{
Expand Down Expand Up @@ -136,7 +112,7 @@ class XGCFieldAdapter

// REQUIRED
[[nodiscard]] ReversePartitionMap GetReversePartitionMap(
const redev::Partition& partition) const
const Partition& partition) const
{
PCMS_FUNCTION_TIMER;
if (RankParticipatesCouplingCommunication()) {
Expand All @@ -148,7 +124,7 @@ class XGCFieldAdapter
// if the geometry is in specified overlap region
if (in_overlap_(geom.first.dim, geom.first.id)) {

auto dr = std::visit(detail::GetRank{geom.first}, partition);
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