Repository navigation
perf(lcao): batch RI radial table construction on CUDA - #37
Draft
Stardust0831 wants to merge 8 commits into
Draft
Stardust0831 wants to merge 8 commits into
Stardust0831 wants to merge 8 commits into
Conversation
This was referenced Nov 2, 2026
* Make self-defined testing helper happy * Format CMake files * Adjust comment
* Precommit: Prettify toolchain scripts * Toolchain: CMake arguments in Linux build scripts shfmt breaks the bash logic when combined with `\` and comments * Use quote vars * Apply case indent
Keep existing product orbitals and radial entries when selective initialization is called again with additional radii. Prepare only new objects in selective batches so existing Orb11 references remain valid. Add a regression for individual and mixed-batch initialization, checking overlaps and gradients against complete tables.
Retain the CPU and CUDA radial-table tests with the upstream CMake format. Validation: clean CUDA build and both radial-table test targets on SAI, with OMP_NUM_THREADS=1 and 4 (14 test executions passed, no skips).
Exercise destruction and full reinitialization of the first Orb21 in a shared batch. Check the remaining object after a selective update against independent full tables, including retained and new overlaps and gradients. Validation: CPU/CUDA radial-table tests with one and four OpenMP threads (18 test executions passed), plus the ownership regression under AddressSanitizer with CUDA disabled.
This branch has not been deployed
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.
What's changed?
LCAO EXX initialization builds radial tables with many small quadrature operations and repeated product-orbital transforms. For CUDA calculations, batch the existing Simpson quadrature into FP64 GEMM using ABACUS's tensor/BLAS interfaces. Preserve the derivative recurrence and analytic origin values.
The existing resolved
deviceselection is passed explicitly through initialization and Coulomb refresh. CPU full-table construction retains individual quadrature. Product orbitals are shared during batched and selective construction, and their unused origin derivative is omitted. Call-site updates preserve CPU behavior for the other RI consumers.This uses the unmodified default LibRI revision
b0eff7a; DDLA and LibRI GPU contractions are not required. There is no new build or INPUT option.Performance
Ranges cover two paired runs in separate allocations; speedups are computed within each pair.
HSE SCF, forces and stress on Si32 and CsPbI3 (5 atoms), using one V100, one MPI rank, four physical CPU cores/OpenMP threads and serial BLAS on SAI. cuSOLVER diagonalization and CPU LibRI contractions in both versions. Each candidate is compared with unmodified
d20090cc137f; two repetitions reverse the execution order. Reported performance pairs have identical SCF iteration counts.Exx_LRI::initincludes radial-table preparation before SCF. Its speedup includes GPU batching and product preparation reuse; it is not an isolated GPU-kernel comparison.Explicit device workspace is bounded at 160 MiB per MPI rank, with at most 160 MiB of corresponding host staging. These buffers are released before SCF. The bounds exclude CUDA context/library allocations and the existing host tables. Sampled total process GPU peaks (baseline / candidate): Si32: 442–450 / 460–462 MiB; CsPbI3: 438 / 530 MiB. Sampling interval: 0.5 s.
Unit Tests and/or Case Tests for my changes
Maximum differences across the 29 completed calculations are 2.2e-11 eV/atom, 2.3e-09 eV/Angstrom and 9.6e-09 kbar. These checks establish agreement with the baseline, not absolute force accuracy. All matched SCF iteration counts agree. Validation includes one-thread controls, CPU execution, a build with CUDA disabled, and complex tensors on a 2x1x1 k mesh with two MPI ranks/GPUs.
The standalone CUDA executable and CPU/CUDA radial-table tests pass. Tests cover individual versus batched tables, product sharing, high angular momenta, origin/cutoff behavior, radial tiling and gradients.
Inputs, individual timings, numerical comparisons and test logs. All benchmark executables enable the same existing full-precision timer JSON output; that instrumentation is absent from these PRs.
Linked Issue
Related performance study: #30. Independently reviewable part of #32.
Governance Notes
Companion changes: Libxc scheduling and integral evaluation. All three branches start at the same frozen develop commit, have no prerequisite PR, and merge in all six orders without conflicts or differences in the resulting tree. Shared files with the integral-evaluation PR have separate change regions.
Core impact is limited to RI table construction and explicit device propagation. No documentation update required: the existing
deviceoption and its metadata are unchanged.<memory>is required by the owningshared_ptr<const ProductOrbitals>member. No governance exception is requested.