Repository navigation
perf(lcao): reuse common terms across magnetic components - #36
Draft
Stardust0831 wants to merge 1 commit into
Draft
Stardust0831 wants to merge 1 commit into
Stardust0831 wants to merge 1 commit into
Conversation
This was referenced Nov 2, 2026
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?
RI integral assembly repeatedly evaluates the same radial interpolation and solid harmonics for different magnetic components. Compute these common terms once per orbital pair and reuse the two-center results during three-center assembly.
The scalar interfaces remain available. The new vector evaluation preserves each component's angular summation order; common-factor reuse can change FP64 rounding. Temporary arrays are local to evaluation, with no persistent geometry cache or device allocation.
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::cal_exx_ionsincludes geometry-dependent integrals and their derivatives. This PR does not change the EXX force contraction.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 integral tests pass. The tests compare all magnetic components against scalar evaluation, cover origin/near-origin/cutoff behavior, and check gradients by finite differences in all three directions.
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 radial tables. 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 radial-table PR have separate change regions.
No documentation update required: this changes internal LCAO integral evaluation without changing INPUT metadata, dependencies or numerical settings. No governance exception is requested.