Repository navigation
perf(lcao): batch RI radial table construction on CUDA - #8257
Merged
Merged
Conversation
4 tasks done
QuantumMisaka
requested review from
ABACUS-PR-BOT,
Flying-dragon-boxing,
PeizeLin,
maki49 and
mohanchen
November 2, 2026 03:11
AsTonyshment
reviewed
Nov 2, 2026
ABACUS-PR-BOT
left a comment
Collaborator
There was a problem hiding this comment.
No confirmed correctness defect found in the current in-tree paths. The inline comments ask to clarify selective-table reuse and name the workspace-limit calculations.
Static review of dfc71eb1 against d20090cc: whitespace passed and governance checks completed with no blockers. No builds or runtime tests were performed; the reported numerical and performance results remain author-reported.
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).
ABACUS-PR-BOT
left a comment
Collaborator
There was a problem hiding this comment.
The selective-initialization update preserves existing entries and covers repeated individual and mixed-batch calls. One additional ownership-lifetime regression would strengthen coverage. Static review only; no builds or runtime tests were run.
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.
mohanchen
approved these changes
Nov 3, 2026
This was referenced Nov 3, 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.
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. The quadrature grids, weights, derivative recurrence and analytic origin values are preserved.
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. Required integral gradients remain calculated.GPU batching uses
device gpuin a CUDA build. It works with the default LibRI revisionb0eff7aand requires no DDLA, LibRI GPU backend, or new build/INPUT option. Other RI consumers retain CPU execution.Performance
LCAO HSE calculations on displaced Si32 and CsPbI3 (5 atoms), using one V100, one MPI rank, four physical CPU cores/OpenMP threads and serial BLAS on SAI. Both versions use cuSOLVER diagonalization and CPU LibRI contractions. The baseline is unmodified
d20090cc137f.Ranges cover two paired runs in separate allocations on shared nodes, with reversed execution order. Ratios are calculated within each pair; SCF iteration counts match. Complete time includes process startup. The
Exx_LRI::initspeedup includes GPU batching and product preparation reuse.Explicit GPU workspace and corresponding host staging are each bounded at 160 MiB per MPI rank and released before SCF. CUDA context/library allocations and existing host tables are outside this bound. Sampled process GPU peaks were 442–450 / 460–462 MiB for Si32 and 438 / 530 MiB for CsPbI3 (baseline / this PR; 0.5 s sampling).
Unit Tests and/or Case Tests for my changes
The full CUDA executable build and CPU/CUDA radial-table tests passed with one and four OpenMP threads, including execution of the GPU test. Tests cover individual versus batched tables, product sharing, high angular momenta, origin/cutoff behavior, radial tiling and gradients.
The benchmark cases, a CPU execution control, and complex-tensor Si32 on a regular 2x1x1 k mesh with two MPI ranks/GPUs all converged with matching iteration counts. Maximum differences were 2.2e-11 eV/atom, 2.3e-9 eV/Angstrom and 9.6e-9 kbar. These comparisons establish agreement with the baseline. The combined changes also passed a build and regression checks with CUDA disabled.
Inputs, timings, numerical comparisons and test logs. Benchmark executables enable identical existing timer JSON output; this instrumentation is excluded from the change.
Linked Issue
Supersedes the radial-table preparation part of #8193 and can be merged independently of the integral-evaluation and Libxc optimizations. LibRI/DDLA GPU contractions remain separate in #8169.
Governance Notes
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 for the owningstd::shared_ptr<const ProductOrbitals>member.