Skip to content

Retain CUDA memory pool allocations across LCAO exact-exchange iterations - #8519

Open
Stardust0831 wants to merge 5 commits into
deepmodeling:developfrom
Stardust0831:review/sai106-exx-pool-dc
Open

Stardust0831 wants to merge 5 commits into
deepmodeling:developfrom
Stardust0831:review/sai106-exx-pool-dc

Conversation

@Stardust0831

@Stardust0831 Stardust0831 commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

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.

Layout Pool policy Wall time (s) Peak host RAM per node (GiB) Peak single-GPU memory (GiB)
1 × 16 V100 Baseline 456.44 187.92 8.263
1 × 16 V100 Automatic 335.39 187.43 8.263
2 × 8 V100 Baseline 372.24 100.70 / 99.11 8.251
2 × 8 V100 Automatic 351.10 100.54 / 99.59 8.261

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.

Maximum single-GPU memory over the full run

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:

python3 replay/run_one.py local16 auto
python3 replay/run_one.py split8 auto

Build job 3286784 produced the tested executable from cbb385695. The follow-up commit 3ebd50ff6 spells 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.

Entropy-Enthalpy and others added 5 commits December 4, 2026 17:20
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 Stardust0831 added the GPU & DCU & HPC GPU and DCU and HPC related any issues label Dec 4, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

GPU & DCU & HPC GPU and DCU and HPC related any issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants