|
core 1.5.0
Shared MPI block decomposition, asynchronous ghost-layer exchange, SDF geometry, load balancing (header-only C++20)
|
Namespaces | |
| namespace | decomp |
| namespace | detail |
| namespace | geom |
| namespace | halo |
| namespace | interp |
| namespace | mpi_stub |
| namespace | python |
| namespace | scheme |
| namespace | solver |
| namespace | vof |
Classes | |
| struct | Box |
| A physical, axis-aligned box with per-axis periodicity. Continuous — no cells. More... | |
| struct | FieldRec |
| One registered field: its flat x-fastest device buffer plus the metadata a consumer needs to exchange or redistribute it. More... | |
| class | FieldSet |
| Name → FieldRec directory. More... | |
| struct | NestedLoop |
| Compile-time-unrolled nested loop over [bgn, end) in row-major (axis 0 fastest) order. More... | |
| struct | NestedLoop< Dim, 0 > |
| struct | Quat |
| Quaternion, {x, y, z, w} — dem's F4 ordering (dem_portable.hpp), NOT {w, x, y, z}. More... | |
| struct | Range |
| Half-open range [begin, end) carrying a label (e.g. a block id). Ported from pbs::IndxRange. More... | |
| struct | UniformGrid |
| A box resolved by a regular cell grid. More... | |
| struct | Vec3 |
| Real-templated POD 3-vector — the geometry layer's point type on host and device. More... | |
Typedefs | |
| using | Index = std::int64_t |
Signed index type for grids and particles (supersedes block_decomposer's long int IndxT). | |
| using | Real = double |
| Default host floating type. Device kernels may use float; conversions happen at the boundary. | |
| template<int Dim> | |
| using | IVec = std::array< Index, Dim > |
| Multi-dimensional integer index / coordinate (x-fastest order by convention). | |
| template<int Dim> | |
| using | Vec = std::array< Real, Dim > |
| Multi-dimensional real vector. | |
| using | ExecSpace = Kokkos::DefaultExecutionSpace |
| using | MemSpace = ExecSpace::memory_space |
| template<class T > | |
| using | View = Kokkos::View< T *, MemSpace > |
| 1D device array. | |
| template<class T > | |
| using | HostView = decltype(Kokkos::create_mirror_view(std::declval< View< T > >())) |
| Host-accessible mirror of View<T> (identical to View<T> on host backends). | |
| using | IndexView = Kokkos::View< Index *, MemSpace > |
| Device array of grid/particle indices (the matched send/recv/self-copy lists). | |
| template<class T > | |
| using | Field3D = Kokkos::View< T ***, Kokkos::LayoutLeft, MemSpace > |
| 3D structured field in the suite's x-fastest convention: LayoutLeft makes the leftmost (x) index contiguous, i.e. | |
Enumerations | |
| enum class | Centering { Cell , FaceX , FaceY , FaceZ } |
| Where a field's samples sit relative to a cell. More... | |
Functions | |
| int | usableCpus () |
| How many CPUs this process may actually use: the affinity count, lowered by any cgroup quota binding it. | |
| int | defaultHostThreads (bool hostBackendSizesItself) |
| The host thread count to hand a backend that has not been told one, or 0 for "say nothing". | |
| bool | hostParallelActive () |
| Is the parallel backend actually live for this process? (Kokkos compiled in AND initialized.) Exposed so a builder can assert/report; the shim itself already falls back transparently. | |
| template<class Body > | |
| void | hostParFor (Index n, Body &&body) |
Parallel for (Index i = 0; i < n; ++i) body(i); over the Kokkos HOST execution space. | |
| template<class Body > | |
| void | hostParScan (Index n, Body &&body) |
Exclusive integer scan over the host space: body(i, update, final) where update carries the running sum of everything BEFORE i when final is true. | |
| template<class Real > | |
| PECLET_HD Vec3< Real > | add (Vec3< Real > a, Vec3< Real > b) |
| template<class Real > | |
| PECLET_HD Vec3< Real > | sub (Vec3< Real > a, Vec3< Real > b) |
| template<class Real > | |
| PECLET_HD Vec3< Real > | scale (Vec3< Real > a, Real s) |
| template<class Real > | |
| PECLET_HD Real | dot (Vec3< Real > a, Vec3< Real > b) |
| template<class Real > | |
| PECLET_HD Vec3< Real > | cross (Vec3< Real > a, Vec3< Real > b) |
| template<class Real > | |
| PECLET_HD Vec3< Real > | rotate (Quat< Real > q, Vec3< Real > v) |
| Rotate v by q. | |
| template<class Real > | |
| PECLET_HD Vec3< Real > | invRotate (Quat< Real > q, Vec3< Real > v) |
Rotate v by the conjugate of q — dem invRotateVector. | |
| template<class Real > | |
| PECLET_HD Quat< Real > | mulQuat (Quat< Real > a, Quat< Real > b) |
Hamilton product a ⊗ b in the (x, y, z, w) storage convention rotate uses, so rotate(mulQuat(a, b), v) == rotate(a, rotate(b, v)) — i.e. | |
| Index | wrap (Index x, Index n) |
| Periodic wrap of a coordinate into [0, n): wrap(x, n) = (x % n + n) % n. | |
| template<int Dim, typename Func > | |
| void | forEachInBox (const IVec< Dim > &bgn, const IVec< Dim > &end, Func &&func) |
| Iterate the box [bgn, end) calling func(const IVec<Dim>&). | |
| template<class T > | |
| View< T > | toDevice (const std::vector< T > &h, const std::string &label) |
| Upload a host std::vector into a freshly-sized device View (empty vector => empty view). | |
| template<class V > | |
| std::vector< std::remove_const_t< typename V::value_type > > | toVector (const V &view) |
Copy a (host- or device-resident) Kokkos View of any rank into a contiguous host std::vector, flattened in C/row order (last index fastest) — an Nx3 View comes back as out[i*3 + c] == view(i,c), the suite's particle-SoA Python export order. | |
| using peclet::core::Index = typedef std::int64_t |
| using peclet::core::ExecSpace = typedef Kokkos::DefaultExecutionSpace |
| using peclet::core::MemSpace = typedef ExecSpace::memory_space |
| using peclet::core::IndexView = typedef Kokkos::View<Index*, MemSpace> |
| using peclet::core::Field3D = typedef Kokkos::View<T***, Kokkos::LayoutLeft, MemSpace> |
3D structured field in the suite's x-fastest convention: LayoutLeft makes the leftmost (x) index contiguous, i.e.
I = x + y*nx + z*nx*ny — identical to peclet::core::Index linearization and cfd-gpu grids.
|
strong |
Where a field's samples sit relative to a cell.
Scalars/properties are cell-centred; the MAC face-normal velocity components are face-centred. (The staggered solver stores its face fields as cell-indexed arrays, so Centering is metadata for consumers — it does not change the buffer.)
| Enumerator | |
|---|---|
| Cell | |
| FaceX | |
| FaceY | |
| FaceZ | |
Definition at line 32 of file field_set.hpp.
|
inline |
How many CPUs this process may actually use: the affinity count, lowered by any cgroup quota binding it.
At least 1. Falls back to the affinity count alone where no quota can be read.
Definition at line 140 of file cpu_budget.hpp.
References peclet::core::detail::affinityCpus(), and peclet::core::detail::cgroupQuota().
Referenced by defaultHostThreads().
The host thread count to hand a backend that has not been told one, or 0 for "say nothing".
0 whenever the user has expressed a preference the backend will act on itself — their choice is never overridden — and 0 when the budget is the whole machine, so that on an ordinary workstation this function changes NOTHING: same thread count, same schedule, same results. It speaks up only in the two cases it exists for: a quota narrower than the visible machine, and an OMP_NUM_THREADS that nothing else is going to read.
| hostBackendSizesItself | true iff the host backend is OpenMP. Two things follow from it, and neither is true of the C++ threads or Serial backends — which is what a Windows or macOS wheel carries, since neither toolchain supplies an OpenMP that Kokkos accepts: |
OMP_NUM_THREADS. The OpenMP runtime does; Kokkos itself reads only KOKKOS_NUM_THREADS (Kokkos_Core.cpp). So on any other backend that variable reaches nobody at all unless it is honoured here — and every peclet page tells a container user to set exactly it.Kokkos::Threads asks hwloc for the topology and falls back to one thread when hwloc is absent (Kokkos_Threads_Instance.cpp:487), which it is in every peclet wheel. Measured 2026-09-13 on 48 cores: unset, the quick start takes 4.43 s, exactly its one-thread time, against 0.64 s at 24 threads. So on those backends saying nothing is not neutral — it is a 7x cut, silently. Say the budget. Definition at line 172 of file cpu_budget.hpp.
References peclet::core::detail::affinityCpus(), and usableCpus().
Referenced by peclet::core::python::install().
|
inline |
Is the parallel backend actually live for this process? (Kokkos compiled in AND initialized.) Exposed so a builder can assert/report; the shim itself already falls back transparently.
Definition at line 73 of file host_parallel.hpp.
Parallel for (Index i = 0; i < n; ++i) body(i); over the Kokkos HOST execution space.
CONTRACT: iterations must write disjoint memory (see the header note) — the shim does not and cannot check it, and a violation is a data race, not merely a nondeterminism.
Definition at line 85 of file host_parallel.hpp.
Exclusive integer scan over the host space: body(i, update, final) where update carries the running sum of everything BEFORE i when final is true.
Semantics are Kokkos parallel_scan's, and the serial fallback reproduces them exactly.
Typical use (two-pass CSR): pass counts in, read row offsets out. hostParScan(n, [&](Index i, Index& acc, bool final) { const Index c = count[i]; if (final) start[i] = acc; acc += c; });
Definition at line 112 of file host_parallel.hpp.
Definition at line 58 of file portable.hpp.
References peclet::core::Vec3< Real >::x, peclet::core::Vec3< Real >::y, and peclet::core::Vec3< Real >::z.
Referenced by peclet::core::geom::instanceBound(), peclet::core::geom::instanceVelocity(), peclet::core::solver::AndersonCore::memoryBytes(), peclet::core::geom::query_detail::nodeBound(), and rotate().
Definition at line 62 of file portable.hpp.
References peclet::core::Vec3< Real >::x, peclet::core::Vec3< Real >::y, and peclet::core::Vec3< Real >::z.
Referenced by peclet::core::geom::evalInstancePeriodic(), peclet::core::halo::ParticleHalo< Dim >::forward(), peclet::core::geom::instanceVelocity(), peclet::core::geom::query_detail::nodeBound(), and peclet::core::geom::toCanonical().
Definition at line 66 of file portable.hpp.
References peclet::core::Vec3< Real >::x, peclet::core::Vec3< Real >::y, and peclet::core::Vec3< Real >::z.
Referenced by peclet::core::geom::evalInstancePeriodic(), peclet::core::geom::evalTree(), peclet::core::geom::evalTreeGrad(), peclet::core::geom::instanceBound(), peclet::core::geom::query_detail::nodeBound(), peclet::core::geom::body_detail::resolveDegenerateFrame(), rotate(), and peclet::core::geom::toCanonical().
Definition at line 70 of file portable.hpp.
References peclet::core::Vec3< Real >::x, peclet::core::Vec3< Real >::y, and peclet::core::Vec3< Real >::z.
Referenced by peclet::core::solver::amgPcg(), peclet::core::scheme::detail::ccgTetPiece(), and peclet::core::scheme::cutCellGeometryFanTet().
Definition at line 74 of file portable.hpp.
References peclet::core::Vec3< Real >::x, peclet::core::Vec3< Real >::y, and peclet::core::Vec3< Real >::z.
Referenced by peclet::core::geom::instanceVelocity(), peclet::core::vof::plicPolygon(), and rotate().
Rotate v by q.
Verbatim port of dem rotateVector (dem_portable.hpp) — keep the operation order: a rewritten-but-algebraically-equal form would break the rung-3 bit-exactness gate.
Definition at line 81 of file portable.hpp.
References add(), cross(), scale(), peclet::core::Quat< Real >::w, peclet::core::Quat< Real >::x, peclet::core::Quat< Real >::y, and peclet::core::Quat< Real >::z.
Referenced by peclet::core::geom::SceneBuilder< Real >::composeTransform(), peclet::core::geom::evalTreeGrad(), peclet::core::geom::instanceBound(), invRotate(), and peclet::core::geom::query_detail::nodeBound().
Rotate v by the conjugate of q — dem invRotateVector.
Definition at line 89 of file portable.hpp.
References rotate(), peclet::core::Quat< Real >::w, peclet::core::Quat< Real >::x, peclet::core::Quat< Real >::y, and peclet::core::Quat< Real >::z.
Referenced by peclet::core::geom::evalInstancePeriodic(), and peclet::core::geom::toCanonical().
Hamilton product a ⊗ b in the (x, y, z, w) storage convention rotate uses, so rotate(mulQuat(a, b), v) == rotate(a, rotate(b, v)) — i.e.
b applies first.
Definition at line 96 of file portable.hpp.
References peclet::core::Quat< Real >::w, peclet::core::Quat< Real >::x, peclet::core::Quat< Real >::y, and peclet::core::Quat< Real >::z.
Referenced by peclet::core::geom::SceneBuilder< Real >::composeTransform().
Periodic wrap of a coordinate into [0, n): wrap(x, n) = (x % n + n) % n.
Definition at line 37 of file types.hpp.
Referenced by peclet::core::halo::GridHaloTopology< Dim >::buildTopology(), and peclet::core::halo::ParticleMigrator< Dim >::cellOf().
|
inline |
Iterate the box [bgn, end) calling func(const IVec<Dim>&).
Definition at line 65 of file types.hpp.
References peclet::core::NestedLoop< Dim, Axis >::run().
Upload a host std::vector into a freshly-sized device View (empty vector => empty view).
Definition at line 44 of file view.hpp.
Referenced by peclet::core::solver::greedyColoring(), peclet::core::halo::ParticleMigratorView< Dim >::init(), peclet::core::halo::GridHalo< T >::init(), peclet::core::halo::ParticleHalo< Dim >::init(), and peclet::core::halo::ParticleMigratorView< Dim >::migrate().
| std::vector< std::remove_const_t< typename V::value_type > > peclet::core::toVector | ( | const V & | view | ) |
Copy a (host- or device-resident) Kokkos View of any rank into a contiguous host std::vector, flattened in C/row order (last index fastest) — an Nx3 View comes back as out[i*3 + c] == view(i,c), the suite's particle-SoA Python export order.
This replaces the redundant "create_mirror_view → deep_copy → element-by-element loop → std::vector" idiom in the binding getters (S2a) with a single device→host transfer and no hand-written loop. The row-order flatten is layout-correct on every backend: a LayoutLeft (e.g. CUDA-default) device View is transposed on the host hop rather than blindly memcpy'd, so the exported ordering matches across CPU/GPU builds.