Repository navigation
Conversation
Restore the upstream formatting of the ENABLE_CNPY block so the ENABLE_DDLA diff stays focused.
5154d73 to
4dec9ac
Compare
|
Hi @AsTonyshment, could you review this eigensolver-only follow-up to #8474? It adds |
AsTonyshment
left a comment
There was a problem hiding this comment.
Ah, this implementation looks significantly cleaner than the previous one.
However, it is not up to me to decide whether to introduce new dependencies or not. This may need further discussions with @mohanchen and other relevant developers :)
|
Thanks for reviewing the narrower implementation. Upstream ABACUS already uses LibDDLA 0.0.7 or newer for the optional LibRI GPU/DCU contractions introduced in #8169. This PR uses the same CMake package and ddla::ddla target for LCAO generalized diagonalization in HSolver. The new ENABLE_DDLA option defaults to OFF. It lets users opt into the eigensolver independently of LibRI. With both ENABLE_DDLA and ENABLE_LIBRI_GPU disabled, ABACUS builds without LibDDLA. The decision here is whether to extend the use of the existing optional dependency to HSolver. I’d welcome feedback from @mohanchen and the other maintainers on that scope. |
|
Before proposing any code to be merged, please open an issue first to explain why this change is needed, what limitations the existing approach has, and how the codebase will be improved after adding it. The goal of developing ABACUS is to solve problems, not to keep adding code that does not solve any. Based on the current PR description, I do not see what challenging problem this PR solves. We will not merge code just for the sake of merging code. Please state in the issue what problem you want to solve and how you plan to solve it. In this PR, you need to highlight what problem the newly added method solves. From your comparison between 4 GPUs and 1 GPU using cuSOLVER, I do not see any advantage. Compared with ScaLAPACK, it even looks slower—so I am very confused about what problem this PR is trying to solve. |
|
Thanks for the feedback. I’m sorry I didn’t clearly explain what problem I was trying to solve in the original PR description. I opened #8508 to discuss the missing path for distributing a single LCAO eigensolve across HIP/DCU devices. The current patch still needs HIP validation. On CPUs, the use case is memory-limited hybrid DFT with LibRI. More MPI ranks can increase peak node memory, so we use fewer ranks and more OpenMP threads per rank. I’m testing whether LibDDLA keeps diagonalization efficient in that layout. I’ll compare it with CPU ELPA and ScaLAPACK at a fixed core count and report eigensolver time, total SCF wall time, and peak node memory. |
Reminder
AGENTS.mdanddocs/developers_guide/agent_governance.md.What's changed?
Add
ks_solver ddlaas an optional LCAO solver for real and complex generalized eigenproblems on CPU and CUDA. The existing HSolver dispatcher callsDiagoDdla, which owns the LibDDLA handles and buffers. It copies H and S into backend storage for each solve and returns the requested eigenvectors to the existing host workflow.ENABLE_DDLAdefaults toOFF. To enable it, configure with-DENABLE_DDLA=ON -DENABLE_MPI=ON -DENABLE_LCAO=ONand point CMake to LibDDLA 0.0.7 or later. Setks_solver ddlaandkpar 1in INPUT. CUDA execution also requires a CUDA-enabled LibDDLA build and one MPI rank per active GPU.Linked issue
This is the eigensolver contribution discussed in #8474.
Draft status and HIP benchmark
ABACUS needs to enable and validate ELPA's HIP backend for distributed LCAO diagonalization on AMD GPUs and Hygon DCUs. The integration is tracked in #8508.
Once ABACUS can run ELPA on the DCUs, I will benchmark LibDDLA and ELPA on the same Si1024 input using four Hygon DCUs and one MPI rank per device. The comparison will use the same ABACUS revision and SCF settings, verify that both solvers execute on the DCUs and agree numerically, and report eigensolver time, SCF wall time, and peak host and device memory. The prior HIP/DCU results below are from an earlier integration.
Unit tests and case tests
ENABLE_DDLA=ONandOFFusingcmake --build <build-dir> --parallel 8 --target <targets>. Builds with DDLA disabled passed withCMAKE_DISABLE_FIND_PACKAGE_LibDDLA=TRUE.mpirun -np <1|4|6> --bind-to core ./MODULE_HSOLVER_diago_ddlafor CPU numerical tests in the DDLA-enabled builds. Ranmpirun -np <1|4> --bind-to core ./MODULE_HSOLVER_LCAO_sk_cutin all four builds. All 14 MPI suite invocations passed.ctest --test-dir <build-dir> --output-on-failure -R '^(02_NAO_Gamma_ddla|03_NAO_multik_ddla)$'. Both CPU SCF cases passed. The native CPU Si and Fe runs used ScaLAPACK and ELPA, respectively.ABACUS_TEST_DDLA_GPU=1 mpirun -np <1|2> --bind-to core ./MODULE_HSOLVER_diago_ddla --gtest_filter=DiagoDdla.GpuRealAndComplexand repeated both SCF comparisons against cuSOLVER usingmpirun -np <1|2> --bind-to core ./abacus_basic_gpu.kpar 2, and a GPU request with the CPU-only LibDDLA library.Force and stress aggregates matched at printed precision. HPC3 jobs 4218694, 4218752, and 4218814 passed. The validated source tree matches functional commit
cf32719ff. The follow-up5154d73b7restored upstream CMake formatting. The legacy Make build and HIP build/runtime remain untested.Governance notes
The build flag and INPUT option are documented in the installation guide. HSolver owns the DDLA dispatch and state. The other runtime changes register the solver's matrix layout and SCF display label. The existing density and response paths continue to consume the same host outputs. No governance exceptions requested.
Prior GPU benchmark
The earlier branch from #8474 (
bae4e7473) was timed on one HPC3 node with four V100s allocated and four MPI ranks. For these single-k-point inputs, cuSOLVER used one active GPU and LibDDLA used four. Each measurement ran three LCAO SCF iterations, with three separate process launches per solver and size. The figure reports whole-run wall time.For Si512, the cuSOLVER-to-LibDDLA median time ratio was 1.16× in this allocation. cuSOLVER had the lower median for Si128 and Si256. These measurements are from the earlier branch (HPC3 job 4215721). Performance of the eigensolver-only branch at these sizes has yet to be measured.
LCAO solver time on CPU and CUDA
The same Si128/256/512 inputs were also timed on one HPC3 CPU node with 48 physical cores (4 MPI ranks × 12 threads). The CUDA run used 4 MPI ranks × 3 host threads, with the active GPU counts shown below. These are medians of rank-0
HSolverLCAO::solveelapsed time, summed across three SCF iterations per launch, with three launches per solver and size. This timer covers the ABACUS solver step, including work outside the eigensolve kernel.ELPA had the lowest CPU median at all three sizes. On CUDA, Si512 took 19.32 s with LibDDLA versus 27.45 s with cuSOLVER in this allocation, a 1.42× solver-time ratio. The CUDA Si256 sample ranges overlap. Both HPC3 jobs (4215720 and 4215721) used the earlier #8474 branch. GPU ELPA and cuSOLVERMp were outside this test matrix.
Prior HIP/DCU results
An earlier ABACUS 3.11.0-beta12 integration with LibDDLA 0.0.6 was tested on gfx906 DCUs (job 23298926). Each cell is one whole-process measurement at one-second resolution. The CPU used one thread per rank, and HIP used one DCU per rank.
The Si and Fe runs agreed with the matched CPU runs within 6.37 × 10⁻¹² eV in total energy. The DCU wall times were higher for both small cases. Matched larger HIP timings and GPU ELPA comparisons on the eigensolver-only branch remain open.
Standalone LibDDLA benchmark at fixed CPU core count
The figure compares standard dense eigensolves outside ABACUS on HPC3. Each layout uses 40 physical CPU cores and changes the number of MPI ranks and cores per rank (1×40, 4×10, 20×2, or 40×1). The test requests all eigenvectors of a synthetic 10,000×10,000 real or complex double-precision matrix, with block size 64. Points are medians of three maximum-rank wall times after one warm-up. Whiskers span the observed range.
In this LibDDLA development snapshot (based on
50b5314), the two-stage solver took 19.80 s real and 53.22 s complex at 1×40, and 10.19 s real and 29.48 s complex at 40×1. The ELPA 4×10 spike is specific to the tested 2025.01.001 build and layout. This figure characterizes the standard eigensolver's sensitivity to process layout. The ABACUS SCF benchmarks above use generalized eigensolves.Runtime selection of the LibDDLA eigenmethod
ABACUS calls LibDDLA's
phegvd. After reducing the generalized problem to standard form, LibDDLA selects the eigensolver method at runtime. In the defaultDDLA_EIGEN_METHOD=automode, its dispatch rules use the matrix size, number of requested eigenvectors, backend, MPI process grid, and thread settings. They select among the eligible methods without timing both on each solve. In the tested LibDDLA snapshot, distributed partial-spectrum requests default to two-stage. For controlled comparisons, LibDDLA acceptsDDLA_EIGEN_METHOD=one_stageortwo_stage.For example, a separate LibDDLA development snapshot was benchmarked on four gfx906 DCUs with a 2×2 process grid and block size 64. The standalone
pheevdtest requested all eigenvectors and passed its numerical checks. The times below are medians of four warmed solves per method from two launches in alternating order.Standalone generalized eigensolver on CPU, CUDA, and DCU
This benchmark exercises the dense generalized problem$AX=BX\Lambda$ outside ABACUS. Each platform solves the same order-5,000 matrix pair for each precision and returns all eigenvectors. All runs use four MPI ranks on a 2×2 grid with block size 128. CPU runs use 24 threads per rank. Accelerator runs use one rank and one host thread per device. The table reports median maximum-rank wall time over three solves after one warmup. Accelerator timings include host–device transfers.
On the CPU node, ScaLAPACK had the lowest median for both precisions. On four V100s, LibDDLA was 2.13× faster than ELPA in real FP64 and 2.70× in complex FP64. On four DCUs, the corresponding ratios were 1.93× and 3.24×. Whiskers in the figure show the minimum and maximum measured times.
The archived HPC3 CPU and CUDA measurements use LibDDLA
1ff05d9(jobs 4025795 and 4026599). The CPU job also included separate one-rank cases that exceeded the OpenBLAS thread limit. The four-rank cases shown here passed validation. The new df_dcu comparison uses LibDDLAbf2ecfcand DTK 25.04.3 (job 23511048). The maximum DCU eigenvalue difference against the CPU and CUDA archives was 2.78 × 10⁻¹⁵. These standalone results compare libraries within each platform.Standalone CPU eigensolver benchmark on df_dcu
Each run used one Hygon C86 7185 node with 30 physical CPU cores, HPC-X Open MPI and block size 64. All seven configurations solved the same 10,000 × 10,000 standard eigenproblem and returned all eigenvectors. Points show the median maximum-rank wall time across three independent MPI launches and whiskers show the observed range. All 252 timed solves passed numerical checks. LibDDLA was built from
4f93216. The references were ScaLAPACK 2.2.2, ELPA 2026.02.001 (AVX2/OpenMP), and oneMKL 2024.2.2 and 2026.2.2.For complex double, oneMKL 2026 took 718.7 s at 5×6 and 173.2 s at 30×1. LibDDLA two-stage ranged from 137.6 to 152.2 s across the six layouts. The fastest results in the sweep were ELPA two-stage at 37.1 s for real double (30×1) and ELPA one-stage at 99.6 s for complex double (15×2). The benchmark is standalone. ABACUS LCAO solves the generalized H/S eigenproblem.