Skip to content

experiment(lcao): retain cuSOLVER eigenvectors for Gamma FP64 density matrices - #8392

Open
Stardust0831 wants to merge 22 commits into
deepmodeling:developfrom
Stardust0831:experiment/dm-direct-98700b9
Open

Stardust0831 wants to merge 22 commits into
deepmodeling:developfrom
Stardust0831:experiment/dm-direct-98700b9

Conversation

@Stardust0831

@Stardust0831 Stardust0831 commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

What's changed?

Automatically form real FP64 Gamma LCAO density matrices from retained cuSOLVER eigenvectors and calculated occupations: D = C diag(f) C^T. Reuse solver and host buffers, and distribute DM in column blocks to limit temporary memory. Host eigenvectors remain available to existing consumers.

Applies to CUDA/MPI/LCAO builds with device gpu, ks_solver cusolver, nspin 1, kpar 1, lcao_sk_cut 0, and charge updates on one node with one visible GPU per rank. Other configurations retain the existing path. GPU DM errors identify the failed operation and terminate. Full/partial eigensolver selection is unchanged.

Performance

V100, four MPI ranks, one OMP/BLAS thread. DM times include download and distribution. CPU/GPU comparisons use the same executable and eigensolver; a measurement-only CPU-DM control is excluded from production, which is tested separately.

Case CPU DM / s GPU DM / s Speedup
Si1080 PBE 93.27 13.85 6.73×
Si216 PBE 0.92 0.62 1.48×

Si1080, one pair: total time 442.50→375.11 s (−15.2%); sampled host memory 20.831→20.814 GiB; GPU memory 10728→10736 MiB. The production cross-check takes 377.35 s with 20.789 GiB host memory. Si216 three-pair total-time medians are 39.65→40.22 s (+1.4%).

Small or EXX-dominated systems may see little overall benefit.

Unit Tests and/or Case Tests for my changes

Passed CUDA/MPI tests, H₂ Autotest on 1/4 ranks, CLI checks, and 1–4-rank DM/Tr(DS) comparisons. Si64 HSE with GPU EXX/Libxc agrees in energy, DM and forces. Coverage includes full/subset solves, fractional/signed occupations, buffer lifetime and aliasing, partial distribution blocks, and failure exits.

Verification commands
OMP_NUM_THREADS=1 ctest --test-dir build -V -R '^MODULE_HSOLVER_(direct_dm|direct_dm_failures|LCAO_cusolver|LCAO_sk_cut(_parallel)?)$'
OMP_NUM_THREADS=1 bin/MODULE_HSOLVER_direct_dm
bin/abacus_std_gpu --version
bin/abacus_std_gpu --check-input
bash ../integrate/Autotest.sh -a "$ABACUS" -n 4 -o 1 -j 1 -f SELECTED.txt -r '^scf_dm_gpu$'

All passed; Autotest also passed with -n 1 (SELECTED.txt contains scf_dm_gpu). Full regression, MD/relax and other GPU architectures were outside this focused validation.

Linked Issue

No separate issue; this extends the existing LCAO CUDA backend.

Governance Notes

No new INPUT parameter, CMake option or dependency. No documentation update required: this optimizes the existing GPU workflow. HSolver retains eigenvectors through occupation and DM construction. Added headers declare interface types; no global dependency increase or governance exception.

@mohanchen mohanchen added GPU & DCU & HPC GPU and DCU and HPC related any issues Performance Issues related to fail running ABACUS Refactor Refactor ABACUS codes labels Nov 25, 2026
@Stardust0831 Stardust0831 changed the title experiment(lcao): retain cuSOLVER eigenvectors for Gamma FP64 density matrices feat(lcao): build Gamma density matrices on GPU Nov 27, 2026
Preserve the upstream LCAO diagonalization interface and reject device_dm gpu with a nonzero lcao_sk_cut. Update INPUT coverage, document the restriction, and format the affected CMake files.
@Stardust0831 Stardust0831 changed the title feat(lcao): build Gamma density matrices on GPU experiment(lcao): retain cuSOLVER eigenvectors for Gamma FP64 density matrices Nov 27, 2026
@Stardust0831
Stardust0831 marked this pull request as ready for review November 28, 2026 06:40

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 Performance Issues related to fail running ABACUS Refactor Refactor ABACUS codes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants