Repository navigation
feat(lcao): add optional LibRI GPU contractions through DDLA - #8169
Stardust0831 wants to merge 18 commits into
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.
| (default OFF), `USE_CUDA=ON`, and a CUDA build of DDLA. Like other dependent | ||
| options, GPU RI is disabled when its LibRI/CUDA prerequisites are disabled. | ||
| INPUT `exx_device` defaults to `cpu`, retaining CPU contractions even with | ||
| `device gpu`. To use GPU contractions, set both `device gpu` and `exx_device gpu`. |
There was a problem hiding this comment.
[P2] State the GPU visibility requirement for MPI runs
For two ranks on one node, exposing one different GPU per rank through CUDA_VISIBLE_DEVICES passes ABACUS device setup but makes the pinned LibRI validate_local_gpu_count() throw at the first GPU contraction (local_size=2 > device_count=1). This backend therefore requires each process to see at least as many GPUs as there are node-local ranks, a constraint missing here. Please document it with a compatible launch layout, or extend the compatibility patch to respect the existing per-rank binding.
| Exx_Info& exx_info) | ||
| { | ||
| #ifdef __EXX | ||
| const bool use_gpu = inp.exx_device == "gpu"; |
There was a problem hiding this comment.
Non-blocking: Please clarify the selector's scope for independent LR/RDMFT exchange engines. Standalone LR, fresh LR-kernel setup after KS, and RDMFT construct their own Exx_LRI objects, which retain CPU mode despite accepted exx_device=gpu; matching-kernel KS pointer reuse retains GPU mode. If those engines are in scope, pass the selection to them; otherwise document or reject the unsupported combinations. A follow-up after merge is fine for these additional workflows.
| { | ||
| return 1; | ||
| } | ||
| lri.cal_mode = RI::LRI_Cal_Mode::GPU; |
There was a problem hiding this comment.
Non-blocking: Consider an opt-in numerical regression for the patch's signed accumulation in a follow-up after merge. This consumer switches cal_mode but then executes only CPU nrm2, and the configure probe only compiles/links. Alongside the reported force/stress runs, a tiny real/complex CPU-versus-GPU case with nonempty output and repeated +1/-1 contractions would preserve the specific accumulation fix across dependency updates.
|
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? |
| if(ENABLE_LIBRI_GPU) | ||
| message( | ||
| FATAL_ERROR | ||
| "ENABLE_LIBRI_GPU requires an explicitly supplied, patched LIBRI_DIR; " |
There was a problem hiding this comment.
Does it mean that LibRI master branch hasn't yet accepted the LibRI changes? If this is true then this PR should not be merged on abacus side first.
There was a problem hiding this comment.
LibDDLA has CMake config export, why is FindDDLA module needed here?
|
I have no further comment within this PR's scope. |
|
An update on the LibRI dependency fixes:
The ABACUS test results reported in this PR still use the temporary compatibility patch. The new direct-accumulation implementation has passed LibRI-level GPU regression tests with DDLA v0.0.4, but this PR has not yet been updated to use it or retested with full ABACUS HSE calculations. I plan to move this PR back to draft while the remaining LibRI fix is pending upstream. Once merged, I will update the dependency, remove the compatibility patch, address the remaining review comments, and sync with develop. I will then rerun the HSE single-point energy, force, and stress regressions before marking this PR ready for review again. |
What's changed?
Enable optional GPU acceleration of LCAO exact-exchange RI tensor contractions through LibRI's DDLA CUDA backend.
ENABLE_LIBRI_GPUdefaults toOFF, and INPUTdevice_exxdefaults tocpu. Settingdevice gpualone keeps RI contractions on the CPU; setdevice_exx gputo select GPU RI as well.This PR remains a draft pending a compatible LibRI release. The required accumulation, OpenMP, atom-list and symmetry fixes have merged upstream in LibRI #15 and #16, but are not included in the latest published release,
v0.2.1.1. Development tests use an exact upstream commit; the supported dependency will be a validated official release.Before marking this PR ready:
Build configuration, once compatible dependencies are installed:
Real-space EXX symmetry is supported with
symmetry 1andexx_symmetry_realspace 1. The obsolete ABACUS rejection has been removed, and its input test now verifies acceptance without changing the user's settings. Installation instructions no longer require a Gitee branch or extra OpenMP patch.Dependencies and supported scope
LIBRI_DIR. DDLAv0.0.4(9c404ac) is the tested backend. CMake checks GPU API compilation and linking; the minimum release check remains on the draft checklist above. The default CPU dependency download is unchanged.docs/advanced/install.mdandabacus -h device_exx.Unit Tests and/or Case Tests for my changes
Development validation uses ABACUS
1bd79c473and upstream LibRIa0661cb, with no additional patches to either repository. Hardware: NVIDIA V100-SXM2 16 GB GPUs, GCC 13.3/OpenMP and DDLAv0.0.4/CUDA. These results do not replace the final release validation above.Complete build logs, inputs, commands and comparisons include both source revisions and checksums.
OMP_NUM_THREADS=1is used unless a test explicitly checks four threads. Repository reference files and tolerances are unchanged.Verification commands and limits
The linked record contains the complete configure commands and raw output. The principal ABACUS checks are:
HSE tests use the existing
tests/integrate/Autotest.shandscf_hse_symm_multikfixture. Five solver/RI/symmetry combinations run with real and complex RI tensors on one and two MPI ranks. The fixture's forces vanish by symmetry, so this matrix does not establish nonzero-force behavior with symmetry enabled.BSE is compiled but its numerical paths are not tested. MAGMA, full MKL application builds, NCCL runtime behavior, multi-node execution, SOC and long MD runs remain unverified. GPU regression builds disable NCCL because the input-test target previously had unresolved NCCL symbols. Earlier Si32 testing needed
scf_ene_thr=1e-8for consistent outer-loop stopping; default-threshold convergence needs further validation.Earlier Si64 force benchmark
These timings were measured at ABACUS
63ca5efwith the earlier dependency configuration and have not been rerun with the current LibRI code. A displaced Si64 HSE/DZP Gamma-point case uses 832 orbitals. Hardware: V100-SXM2 16 GB GPUs and an AMD Ryzen Threadripper PRO 5995WX CPU, with four physical CPU cores per GPU.CPU-only and single-GPU runs have the same four physical cores; two-GPU runs have eight. Seven CPU MPI/OpenMP ratios and two single-GPU configurations were tested. Selected configurations were run twice; the table reports their mean times. The CPU baseline uses the fastest tested configuration for each stage.
CPU-only uses ScaLAPACK and CPU RI; GPU runs use cuSOLVER and GPU RI. Holding cuSOLVER, MPI/OpenMP settings and CPU affinity fixed, changing CPU RI to GPU RI gives 3.87x for all force work and 1.49x overall. This comparison uses one CPU-RI run and the mean of two GPU-RI runs.
All 15 runs converged in 7 outer and 96 inner iterations. Across all 192 force components, the largest difference from the CPU reference was
1.5e-9 eV/Angstrom. These measurements cover one case on one node; EXX and all-force times are nested timers, while complete-calculation time includes launch, initialization and SCF.Linked Issue
No linked ABACUS issue; this adds optional support for an existing LibRI backend.
Governance Notes
device_exxincludes validation, MPI broadcast, help metadata and focused tests. GPU symmetry acceptance and installation guidance are updated together; generated parameter documentation is not committed.LibRI::LibRIandDDLA::DDLA. No new global dependencies. GPU RI requires C++17; CPU RI retains C++14.