Pr501 hosg final#569
Open
aaadelmann wants to merge 6 commits into
Open
Conversation
Add CMake support for selecting architecture-specific scatter/gather autotune preset CSVs at configure time. The new AutoTunePresets module detects the active backend/architecture tag, copies matching preset files into the build tree, and generates IpplAutoTunePresets.h with the resolved preset path and architecture label. Add initial preset CSVs for: - gfx90a - sm_80 - sm_90 Wire the preset configuration into the top-level CMake flow without touching FEL handling or the existing CUDA/HeFFTe architecture logic. Verification: - Configured a fresh OpenMP Release build. - Confirmed the generated IpplAutoTunePresets.h uses the openmp tag. - Built the ippl target successfully.
Add the core higher-order scatter/gather infrastructure used by the interpolation autotune path: - binning support for sorted particle traversal - interpolation coordinate/kernel utilities - gather dispatch/configuration types - scatter dispatch/configuration types - atomic, tiled, and grid-parallel scatter backends - autotune and tile-size cache implementation - Gaussian-process helper used by the autotune sweep Wire the new interpolation sources into the IPPL target and add the generated autotune preset include directory to the library target. Add two small support hooks required by the new framework: - FieldTraits for deducing Field dimension/view type - a per-bin cursor buffer in SortBuffer for counting-sort binning Verification: - Configured OpenMP Release build with unit tests and FFT enabled. - Built the full unit-test tree successfully. - Ran ctest: 37/37 tests passed.
Initialize the scatter/gather autotune cache after Kokkos startup so the runtime can seed backend defaults, load configured preset CSVs, or run the autotune sweep when requested through IPPL_AUTO_TUNE. Also release the shared bin-sort buffers before Kokkos finalization. The higher-order scatter/gather path keeps reusable binning buffers by memory space, so they need to be cleared while Kokkos memory spaces are still valid. Verification: - Built the OpenMP Release tree with unit tests enabled. - Ran ctest: 37/37 tests passed.
Add an explicit Kokkos_Core include to the CIC implementation header and remove unreachable fallback returns from the constexpr interpolation helper functions. The fallback returns were only present to silence earlier device-code warnings, but all branches are now covered by the compile-time conditions. Keeping the helpers branch-clean matches the HOSG interpolation code path being merged from PR 501. Verification: - cmake --build build-pr501-hosg-step1-openmp -j 8 - ctest --test-dir build-pr501-hosg-step1-openmp --output-on-failure - 37/37 tests passed
Add the HOSG interpolation unit tests from PR 501 and register them in the interpolation test suite. The new tests cover: - particle binning and bin-offset consistency - gather/scatter conservation - periodic-boundary behavior - constant-field gather - gather/scatter convergence for NGP, linear, quadratic, and cubic kernels - scatter/gather adjointness - high-density particle cases - sorted versus unsorted scatter consistency - scatter/gather roundtrip behavior Also update BareField::innerProduct for complex-valued fields. The HOSG adjointness tests use complex fields and particle attributes, and require the field inner product to use the same Hermitian convention as the particle-side test helper. For real-valued fields the existing bilinear behavior is unchanged. For complex-valued fields, the reduction now accumulates f1 * conj(f2) and reduces real and imaginary parts separately across MPI ranks. Without the complex inner-product update, KernelGatherScatterTest compiles but all complex adjointness checks fail for every tested kernel and dimension. Verification: - cmake --build build-pr501-hosg-step1-openmp -j 8 - ctest --test-dir build-pr501-hosg-step1-openmp -R KernelGatherScatterTest --output-on-failure - passed - ctest --test-dir build-pr501-hosg-step1-openmp --output-on-failure - 39/39 tests passed
Add ippl::detail::VectorTraits<Vector<T, Dim>> as a lightweight compile-time helper that exposes the scalar type and dimension of an IPPL Vector. For example: VectorTraits<Vector<double, 3>>::real_type == double VectorTraits<Vector<double, 3>>::dim == 3 This is useful for generic interpolation code that receives only a vector type and needs to recover its component scalar type and dimensionality without duplicating partial-specialization logic at each call site. The helper has no runtime cost and does not change Vector behavior. It is a supporting type-trait for the higher-order scatter/gather work, especially for future vector-valued field and particle interpolation paths. Add some documentation Verification: - cmake --build build-pr501-hosg-step1-openmp -j 8 - ctest --test-dir build-pr501-hosg-step1-openmp --output-on-failure - 39/39 tests passed
srikrrish
approved these changes
Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR extracts the higher-order scatter/gather and autotuning part of the original PR #501 into a finite, reviewable branch.
It adds a new interpolation framework for particle-to-grid scatter and grid-to-particle gather, including:
ippl::initialize()User-Facing API
The new API is based on explicit kernel and config objects.
Example scatter:
Example gather:
Available kernels include:
Autotuning
The PR adds CMake support for bundled autotune preset CSV files. These are configured into a generated
IpplAutoTunePresets.hheader and seeded duringippl::initialize().At runtime,
ippl::Interpolation::AutoTune::initialize()seeds scatter/gather defaults and can run autotuning sweeps when requested through the existing environment mechanism.Regression Tests
Added:
unit_tests/Interpolation/Binning.cppunit_tests/Interpolation/KernelGatherScatterTest.cppThe tests cover:
Supporting Changes
BareField::innerProductnow handles complex-valued fields using Hermitian convention:f1 * conj(f2)for
Kokkos::complex<T>, while preserving the existing real-valued behavior.This is required for the complex adjointness checks in the new scatter/gather regression tests.
A small
VectorTraits<Vector<T, Dim>>helper was added to expose:for generic interpolation code.
Commits
b03763d Add VectorTraits helper for vector-valued interpolation support
b451224 Add HOSG interpolation regression tests
4701b08 Update CIC helpers for Kokkos device use
5f5d11c Initialize interpolation autotune runtime state
1a77948 Add higher-order scatter/gather interpolation framework
cfbecd3 Add autotune preset plumbing for scatter/gather
Master was kept as the source of truth for newer fixes in particle communication, boundary conditions, halo handling, and current-deposition tests.
Verification
Tested locally with the OpenMP unit-test build:
Result: