Repository navigation
feat(xc): offload Libxc grid potentials to CUDA - #8364
Stardust0831 wants to merge 9 commits into
Conversation
23464e9 to
3332ebf
Compare
|
@susilehtola Sorry to bother you here, but would you like to have a look? |
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
Static source review at 3332ebfd; no build or runtime tests were run.
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
Static review of the small-gradient test update at 222c9fcea225; no tests were run.
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
The finiteness checks are addressed in source at 95e2bd2b7. Three non-blocking follow-ups cover coordinated input rejection, the integrated noncollinear GPU test, and test-handle cleanup.
Static review only; no builds or tests were run, and CI was not verified.
| item.check_value = [](const Input_Item&, const Parameter& para) { | ||
| if (para.input.device_xc == "gpu") | ||
| { | ||
| ModuleBase::WARNING_QUIT("ReadInput", "device_xc gpu requires ABACUS built with -DENABLE_LIBXC_CUDA=ON."); |
There was a problem hiding this comment.
Non-blocking: Please route the unsupported-build rejection through the synchronized input-error path. check_value runs only on rank 0; with a CUDA build where ENABLE_LIBXC_CUDA=OFF, device gpu plus device_xc gpu makes rank 0 exit while the other ranks can enter DeviceContext::init's collective, leaving termination dependent on the MPI launcher. A multi-rank rejection test would cover this path.
| xc_gga_exc_vxc(&host[0], points, rho_data, sigma_data, exc_host_data, vrho_host_data, vsigma_host_data); | ||
| } | ||
| XC_Functional_Libxc::xc_cuda_exc_vxc(device[0], points, rho_data, sigma_data, | ||
| exc_device_data, vrho_device_data, vsigma_device_data); |
There was a problem hiding this comment.
Non-blocking: Please add a host/device comparison through v_xc_libxc, including an nspin=4, gga_grad=2 case and the returned energy, vtxc, and four potential channels. This test currently calls the raw CUDA helper, while the existing noncollinear finite-difference test uses the CPU overload, so neither protects the new backend choice through the full mapped-density path.
| } | ||
| } | ||
| XC_Functional_Libxc::finish_func(host); | ||
| XC_Functional_Libxc::finish_func(device); |
There was a problem hiding this comment.
Non-blocking: Please make both Libxc handle vectors clean up through a scoped owner or fixture TearDown. Any fatal assertion above returns before these finish_func calls, so a numerical mismatch also leaves the Libxc allocations live and can add misleading leak reports to the sanitizer run.
Reminder
AGENTS.mdanddocs/developers_guide/agent_governance.md.source/changes.Linked Issue
Related to deepmodeling/abacus-develop#3344: Support the GPU version of libxc.
Unit Tests and/or Case Tests for my changes
device_xc gpu. Si32 HSE06 converged with the default build and with both runtime choices in the opt-in build. The three final energies agreed within 6 × 10⁻⁹ eV.Si32 HSE06 benchmark, official Libxc 7.1.2. Both Libxc modes used the same executable, one Tesla V100, one MPI rank and four physical CPU cores. cuSOLVER used the GPU and exact exchange used the CPU throughout. The table reports medians from the original three runs per mode.
Download the Si32 case · Per-run timings
What's changed?
ABACUS can evaluate Libxc LDA/GGA potentials on CUDA, including the semilocal part of HSE. The CMake option
ENABLE_LIBXC_CUDAdefaults toOFF. To enable it, install Libxc 7.1.0 or later built with-DENABLE_CUDA=ONand configure ABACUS with-DUSE_CUDA=ON -DENABLE_LIBXC=ON -DENABLE_LIBXC_CUDA=ON. This uses the public Libxc host/device API. Libxc 7.1.2 releaseAt runtime,
device_xcdefaults tocpu. These INPUT settings select GPU evaluation.Governance Notes
device_xcacceptscpuorgpu. Its registration provides CLI help and the generated parameter reference. The installation guide describes the CUDA build requirements.xc.hfor the Libxc types and flags it uses.