Repository navigation
Retain CUDA memory pool allocations across LCAO exact-exchange iterations - #8519
Open
Stardust0831 wants to merge 5 commits into
Open
Stardust0831 wants to merge 5 commits into
Stardust0831 wants to merge 5 commits into
Conversation
Add an opt-in pool release policy for CUDA EXX. Restore the previous release threshold after the run and preserve the ordinary allocator behavior on unsupported devices.
Let ranks on the same node share screened C-derivative tensors for EXX force and stress calculations. Keep node-local sharing optional and preserve the context while a derived workspace is alive.
Stardust0831
requested review from
ABACUS-PR-BOT,
Critsium-xy,
maki49 and
mohanchen
December 4, 2026 16:52
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?
On entry to GPU exact exchange (EXX), ABACUS allows the default CUDA memory pool to retain freed blocks for the next contraction. This avoids repeatedly returning memory to the driver at synchronization points and requesting it again in the next iteration. The policy applies automatically when the device supports memory pools, the active pool is the device default, and its release threshold is zero. At LCAO solver shutdown, ABACUS restores the threshold if it still holds the value ABACUS set, then requests a trim.
Unit Tests and/or Case Tests for my changes
We tested a 90-atom CsPbI₃ RI-HSE single point with forces on V100 GPUs provided by SAI. Both layouts used 16 MPI ranks, one GPU per rank, one thread per rank, and the same frozen input (
exx_separate_loop=0). Each comparison uses one historical baseline and one automatic-pool run in separate Slurm allocations. Host RAM is the sampled peak per node, excluding regular file cache. GPU memory is the largest sampled usage on any single card over the full run.Wall time fell by 26.5% on one node and 5.7% on two nodes. During EXX, the baseline repeatedly released and reacquired GPU memory. With automatic reuse, the trace stayed near its plateau and peak usage remained about 8.26 GiB per GPU.
Both layouts passed all nine checks: total energy, EXX energy, force components, density matrix, Hamiltonian, overlap, electron count, fractional occupations, and SCF iteration counts. Total and EXX energies agreed at output precision, the largest force-component difference was approximately 1 × 10⁻¹⁰ eV/Å, and all runs completed 23 pre-SCF and 18 HSE iterations.
The SAI replay harness ran these commands in their respective allocations:
Build job
3286784produced the tested executable fromcbb385695. The follow-up commit3ebd50ff6spells out three CUDA variable types; the V100 benchmark was not repeated for that type-only edit. The end-to-end test covers periodic forces; stress was disabled.Governance Notes
The change requires no new INPUT parameter. The RI EXX object manages pool retention; the LCAO ESolver ends it after its runners finish. External pool policies are preserved. No governance exception is requested.
Acknowledgments
Thank you to @Entropy-Enthalpy, SAI's CTO, for helping with the end-to-end testing and drafting the initial implementation. I retained his Git authorship on the original CUDA pool commit.