Repository navigation
feat(lcao): add optional LibRI GPU contractions through DDLA - #8169
Conversation
|
the LibDDLA version which is compatible with LibRI GPU is https://github.com/userchba/LibDDLA/releases/tag/v0.0.4, current LibRI GPU can't correctly compute symmetry situation which LibRI CPU can compute correctly |
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
Static review of f07d8d14f39d26782490cc4bc15d0a58c5700e62 with independent source review and adjudication. No build/runtime/MPI/GPU tests were run; CI diagnostics were unavailable.
|
To be consistent, I think device_exx maybe better than exx_device |
Thank you for the review and suggestions; I’ve renamed exx_device to device_exx. |
|
@Growl1234 Could you check the cmake changes for this PR? |
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
The GPU-enabled main test target MODULE_RI_exx_workspace needs its DDLA link dependency; the inline comments also cover two nonblocking follow-ups. This review is source-only: no build or test was run, author-reported results remain attributed, and CI was not independently checked.
Keep the upstream restart-test source and the serial reader registrations.
Remove the temporary symmetry rejection and update input coverage and installation guidance for LibRI v0.3.0.0.
I suggest the ddla release 0.0.7 https://github.com/userchba/LibDDLA/releases/tag/v0.0.7 which support no C++ 17 command when compile abacus, but compiling LibDDLA also need C++17 standard, and also this version will be more cleaner for some definition in LibRI |
Consume DDLA's public GPU capability without relying on its private backend definitions. Remove the C++17 requirement from ABACUS and update the installation guidance and standalone consumer check.
|
Thanks for the suggestion, @userchba. Updated to DDLA v0.0.7 with ABACUS remaining at C++14 and using the public |
|
Thanks for the updates and the detailed validation, performance benchmarks, and memory analysis. I have no further concerns from my side and consider this PR ready to merge. |
There was a problem hiding this comment.
No issue on CMake side for now, but I am generally 👎 on how this feature is technically handled. I wonder if the LibRI/LibComm developers would be willing to introduce CMake support and (more importantly) clean up the interfaces for downstream integration. The current integration of LibRI into ABACUS's RI code suffers from poor encapsulation, both within LibRI itself and at the integration layer. For example, since LibComm and cereal are just dependencies of LibRI code, their headers should only be included (#include ...) on the LibRI side. The same should probably apply to DDLA as well.
Thanks for raising this. I agree that ABACUS should use a LibRI interface for RI communication, but it needs follow-up works beyond the scope of this PR. |
|
I found 'auto' keyword in the PR, try avoid using 'auto' in future codes. @Stardust0831 |
|
Thank you for the reminder, Prof. Chen. I’ll favor explicit types to make the code easier to read. I’ve opened #8390 to replace all five uses of |
What's changed?
Enable optional GPU acceleration of LCAO Kohn–Sham exact-exchange tensor contractions through LibRI's DDLA CUDA backend.
ENABLE_LIBRI_GPUdefaults toOFF; INPUTdevice_exxdefaults tocpu. Build withUSE_CUDA=ON,ENABLE_LIBRI_GPU=ON, an explicit compatibleLIBRI_DIRand a CUDA DDLA installation, then select:GPU RI supports spatial symmetry and real-space EXX reduction. Use the official LibRI v0.3.0.0 release at
589f6f8c6df3916575a1ba41e840de919d40d345and a CUDA build of DDLA v0.0.7 (0a65e570d3d3bc70e4d53a7e992b2de60abc884c), or newer compatible releases. CMake consumesLibDDLAConfig.cmake/ddla::ddla, uses the publicDDLA_HAS_GPUcapability, and checks real/complex GPU API compilation and linkage. Both CPU and GPU RI require C++14 in ABACUS; building DDLA itself requires C++17. CPU RI retains its existing dependency selection.The selector applies to LCAO Kohn–Sham exchange. LR/RDMFT engines retain CPU contractions, including when LR reuses Kohn–Sham exchange geometry. All ranks on a node must see the same allocated GPU list, with at least as many visible GPUs as local ranks; per-rank single-GPU masking is unsupported. Build/install instructions and INPUT help describe the supported setup.
Unit Tests and/or Case Tests for my changes
The validated source matches ABACUS
e47e26947e6620fee11a44de3fdb520b49fae76e, with the official LibRI and DDLA releases above, on one V100 / one MPI rank with OMP=1 and BLAS=1. Full report · raw inputs, outputs and build logs, 2.23 MiB · independent numerical audit.symmetry 1, real-space reduction off/on, displaced Si2 with nonzero forces, and water Gamma withnspin=1/2.--check-inputpasses 8/8 direct single-process cases;--versionpasses.git diff --checkpass. The report preserves the expected old-probe configuration failure and an initial audit error that incorrectly required GoogleTest targets to use C++14, followed by the corrected production-object audit.Commands and configure options are in dependency validation, application validation and runtime validation. Focused checks:
Benchmark results
The Si64 timings below use the recorded earlier dependency revisions; performance was not remeasured for DDLA v0.0.7.
HSE06 Si64 on SAI
16V100: one V100, one MPI rank/four bound physical CPU cores, OMP=4, BLAS=1; APNS efficiency LCAO, Γ-only, 128 bands, 100 Ry, SCF=1e-8, RI thresholds=1e-4. Fresh atomic starts;symmetry -1, forces enabled, stress disabled. The existingexx_symmetry_realspaceparameter automatically becomes 0 here.Download original inputs and small outputs — 2.57 MiB tar.gz, 490 files · full report · individual timings CSV · numerical comparisons CSV · file/checksum manifest.
The archive contains original INPUT/STRU/KPT files, Si pseudopotential/orbitals, outputs ≤10 MiB/file, scripts and validation logs; larger omissions are listed in the manifest. Downloaded archive SHA256 verified:
4ca994d552094f9e3180751b6572653798d1463ccec9c893c3308f5143fe5587.“beta13 baseline” denotes a baseline built from ABACUS v3.11.0-beta13, with the versions below. Commit IDs distinguish dependency revisions that share a header version string.
4e9f1636b7cab0eff7ad70ab, CPU; header version 2.1.10e8afc393, GPU3c7794c5047d, GPUf2667c6ee, same executablea385ac9, CPU/GPUBefore/after timing composition. Ideal Si64, two starts per variant, paired within two allocations with reversed execution order. Means in seconds; wall time includes initialization, the initial GGA SCF, HSE SCF and complete atomic forces. Three decimals preserve means of timers printed to 0.01 s.
The 9.84× beta13 comparison saves 757.165 s: electronic EXX contributes 44.06%, EXX forces 48.72%, and remaining work 7.22%. It includes dependency/build changes. Baseline → PR CPU LibRI already gives 3.34×, combining ABACUS/dependency/build changes; this is not an isolated LibRI-version comparison. Selecting GPU in that same PR executable then gives 2.95×, with LibXC fixed on CPU and 99.95% of the saving in the two EXX scopes. Baseline → PR GPU LibRI is 9.85× overall.
The paired gains are 10.69×/9.11× for beta13 → experimental and 3.05×/2.85× for PR CPU → GPU; only two repetitions are available. Remainder = wall − electronic EXX − EXX forces. The following nested timers overlap these scopes and must not be added again; effective potential includes LibXC potential.
Calculation consistency. All 10/10 scientific runs finish normally, converge below 1e-8 and output 64 force vectors; 9/9 numerical comparisons pass. Ideal runs retain 12 GGA + 8 HSE iterations. The displaced CPU/GPU pair both use 12 + 12 iterations, with final residual 9.742e-9. The table reports maximum differences across paired runs.
Cross-build limits are 1e-6 eV/atom and 1e-5 eV/Å; same-PR CPU/GPU limits are 1e-8 eV/atom and 1e-6 eV/Å. Force differences are per-atom Euclidean vector norms. The extra pair moves the first Si atom by (+0.01,+0.02,−0.015) Å and has maximum force 0.398013 eV/Å, verifying nontrivial forces; it is not pooled into the ideal-structure timings. Original references and tolerances are unchanged.
Earlier beta13/CP2K and LibRI PR #17 comparisons remain separately documented with their original inputs and outputs.
Linked Issue
Reproduction data and timing composition.
Governance Notes
device_exx. The existingsymmetryandexx_symmetry_realspacesettings work with CPU and GPU RI; no additional INPUT parameter is introduced. Generated INPUT documentation is not committed.LibRI::LibRIandddla::ddla. The RI workspace test links toLibRI::LibRIso its optional DDLA dependency reaches Debug builds too.git diff --checkpass. No new direct MPI calls, test access macros, dependency implementation patches or custom DDLA finder are introduced.