pnm 1.0.3
peclet.pnm — pore-network extraction from SDF geometry (Kokkos)
Loading...
Searching...
No Matches
pnm::detail_mpi Namespace Reference

Classes

struct  MergeRemap
 ONE global merge of a cross-block equivalence graph: the local (a,b) pairs are allgathered and union-found on the host (union-by-min-gid: the class root is the min gid, matching the single-rank fixpoint; deterministic on every rank — identical input). More...

Functions

int allreduceMaxInt (int v, MPI_Comm comm)
template<class T>
std::vector< T > allgatherv (const std::vector< T > &local, MPI_Comm comm)
 Allgatherv a local vector of T (POD) — every rank returns the concatenation.
template<class T>
void sortUnique (std::vector< T > &v)
 Sort + unique in place.
template<class Topo>
BlockGeo blockGeoOf (const Topo &topo, std::array< int, 3 > gdims, int G)
 The extended-block geometry of a halo topology (ghost width G) on the global grid gdims.
template<class T>
peclet::core::View< T > stageInner (const Exec &space, const BlockGeo &geo, const std::vector< T > &h, const char *name)
 Stage a host inner block (x-fastest, no ghosts) onto a fresh extended device field (ghosts zero-initialised); the caller exchanges.
template<class T>
std::vector< T > packInner (const Exec &space, const BlockGeo &geo, const peclet::core::View< T > &e)
 Pack the owned box of an extended device field into a host vector.
template<class PairView>
std::vector< std::pair< Index, Index > > localPairs (const PairView &d, std::size_t count)
 Interleaved device (a,b) Index pairs -> host list, locally sorted/unique.
MergeRemap globalMerge (const std::vector< std::pair< Index, Index > > &loc, MPI_Comm comm)
template<class FieldView, class PredFn>
void applyRemap (const Exec &space, const MergeRemap &m, const FieldView &field, std::size_t n, const PredFn &pred)
 Apply a MergeRemap to the entries of field selected by pred(i): label -> its class root.
template<class Halo, class TargetView>
void resolveToFixpoint (const Exec &space, const BlockGeo &geo, Halo &halo, const TargetView &target, MPI_Comm comm, const char *what)
 Cross-rank fixpoint of the hold-at-ghost pointer jumping (kernels::resolveHoldAtGhost): exchange the state field, resolve one round on every rank, Allreduce the pending count, until no cell is pending.
template<class KeyValFn>
std::vector< std::pair< Index, Index > > minByKey (std::size_t n, const KeyValFn &kv)
 Per-rank (key -> min value) reduction on device via UnorderedMap, with capacity-retry.

Function Documentation

◆ allreduceMaxInt()

int pnm::detail_mpi::allreduceMaxInt ( int v,
MPI_Comm comm )
inline

Definition at line 71 of file pore_extraction_mpi.hpp.

◆ allgatherv()

template<class T>
std::vector< T > pnm::detail_mpi::allgatherv ( const std::vector< T > & local,
MPI_Comm comm )
inline

Allgatherv a local vector of T (POD) — every rank returns the concatenation.

Definition at line 79 of file pore_extraction_mpi.hpp.

Referenced by globalMerge().

◆ sortUnique()

template<class T>
void pnm::detail_mpi::sortUnique ( std::vector< T > & v)
inline

Sort + unique in place.

Definition at line 95 of file pore_extraction_mpi.hpp.

Referenced by localPairs().

◆ blockGeoOf()

template<class Topo>
BlockGeo pnm::detail_mpi::blockGeoOf ( const Topo & topo,
std::array< int, 3 > gdims,
int G )
inline

◆ stageInner()

template<class T>
peclet::core::View< T > pnm::detail_mpi::stageInner ( const Exec & space,
const BlockGeo & geo,
const std::vector< T > & h,
const char * name )
inline

Stage a host inner block (x-fastest, no ghosts) onto a fresh extended device field (ghosts zero-initialised); the caller exchanges.

Definition at line 124 of file pore_extraction_mpi.hpp.

References pnm::kernels::ownedRange(), and pnm::uploadVec().

◆ packInner()

template<class T>
std::vector< T > pnm::detail_mpi::packInner ( const Exec & space,
const BlockGeo & geo,
const peclet::core::View< T > & e )
inline

Pack the owned box of an extended device field into a host vector.

Definition at line 140 of file pore_extraction_mpi.hpp.

References pnm::downloadN(), and pnm::kernels::ownedRange().

◆ localPairs()

template<class PairView>
std::vector< std::pair< Index, Index > > pnm::detail_mpi::localPairs ( const PairView & d,
std::size_t count )
inline

Interleaved device (a,b) Index pairs -> host list, locally sorted/unique.

Definition at line 154 of file pore_extraction_mpi.hpp.

References pnm::downloadN(), and sortUnique().

◆ globalMerge()

MergeRemap pnm::detail_mpi::globalMerge ( const std::vector< std::pair< Index, Index > > & loc,
MPI_Comm comm )
inline

◆ applyRemap()

template<class FieldView, class PredFn>
void pnm::detail_mpi::applyRemap ( const Exec & space,
const MergeRemap & m,
const FieldView & field,
std::size_t n,
const PredFn & pred )
inline

Apply a MergeRemap to the entries of field selected by pred(i): label -> its class root.

Definition at line 210 of file pore_extraction_mpi.hpp.

References pnm::kernels::bsearchKey(), pnm::detail_mpi::MergeRemap::keys, pnm::detail_mpi::MergeRemap::nk, and pnm::detail_mpi::MergeRemap::roots.

◆ resolveToFixpoint()

template<class Halo, class TargetView>
void pnm::detail_mpi::resolveToFixpoint ( const Exec & space,
const BlockGeo & geo,
Halo & halo,
const TargetView & target,
MPI_Comm comm,
const char * what )
inline

Cross-rank fixpoint of the hold-at-ghost pointer jumping (kernels::resolveHoldAtGhost): exchange the state field, resolve one round on every rank, Allreduce the pending count, until no cell is pending.

Progress is guaranteed (every pending chain finalizes one cross-block hop per round); the round cap is a collective guard.

Definition at line 233 of file pore_extraction_mpi.hpp.

References pnm::kernels::resolveHoldAtGhost().

◆ minByKey()

template<class KeyValFn>
std::vector< std::pair< Index, Index > > pnm::detail_mpi::minByKey ( std::size_t n,
const KeyValFn & kv )
inline

Per-rank (key -> min value) reduction on device via UnorderedMap, with capacity-retry.

emit(i, key, val) semantics are provided by the caller lambda KeyVal(i, k, v) -> bool (returns false to skip element i). Returns host (key, minValue) pairs.

Definition at line 254 of file pore_extraction_mpi.hpp.

References pnm::downloadN().