PPCG validation#
The current accuracy comparison uses CG as the reference solver. Fe ground-state acceptance and the original strict precision stress are reported separately. Historical timing and CUDA results below do not certify strict eigenpair convergence.
Current automated and manual coverage#
The CUDA workflow uses the common HSolver GPU test selection and the standard PW GPU integration runner. Its PPCG coverage is:
Check | Selection | Execution |
|---|---|---|
HSolver GPU unit tests |
| CUDA CI |
Seven ordinary PPCG GPU fixtures |
| CUDA CI through the standard Autotest runner |
Original strict 23-band Fe fixture |
| Manual diagnostics |
Application CI uses the standard Autotest exit status and reference comparisons. Residual tracing remains opt-in for manual analysis. The workflow does not enable PPCG trace collection, add a residual-warning gate, run the strict Fe diagnostic, or upload PPCG-specific diagnostic artifacts. This section describes the test configuration; the dated results below retain their original commits and commands.
Workflow cleanup verification (2026-12-01)#
The application and all three HSolver GPU test targets were rebuilt from the 7b799dd9e code with the workflow/documentation cleanup applied. On an RTX 3090, the common CTest selection passed 3/3 targets: 43 LOBPCG, 10 Davidson-subspace and eight PPCG runtime tests. A fresh copy of the complete CASES_GPU.txt suite passed 15/15 application cases and 317 reference checks, including all seven ordinary PPCG cases. This run used two MPI ranks per case, one OpenMP thread, four concurrent cases and no PPCG residual tracing. No PPCG nonconvergence warning was found in these local case logs.
cmake --build build-ppcg-ci-repro-20261125 --target \
MODULE_HSOLVER_lobpcg_gpu MODULE_HSOLVER_dav_subspace_gpu \
MODULE_HSOLVER_ppcg_gpu -j4
cmake --build build-ppcg-ci-repro-20261125 --target abacus_pw_gpu -j4
OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1 \
ctest --test-dir build-ppcg-ci-repro-20261125 -V --timeout 1700 \
-R '^MODULE_HSOLVER_.*_gpu$'
# From the isolated copy of tests/11_PW_GPU:
env -u ABACUS_PPCG_RESIDUAL_TRACE OMP_NUM_THREADS=1 \
OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1 \
ABACUS_EXE=/mnt/data/Cheerly/abacus-develop-v3/build-ppcg-ci-repro-20261125/abacus_pw_gpu \
bash ../integrate/Autotest.sh -n 2 -o 1 -j 4 -f CASES_GPU.txt
Workflow parsing, Bash syntax, the exact three-target selection, unchanged case lists, actionlint and whitespace checks passed. The production solver, fixture inputs, references and tolerances are unchanged. Raw logs and the isolated fixtures are retained in /mnt/data/Cheerly/ppcg-cuda-workflow-cleanup-20261201/.
Davidson-subspace prerequisite (2026-12-01)#
The hosted cleanup run at 562edd352 passed PPCG’s eight GPU tests and LOBPCG’s 43 tests, then reported a single-precision Davidson-subspace exception. Subsequent GPU integration steps were skipped. The independent fix is PR #8454, commit 6cbad6bd6; this branch carries the same two-file numerical/test patch so the complete shared GPU selection can be checked together. The standalone PR also owns the common HSolver GPU workflow entry point.
The Davidson correction forms Hx and Sx before subtracting lambda*Sx, and uses their norms when estimating cancellation roundoff. It retains the requested band threshold as a cap. Its regression adds overlap scales 5 and 8 to the original scale-4 case. Local CUDA tests passed 30 repetitions (300 case executions), with CPU, non-MPI and two-rank MPI checks also passing. Those results used an RTX 3090 and CUDA 13.5; the original CUDA 12.9 CI environment requires hosted verification. The separate PR records diagnostic scales where rank breakdown remains, the additional norm reductions, and exact verification commands. This dependency does not change PPCG’s numerical algorithm or application acceptance thresholds.
Current unit-test coverage (2026-12-01)#
The CPU double-precision suite was consolidated at 1545457bd. Review then identified two numerical safeguards worth retaining in CI: cancellation during projection and eigenvalue-only correction of exact states. Both now have short standard/generalized regressions in the same source. The main file is 860 lines; PPCG test/support code totals 1,989 lines, compared with 4,024 before consolidation. Float, GPU and MPI retain their separate executables.
Test source | Lines | Responsibility |
|---|---|---|
| 860 | Analytical eigenpairs and selected numerical/status regressions |
| 307 | Single precision |
| 231 | Native CUDA operator and solver paths |
| 414 | MPI distribution, ranks with zero initial vector support, pools and trace ownership |
Each MPI rank owns a positive local row count. The competing-root test includes ranks whose initial vector block is zero; zero-row decompositions are not tested.
The CPU target runs 18 tests, including two kernel tests. A small parameter table checks complex standard/generalized matrices, repeated eigenvalues, padding and block sizes against an analytical spectrum, independent residuals and S-orthogonality. Selected regressions cover low-root recovery, Ritz intervals, iteration limits, invalid final residuals, workspace overflow, unequal band thresholds, trace opt-in/append behavior, direction-combination cancellation, projection cancellation, eigenvalue-only correction and refinement rollback.
The projection regression uses P = X + 1e-10 Z and checks cached HP and SP against fresh operator applications with relative error below 1e-12. The second regression perturbs one eigenvalue by four ULPs while keeping its vector exact; it requires successful correction, unchanged vectors and neighboring eigenvalue, and an independently evaluated residual below 1e-16. Disabling the projection refresh, disabling only the SP refresh, or disabling the eigenvalue fallback in external source copies makes the corresponding assertions fail. These mutation checks leave the production source unchanged.
Repeated analytical variants, exact operator-call counts and detailed internal rotation/rank-export probes remain archived locally. They are no longer mandatory CI tests. The original suite and SHA-256 manifest are at /mnt/data/Cheerly/ppcg-tests-compact-20261130/original/ and original-manifest.json; the old suite is also recoverable at bda7b032d. Historical test counts below describe their original commits.
The updated CPU target passed all 18/18 tests in fresh MPI-enabled and non-MPI builds. These runs cover the explicitly sequenced real/imaginary random samples in the shared matrix fixture. Runtime thresholds and application references are unchanged; the PPCG production edit only names the existing refinement margin’s intermediate values. Logs, commands and mutation checks are retained in /mnt/data/Cheerly/ppcg-review-20261201/.
cmake --build build-review-20261124 -j4 --target MODULE_HSOLVER_ppcg
cmake --build build-review-20261124-nompi -j4 --target MODULE_HSOLVER_ppcg
export OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1
ctest --test-dir build-review-20261124 -V -R '^MODULE_HSOLVER_ppcg$'
ctest --test-dir build-review-20261124-nompi -V -R '^MODULE_HSOLVER_ppcg$'
20-band Fe cancellation fix (2026-11-28)#
The previously failing 20-band Fe input now converges on CPU and native CUDA without PPCG residual warnings. Its scf_thr=1e-12, uniform band thresholds, 23-to-20 band-count change, physical settings, seed, and iteration limit of 200 are preserved. It is now covered by the normal Autotest lists as 825_PW_PPCG_USPP_Fe_20bands and scf_ppcg_uspp_fe_20bands; it is not a skipped, expected-failure, or diagnostic-only test. Existing observable tolerances and references are unchanged. The original 23-band strict Fe input is retained separately for manual diagnostics.
Failure mechanism and correction#
Temporary fresh-operator diagnostics located the first growing inconsistency in HP and SP, the cached images of the conjugate search direction P. A local update forms the next direction by combining W and the previous P. Nearly opposite contributions can leave a tiny direction while subtraction error remains in its cached images. Later normalization amplifies that error. The existing refresh safeguard checked cancellation during projection against X, so it missed cancellation that had already happened during the combination.
The update now compares each new direction’s squared norm with the sum of its individual contributions’ squared norms. If the result is less than half that sum, it recomputes only that direction’s H/S images. Pool reductions make the selection identical on all MPI ranks. Device vectors remain on the device; only the small norm arrays are reduced on the host. Neither the requested residual thresholds nor the final fresh-residual convergence check is relaxed.
A new standard/generalized matrix regression reproduces this failure without a particular Fe/LAPACK trajectory: the previous combination update leaves a relative H-image error of 2.73e-7, and a generalized S-image error of 3.05e-8, even after the existing projection safeguard. The fix passes the independent 1e-12 image-consistency checks. Operator-count tests include the new selective refreshes; the Ritz cadence and numerical assertions are retained.
Before the fix, the application exited with non-finite residuals on both backends (CPU SCF 20/k-point 9; CUDA SCF 19/k-point 5). The new CUDA trace at the latter location ends after 39 iterations at 2.72822e-13, below the requested 2.8649e-13, and the full SCF calculation converges in 22 steps.
Accuracy and regression references#
Matched two-rank calculations retain scf_thr=1e-12, nbands=20, diago_smooth_ethr=0, default initial diagonalization threshold, and identical physical inputs. Both PPCG and the independent CPU CG calculation converge:
PPCG backend vs CPU CG | Energy difference (eV) | Max force difference (eV/Å) | Max stress difference (kbar) |
|---|---|---|---|
CPU | 6.821e-12 | 0.000e+00 | 7.851e-04 |
CUDA | 5.912e-12 | 0.000e+00 | 7.851e-04 |
These are finite-SCF comparisons; forces vanish by symmetry. CG stops at density deviation 7.8463e-13, while PPCG reaches 5.9436e-14. The Autotest stress metric is the sum of absolute tensor components, not the maximum component difference in this table. Its CG/PPCG difference is 5.587e-3 kbar at these settings. Consequently, the new result.ref files are explicitly CPU PPCG regression snapshots, generated by the existing property collector from the fixed solver; they are not mislabeled as CG-derived accuracy references. CUDA shares that CPU snapshot, and uses the unchanged Autotest tolerances (1e-7 eV energy, 1e-4 force, 1e-3 kbar stress). Independent accuracy evidence is the CG comparison above, not agreement with these snapshots.
PPCG convergence probes at scf_thr=1e-14 and 1e-16 also completed without warnings on CPU. Attempts to obtain tighter CG references failed with psi_norm <= 0.0; Davidson-subspace probes did not converge and returned energies about 1.09 eV away. Those probes are retained as failures and excluded from the reference generation and accuracy table. No reference comes from a failed run.
Verification#
CPU and CUDA applications built successfully. At this update, the CPU PPCG suite contained 66 tests, including the new cancellation regression. Focused CPU CTest passed 5/5 entries (PPCG, float, PW dispatch, and MPI tests); CUDA PPCG passed its eight cases; the non-MPI PPCG target passed too.
Eight CPU fixtures with four ranks and eight CUDA fixtures with two ranks passed 88/88 observable checks, without residual warnings from any rank. This includes the new 20-band tests and the original strict 23-band Fe cases. CUDA application validation used residual tracing, as the workflow did then.
Separate unchanged-input probes passed 20-band Fe with two ranks and strict 23-band Fe with two/four ranks on both CPU and CUDA. The ordinary occupation-dependent 23-band case passed with four ranks on both backends.
Compute Sanitizer memcheck passed all eight CUDA unit cases with 0 errors and 0 leaked bytes. No performance speedup is claimed.
The focused build/CTest commands in the following section remain applicable. For Autotest, select cases 817/818/819/821/822/823/824/825 for CPU (-n 4) and all eight CUDA PPCG fixtures (-n 2). The normal case lists include 825 and the CUDA 20-band counterpart; the original strict 23-band cases remain in their separate stress lists. Both new READMEs contain two English lines.
CPU executable SHA-256: 5f650feb6f125fa1ab664c27181cab1fceee8bea292de71fe26c1df44726f4da. CUDA executable SHA-256: d6a437a9018ad3854bd9cad89f2de9626b3ea4610f27b52a4475e6a9e259b233. Raw failing diagnostics, the red/green unit logs, successful runs, failed reference probes, and new-reference provenance are retained under /mnt/data/Cheerly/ppcg-fe20-20261128/. Remote CI on the updated commit is required to verify the L20 runner; local GPU results above are from an RTX 3090.
Fe acceptance and precision stress (2026-11-27)#
The ordinary CPU/CUDA Fe regressions now use scf_thr=1e-12 and the existing diago_smooth_ethr=1 option. This is an explicit change to the test’s requested accuracy: occupied states retain the tight diagonalization threshold, while nearly empty states use the occupation-dependent thresholds already supported by HSolverPW. It does not change PPCG’s residual definition, threshold floor, iteration budget, or final fresh-operator convergence check. The 23-band basis, geometry, cutoffs, seed, reference files, and observable acceptance tolerances are unchanged. These are ground-state SCF checks, not empty-band spectroscopy.
The original scf_thr=1e-16, uniform-band-threshold inputs are preserved as 824_PW_PPCG_USPP_Fe_strict and scf_ppcg_uspp_fe_strict, selected by CASES_PPCG_STRESS.txt in their respective test directories, for manual precision diagnostics. The CUDA workflow used for the November 27 validation ran this stress separately, treated crashes and observable mismatches as failures, and retained residual warnings in its summary and convergence artifact. The ordinary CUDA step then rejected residual warnings. Current automated coverage is listed above. A residual warning records that the requested eigenpair convergence was not achieved.
Basis for the ordinary settings#
A two-rank CPU/CUDA convergence study kept the Fe basis and physical parameters fixed and varied only SCF convergence and the existing occupation-dependent threshold option. With uniform thresholds, CPU PPCG gave the following differences from its own scf_thr=1e-16 result, using source d821c24fa:
SCF threshold | Energy difference (eV) | Max stress difference (kbar) | Sum of absolute stress components (kbar) |
|---|---|---|---|
| 1.501e-09 | 3.758e-02 | 278554.891465 |
| 4.547e-13 | 1.725e-05 | 278554.778784 |
| 0.000e+00 | 2.428e-04 | 278554.779460 |
| 0.000e+00 | 0.000e+00 | 278554.778732 |
Forces vanish by symmetry in this one-atom fixture; this case alone cannot test nonzero-force accuracy. The occupation-dependent runs showed the same observable plateau. Convergence is not monotonic: the 1e-14 stress sum differs from the historical reference 278554.778382 by about 1.078e-3 kbar, slightly exceeding the existing 1e-3 tolerance. This result is retained, not omitted. The ordinary 1e-12 result differs by about 4.02e-4 kbar. No reference or comparison tolerance was adjusted. The convergence study and the CG comparison below support a routine ground-state check; they do not certify arbitrary tighter property accuracy or prove the strict residual target mathematically unattainable.
At scf_thr=1e-12, both CG and PPCG converge with diago_smooth_ethr=1 and default initial pw_diag_thr. Matched two-rank comparisons use identical inputs except for solver/device. CG probes at scf_thr=1e-14 and 1e-16, with either default or 1e-10 initial diagonalization threshold, fail with schmit_orth: psi_norm <= 0.0; those results are excluded from accuracy comparisons.
PPCG backend vs CPU CG | Energy difference (eV) | Max force difference (eV/Å) | Max stress difference (kbar) |
|---|---|---|---|
CPU | 4.547e-13 | 0.000e+00 | 4.738e-04 |
CUDA | 1.819e-12 | 0.000e+00 | 4.738e-04 |
These comparisons were rerun with the submitted per-band refinement fix. CPU executable SHA-256: cd660516169e5d2cba7bffb6281ecdd443b98a00af83ea10fa00d024ba4fd580; CUDA executable SHA-256: f247d441c25d6c002842f4fbae3ddb95573cff3b89653da76720f1d3c50004ba. The runs measure accuracy, not comparative performance.
Per-band refinement fix#
The new ordinary settings exposed a separate four-rank CPU issue: at SCF step 23, the first unconverged band was 3, but the largest absolute residual belonged to the retained suffix. Refinement eligibility compared that global residual with 4 * diag_thr, ignoring the looser thresholds of nearly empty bands. Already acceptable empty bands could therefore prevent refinement of a tightly tested occupied state. Eligibility now uses each band’s own requested threshold, just as locking does. The convergence test itself is unchanged.
The same four-rank input previously emitted one warning with maximum residual 2.70281e-10; after the fix it converges without residual warnings. The existing standard/generalized two-pair unit test now also covers unequal band thresholds and independently checks residuals, eigenvalues and S-orthogonality. That small unit example passed before the fix too; the four-rank Fe run is the demonstrated before/after regression.
Verification of this update#
The CPU build passed five focused CTest entries (including the 65-case PPCG suite, float/PW checks, and MPI coverage); the CUDA PPCG target and a separate non-MPI PPCG target also passed. The extended unit case checks both standard and generalized problems with uniform and unequal thresholds.
Seven CPU fixtures with four ranks and seven CUDA fixtures with two ranks passed all 80 observable checks, including both preserved strict Fe cases, with no PPCG residual warnings locally. The ordinary Fe case also passed the CPU/CG/CUDA comparison with four ranks. The GPU is an RTX 3090; these local results do not certify the L20 runner. Eight shell-policy probes checked the workflow in use at that time: ordinary residual warnings failed its CI step, stress residual warnings were annotated, and application or observable failures were fatal in both steps. YAML and shell syntax passed. These probes describe the historical workflow, whose PPCG-specific diagnostics have since been removed.
cmake --build build-review-20261124 -j8 --target abacus_pw_para \
MODULE_HSOLVER_ppcg MODULE_HSOLVER_ppcg_float MODULE_HSOLVER_pw \
MODULE_HSOLVER_ppcg_parallel
cmake --build build-ppcg-ci-repro-20261125 -j8 --target abacus_pw_gpu \
MODULE_HSOLVER_ppcg_gpu
cmake --build build-review-20261124-nompi -j6 --target MODULE_HSOLVER_ppcg
export OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1
ctest --test-dir build-review-20261124 --output-on-failure \
-R '^MODULE_HSOLVER_(ppcg|ppcg_float|pw|ppcg_parallel|ppcg_parallel_test)$'
ctest --test-dir build-ppcg-ci-repro-20261125 --output-on-failure \
-R '^MODULE_HSOLVER_ppcg_gpu$'
ctest --test-dir build-review-20261124-nompi --output-on-failure \
-R '^MODULE_HSOLVER_ppcg$'
For the native checks, select CPU cases 817/818/819/821/822/823/824 or the seven CUDA scf_ppcg_* cases, and use the Autotest command below with -n 4 for CPU and -n 2 for CUDA. Each case’s README remains two lines.
Remaining limits and reproduction#
The original exploration at nbands=20, scf_thr=1e-12, and uniform band thresholds exposed a non-finite PPCG failure on Fe. Initial blanket cache-refresh experiments caused regressions and were not included. The targeted combination cancellation fix and new mandatory regression cases are documented in the 2026-11-28 section above. The old failing runs remain excluded from accuracy tables; the original 23-band fixtures remain available alongside the new cases.
To reproduce the studies, copy CPU case 821, resolve pseudo_dir, retain its physical settings and seed, and vary scf_thr over 1e-10, 1e-12, 1e-14, 1e-16. Set diago_smooth_ethr to 0 or 1 explicitly. Run once with ks_solver cg and once with ks_solver ppcg; for CUDA PPCG also set device gpu and precision double. Use two MPI ranks and one OpenMP/BLAS thread as in the commands below. Repeat the ordinary settings with four MPI ranks. The failing band-count probe changes only nbands to 20 and diago_smooth_ethr to 0 at scf_thr=1e-12. To run the preserved strict fixture, use the Autotest command with -f CASES_PPCG_STRESS.txt from the CPU or CUDA test directory.
Raw inputs, executable hashes, logs and per-run JSON are under /mnt/data/Cheerly/ppcg-review-followup-20261127/: fe-convergence/, fe-smooth-accepted/, fe-mpi4-accepted/, fe-band20-accepted/, and acceptance-accepted-{cpu,gpu}/. Failed experimental implementations are kept separately and are not presented as validation of the submitted code.
Earlier CG accuracy comparison (2026-11-27)#
Following the review caution about BPCG on Fe, accuracy claims use CG rather than BPCG. The source tree is the upstream merge 3414f9717 (production code was built and tested before the merge commit was recorded). The Release CPU executable SHA-256 is d5ce7723dafc9fd6e3e685856eb802d0a744bb32d8e3411c056217fd7fc20a44.
The six systems listed below use the fixtures named in the CPU configuration section. Within each pair, CG and PPCG have identical geometry, pseudopotentials, cutoffs, k meshes, smearing, mixing, pw_seed=1, scf_thr_type=1, scf_thr=1e-10, initial pw_diag_thr=1e-10, scf_nmax=200, and pw_diag_nmax=200. Runs use two MPI ranks and one OpenMP/BLAS thread. All twelve calculations converged. These are finite-SCF differences, not exact error bounds; equal input thresholds do not imply identical eigensolver stopping criteria.
System | Energy difference (eV) | Max force difference (eV/Å) | Max stress difference (kbar) |
|---|---|---|---|
GaAs (NCPP) | 1.319e-10 | 5.300e-04 | 4.074e-03 |
Si (NCPP) | 9.456e-10 | 0.000e+00 | 5.141e-03 |
Al (NCPP) | 1.894e-10 | 0.000e+00 | 4.786e-02 |
Fe (USPP) | 1.218e-09 | 0.000e+00 | 2.870e-02 |
NaCl (USPP) | 1.473e-08 | 1.260e-04 | 3.397e-02 |
HCl (mixed NCPP/USPP) | 1.920e-10 | 2.868e-06 | 4.551e-02 |
The three USPP-containing pairs were repeated with only scf_thr=1e-12 changed. All six calculations converged:
System | Energy difference (eV) | Max force difference (eV/Å) | Max stress difference (kbar) |
|---|---|---|---|
Fe (USPP) | 2.833e-10 | 0.000e+00 | 9.328e-03 |
NaCl (USPP) | 4.875e-10 | 2.868e-06 | 4.629e-03 |
HCl (mixed NCPP/USPP) | 1.648e-12 | 4.960e-08 | 1.073e-03 |
These new runs validate accuracy only; they ran while unrelated compilation was active and are not used for performance claims. The controlled timing study below remains historical and shows no PPCG speed advantage on these small systems.
A separate CG probe at the unchanged strict fixture settings (scf_thr=1e-16, default initial pw_diag_thr, both iteration limits 200) failed on Fe, NaCl and HCl with schmit_orth: psi_norm <= 0.0, before producing final converged results. Those probes are excluded. Thus the valid CG comparisons above do not certify PPCG eigenpair convergence at 1e-14 residual or validate strict 1e-16 SCF snapshots to that accuracy. No fixture threshold, reference or iteration limit was changed to obtain these earlier comparison results. The subsequent Fe acceptance change is documented separately above.
To reproduce the two comparison batches, copy each listed fixture, resolve pseudo_dir, apply the common settings above and run the MPI command in Reproduction and checks, once with ks_solver cg and once with ks_solver ppcg. Repeat the three USPP-containing cases at scf_thr=1e-12. Raw inputs, logs, output hashes and JSON results are retained under /mnt/data/Cheerly/ppcg-review-followup-20261127/cg-validation/ and /mnt/data/Cheerly/ppcg-review-followup-20261127/cg-reference-probe/.
The post-merge builds and focused checks passed with:
cmake --build build-review-20261124 -j8 --target abacus_pw_para \
MODULE_HSOLVER_ppcg MODULE_HSOLVER_pw MODULE_HSOLVER_lobpcg \
MODULE_IO_ppcg_input MODULE_IO_read_item_serial
cmake --build build-ppcg-ci-repro-20261125 -j8 --target abacus_pw_gpu \
MODULE_HSOLVER_ppcg_gpu MODULE_HSOLVER_lobpcg_gpu
OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1 \
ctest --test-dir build-review-20261124 --output-on-failure \
-R '^MODULE_HSOLVER_(ppcg|pw|lobpcg)$|^MODULE_IO_(ppcg_input|read_item_serial)$'
OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1 \
ctest --test-dir build-ppcg-ci-repro-20261125 --output-on-failure \
-R '^MODULE_HSOLVER_(ppcg_gpu|lobpcg_gpu)$'
The twelve unchanged native CPU/CUDA fixtures also passed 72 reference checks without residual warnings locally, using the Autotest command below with the respective CPU or CUDA executable. This does not supersede the failed L20 result.
Historical CPU configuration (2026-11-24)#
Validated on 2026-11-24 with GNU 13.3 Release, OpenMPI, OpenMP, OpenBLAS, and an Intel Xeon Gold 6242. LCAO and CUDA were disabled. Production sources are from dd385365908b088333030b4623d72e3533b521a6; the accompanying test-data/documentation additions do not change the executable.
Each application ran with two MPI ranks, core binding, and OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1. Residual tracing was unset during comparisons. Executable SHA-256: c649f8a557e48527d0712f79c6dec8fe9260ffe0807dfbe356e6520bf4457dac.
The comparison uses fixtures 817_PW_PPCG, 818_PW_PPCG_Si, 819_PW_PPCG_Al, 003_PW_UPF100_USPP_Fe, 008_PW_UPF201_USPP_NaCl, and 009_PW_UPF201_USPP. Geometry, pseudopotentials, cutoffs, k meshes, smearing, and mixing settings are held fixed within each case. All solvers use pw_seed=1, scf_thr_type=1, scf_thr=1e-10, scf_nmax=200, and pw_diag_nmax=200. The initial pw_diag_thr is omitted, exercising its default of 0.01; PPCG uses the default ppcg_rr_step=1 and block size 4.
Default diagonalization threshold#
PPCG interprets the threshold as an absolute generalized residual norm, whereas the comparison solvers use different stopping rules. Equal parameter values therefore do not imply equal error or work. SCF automatically tightens the diagonalization threshold after the initial electronic iteration.
The following differences compare default-threshold PPCG against CG with initial pw_diag_thr=1e-10, at the same SCF settings. CG and PPCG converged in every case. Values are maximum absolute differences in total energy, a force component, and a stress component over the three measured PPCG runs. These are finite-SCF comparisons, not certified exact errors.
System | Energy (eV) | Force (eV/Å) | Stress (kbar) |
|---|---|---|---|
GaAs (NCPP) | 1.073e-10 | 5.301e-04 | 4.067e-03 |
Si (NCPP) | 9.464e-10 | 0.000e+00 | 5.026e-03 |
Al (NCPP) | 1.805e-10 | 0.000e+00 | 4.786e-02 |
Fe (USPP) | 1.219e-09 | 0.000e+00 | 2.871e-02 |
NaCl (USPP) | 1.473e-08 | 1.132e-04 | 3.385e-02 |
HCl (mixed NCPP/USPP) | 7.080e-10 | 2.715e-06 | 2.262e-02 |
To isolate the initial PPCG tolerance, the same calculations were repeated changing only pw_diag_thr from its default to 1e-10:
System | Energy change (eV) | Force change (eV/Å) | Stress change (kbar) |
|---|---|---|---|
GaAs (NCPP) | 2.547e-11 | 4.102e-07 | 8.075e-06 |
Si (NCPP) | 5.969e-13 | 0.000e+00 | 1.143e-04 |
Al (NCPP) | 8.868e-12 | 0.000e+00 | 1.739e-06 |
Fe (USPP) | 0.000e+00 | 0.000e+00 | 0.000e+00 |
NaCl (USPP) | 1.228e-11 | 1.677e-05 | 2.650e-04 |
HCl (mixed NCPP/USPP) | 5.156e-10 | 1.533e-07 | 2.290e-02 |
All 24 PPCG runs in the controlled default-threshold batch, including warm-ups, and all six tighter-initial-threshold runs converged without PPCG nonconvergence warnings. These results support the conservative residual interpretation on the tested systems. Force and stress accuracy also depends on SCF convergence; tightening only the initial eigensolver threshold does not remove that error. System-specific convergence checks remain necessary for more demanding property tolerances.
Efficiency#
Runs were sequential: one warm-up followed by three measured runs for every case/solver, rotating the order of CG, Davidson, Davidson-subspace, and PPCG. The complete batch contains 96 launches (72 measured). Each cell gives median wall time / median HSolverPW::solve_psik time, in seconds. The wall timer surrounds the MPI subprocess.
System | CG | Davidson | Davidson-subspace | PPCG |
|---|---|---|---|---|
GaAs (NCPP) | 1.969 / 0.690 | 1.719 / 0.510 | 1.719 / 0.500 | 5.331 / 4.140 |
Si (NCPP) | 1.519 / 0.470 | 1.319 / 0.310 | 1.318 / 0.290 | 2.572 / 1.570 |
Al (NCPP) | 1.569 / 0.680 | 1.218 / 0.370 | 1.118 / 0.290 | 2.171 / 1.370 |
Fe (USPP) | 1.518 / 0.630 | failed | mismatch¹ | 1.719 / 0.830 |
NaCl (USPP) | 1.368 / 0.060 | failed | 3.173 / 0.300 | 1.469 / 0.200 |
HCl (mixed NCPP/USPP) | 1.218 / 0.270 | 1.218 / 0.280 | 1.168 / 0.240 | 1.870 / 0.940 |
¹ Davidson-subspace reported SCF convergence for Fe but its energy differed from the tightened CG result by about 0.881 eV. That result is excluded from valid efficiency/accuracy comparisons. Ordinary Davidson exited on Fe and NaCl with a linearly dependent initial-basis diagnostic (all three measured attempts for each case). The failed runs are not included in timings. No changes to those solvers are included here.
PPCG wall-time ranges for GaAs, Si, Al, Fe, NaCl, and HCl were respectively 5.329–5.681, 2.572–2.672, 2.170–2.171, 1.718–1.770, 1.418–1.469, 1.868–1.920 seconds. PPCG is slower than CG on these small systems. No general speedup, large-system scaling, or GPU performance claim is made.
Refinement performance follow-up#
Near convergence, each refinement attempt changes one retained pair, while its correction and candidate H/S applications process all retained columns. The final refinement window can repeat this work for each band. A single-column version is an optimization opportunity identified in review; it has not been implemented or benchmarked. It must retain projection against the complete basis, consistent cached H/S images, ordered eigenvalues, rollback and final residual checks on CPU, CUDA and MPI. The timing results above do not measure that proposed change.
Provenance of the strict USPP regression snapshots#
Autotest cases 821_PW_PPCG_USPP_Fe, 822_PW_PPCG_USPP_NaCl, and 823_PW_PPCG_USPP_HCl retain the structures/pseudopotentials/k meshes of cases 003, 008, and 009. Their existing reference files were originally generated with BPCG at scf_thr=1e-16, scf_nmax=200, and pw_diag_nmax=200. The corresponding CUDA fixtures share those snapshots.
These files remain historical regression snapshots, not an accuracy benchmark. The previous PPCG–BPCG comparison table has been removed in response to the review caution about BPCG on Fe. Accuracy comparisons use the converged CG runs above. The failed strict CG probes cannot justify replacing the snapshots, so reference values and observable acceptance tolerances remain unchanged. The original Fe settings are preserved in the separate manual precision-stress fixtures described above. Observable agreement and individual eigenpair residuals are reported separately in the numerical histories below.
Reproduction and checks#
Build and unit checks:
cmake -S . -B build-review-20261124 -DCMAKE_BUILD_TYPE=Release \
-DENABLE_MPI=ON -DENABLE_OPENMP=ON -DENABLE_LCAO=OFF -DBUILD_TESTING=ON
cmake --build build-review-20261124 -j8 --target abacus_pw_para \
MODULE_HSOLVER_ppcg MODULE_HSOLVER_ppcg_float MODULE_HSOLVER_pw \
MODULE_HSOLVER_ppcg_parallel MODULE_IO_ppcg_input
OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1 \
ctest --test-dir build-review-20261124 -V \
-R '^(MODULE_HSOLVER_(pw|ppcg|ppcg_float|ppcg_parallel|ppcg_parallel_test)|MODULE_IO_ppcg_input)$'
MPI CTest passed 6/6: 54 double-precision, four float, eight PW, and five INPUT cases, plus MPI runs with 2/3/6 ranks and two pools. A separate ENABLE_MPI=OFF build passed its three PPCG/float/INPUT CTest entries. INPUT checks in the CPU-only build cover NSCF/GPU rejection and RR interval validation. CLI --check-input, help and version checks passed for the supported inputs; NSCF was rejected during both checking and actual startup.
For each timing calculation, make a fresh copy of a listed fixture, apply the common overrides above, set only ks_solver differently within each group, resolve pseudo_dir, and run:
OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1 \
mpirun --bind-to core --map-by core -np 2 /absolute/path/to/abacus_pw_para
For native regression checks, select cases 817/818/819/821/822/823 in a temporary case list and run from tests/01_PW:
OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1 \
ABACUS_MPIEXEC_PREFLAGS='--bind-to core --map-by core' \
bash ../integrate/Autotest.sh -a /absolute/path/to/abacus_pw_para \
-n 2 -o 1 -j 1 -f /absolute/path/to/selected_cases.txt
The six native cases passed 36/36 checks with two ranks; the three new USPP cases also passed 15/15 checks with four ranks. A separate traced GaAs run preserved all 16 solves across eight SCF iterations and two k points, with initial and final records for each solve. A Si run with ppcg_rr_step=4 converged and produced block-sweep records, while interval 0 was rejected.
Local raw logs, INPUT hashes, timing samples, failed probes, and JSON summaries are archived under /mnt/data/Cheerly/ppcg-review-20261124/. The tables above identify the usable data and do not mix failed probes into successful timing or accuracy samples.
Native CUDA validation#
The native CUDA implementation in 99950ee5a was validated on 2026-11-24 with an NVIDIA GeForce RTX 3090 (24 GB), GNU 13.3, CUDA 13.5, OpenMPI and OpenBLAS. The Release build enabled MPI/OpenMP/testing and disabled LCAO. Runtime checks used OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1.
Wavefunctions, residuals, search directions and H/S images remain in device memory. CUDA kernels compute residuals, preconditioning, column products and scaling; device BLAS performs Gram products and rotations. Only projected matrices, their coefficients and per-band convergence data cross to the host for LAPACK and the existing MPI reduction wrappers. The preconditioner is uploaded once per diagonalization. There is no full-wavefunction CPU callback bridge. ROCm is not implemented.
The CUDA CTest target passed all six cases: standard/generalized complex double, infrequent RR with a locked prefix, standard/generalized complex float, and iteration-budget exhaustion. The generalized fixture has a known spectrum, complex dense Hamiltonian and nonuniform overlap. Checks independently evaluate eigenvalues, residuals, S-orthogonality and leading-dimension padding. Every H/S callback verifies that both operand pointers are device allocations. Compute Sanitizer reported 0 errors and 0 leaked bytes across all six cases.
Application regression#
The six tests/11_PW_GPU/scf_ppcg_* Autotest fixtures use the CPU fixtures’ geometry, pseudopotentials, references and acceptance tolerances. Only device selection and explicit double precision differ. All six SCF calculations converged and 36/36 checks passed with two MPI ranks. The current GPU PW setup assigns one k-point pool per rank; this is k-point parallelism, not a distributed plane-wave-row GPU test.
Fixture | SCF iterations | Final density deviation | PPCG iteration-limit warnings | Largest warning residual |
|---|---|---|---|---|
GaAs | 8 | 6.06555e-7 | 0 | — |
Si | 7 | 1.44325e-7 | 0 | — |
Al | 14 | 7.91835e-11 | 0 | — |
Fe (USPP) | 26 | 6.09993e-17 | 9 | 1.63674e-14 |
NaCl (USPP) | 35 | 4.70540e-17 | 0 | — |
HCl (mixed NCPP/USPP) | 20 | 3.08266e-17 | 24 | 2.21592e-14 |
Warning counts above include stderr from both MPI ranks, rather than only the world-root running log.
In the CUDA CI run of 11e39d8f3 on an NVIDIA L20 with CUDA 12.9, all six fixtures also passed their reference-observable checks. Fe emitted 12 iteration-limit warnings with a maximum residual of 4.81339e-9; HCl emitted 24 with a maximum of 2.15364e-14. These individual diagonalization calls did not satisfy their requested thresholds. Observable agreement does not certify those eigenpairs, and the larger Fe warnings are not classified as roundoff-level convergence. The local RTX 3090 table and these CI observations are reported separately.
Those historical strict USPP runs retained eigensolver warnings; passing observable checks did not certify those eigenpairs. The residual threshold was not established to be unattainable. An initial batch exceeded the local harness’s 300-second aggregate limit. A fresh complete batch passed with a 900-second harness limit; numerical thresholds, iteration budgets and references were unchanged.
A separate GaAs calculation with ppcg_rr_step=4, two ranks and two k-point pools converged without PPCG warnings. The world-root trace preserved all eight of its solves across eight SCF iterations, including initial/final records and block sweeps. Other pools intentionally do not write that shared trace. GPU CLI help/version and valid --check-input checks passed; RR interval 0 and NSCF were rejected, with NSCF also rejected during actual startup. A four-rank probe was rejected by the existing k-point setup because this fixture has only two k points; the successful probe uses two ranks.
After the device-workspace refactor, the CPU focused MPI CTest suite passed 6/6 and the six CPU application regressions passed 36/36 again. These are correctness regressions; the earlier CPU timing table was not remeasured.
Strict-residual refinement (2026-11-26)#
When a successful Ritz solve stalls within four stopping tolerances, PPCG now cycles through retained pairs after five non-improving iterations. This also reduces errors in already converged neighbors that can constrain the remaining pair. The correction is projected against the retained states and the candidate is S-normalized. It is accepted only if a fresh H/S application confirms a smaller residual, without a resolved energy increase or reordering. A rejected candidate is restored. Within the final refinement window, one outer iteration performs a bounded sweep: the worst pair first, then at most one visit to each retained band, stopping early if all pairs converge. Each attempted single-band correction contributes 1 / nbands to the reported average iteration count. An unsuccessful sweep returns to block iteration. The outer iteration limit, convergence criterion and final fresh-residual check are unchanged. The residual_refinement trace stage records these sweeps.
The subsequent L20/CUDA 12.9 CI run at c865d82e6 passed all reference checks but retained one Fe warning: 1.43748e-14 at SCF step 23, k-point 1. Its trace entered the near-converged range at iteration 195, leaving too few steps for the five-iteration stagnation trigger. The follow-up starts the final refinement window using the retained-band count plus the stagnation allowance, to allow refinement before the budget expires. It prioritizes the worst unconverged pair within the unchanged total budget. If that correction is rejected, other retained states are visited instead of retrying identical inputs. A failed full cycle returns to the normal block iteration. Startup correction for the lowest roots remains mandatory. Short-budget regressions check prompt refinement and a fresh final residual; they fail with the previous triggers. Additional tests verify rollback after nonfinite candidate and normalized-candidate H applications. The CUDA workflow at that stage rejected residual warnings in combined output from all MPI ranks and preserved that output as an artifact. Those diagnostics are now manual checks, as summarized under current coverage above.
L20 runs through 7481a34d1 still reported one strict Fe failure (last residual 1.90363e-14 versus 1e-14). A focused test subsequently reproduced a separate edge case: an exact state with a few ulps of eigenvalue error has a residual parallel to Sx, which disappears from the projected vector correction. Refinement now falls back to an eigenvalue-only correction when the vector update fails, bounded by the existing roundoff margin. It leaves the state unchanged and accepts only a smaller actual residual without reordering. The focused test failed before this change and passes after it. The L20 run at 8b50e767c still had the same Fe failure. After a rejected worst-pair correction, retrying that pair between successful neighbor updates spent two iterations per neighbor and could not finish the retained-state sweep. The uninterrupted neighbor sweep at cd6465d08 reduced the number of failed bands from ten to one, but still left a residual of 1.90363e-14: visiting all 23 retained bands consumed the remaining outer iterations. The updated sweep visits the retained set within one outer iteration, leaving time to resume block work. This can perform more single-band corrections per outer iteration than the previous implementation; every attempt is included in the average iteration count. A two-band standard/generalized regression requires both near-converged pairs to satisfy an independent residual check within one block sweep. It fails before this change and passes afterward. The subsequent L20 run at c527d243e still failed on one Fe band at SCF 23, k-point 1: 1.08395e-14 against 1e-14. All observable checks passed, but the residual gate correctly failed. This numerical issue remains open.
The six original CPU fixtures and six original RTX 3090 CUDA fixtures passed 72/72 reference checks with zero PPCG nonconvergence warnings across both MPI ranks, including Fe and HCl on both backends. Their inputs, references and tolerances were unchanged; Fe retained scf_thr=1e-16 and pw_diag_nmax=200.
Both Fe calculations converged in 26 SCF steps, with total energy approximately -2739.33531173184 eV and final density deviation approximately 6.10e-17. Its energy, force and stress checks passed against the existing independent reference. These local results do not by themselves reproduce or certify the older L20 residual rebound described above; the updated branch requires fresh CI evidence.
The CPU suite passed 65 tests in MPI and non-MPI builds. The added tests cover standard/generalized correction geometry, refinement of a converged neighbor, preservation of converged pairs, rejection of nonfinite directions and candidates, restoration after rejected updates, eigenvalue-only roundoff on exact standard/generalized states, and exact float/double cancellation remainders. The CUDA target passed eight cases, including the two cancellation checks. Both residual kernels now use fused multiply-add: separate product rounding could otherwise turn a nonzero residual into zero. The MPI regression driver also passed its multi-rank configurations. The correction uses the existing device workspaces, vector kernels and H/S interface; no extended-precision solver or host wavefunction bridge was added. Local logs and executable hashes are retained in /mnt/data/Cheerly/ppcg-fe-stability-20261126/ and /mnt/data/Cheerly/ppcg-fe-ci-followup-20261126/.
Transfer audit and reproduction#
Nsight Systems traced DiagoPPCGGPU.GeneralizedComplexDouble (24 active rows, leading dimension 31, five bands). Its full wavefunction occupies 2,480 bytes. Exactly one upload initializes the fixture and one download checks its final result. Between those transfers, the solver made 680 host-to-device transfers (128,480 bytes total) and 896 device-to-host transfers (181,352 bytes total), with a maximum of 800 bytes per transfer. No complete wavefunction was transferred to or from the host during the solve. Device-to-device copies are excluded from these host-transfer counts.
The GPU was shared with another workload, so these checks do not establish speedup. Small projected solves, synchronization and allocations still have overhead; no GPU performance advantage is claimed.
cmake -S . -B build-ppcg-gpu-20261124 -DCMAKE_BUILD_TYPE=Release \
-DENABLE_MPI=ON -DENABLE_OPENMP=ON -DENABLE_LCAO=OFF \
-DBUILD_TESTING=ON -DUSE_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=86 \
-DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc \
-DCMAKE_CXX_FLAGS=-I/usr/local/cuda/include/cccl \
-DCMAKE_CUDA_FLAGS=-I/usr/local/cuda/include/cccl
cmake --build build-ppcg-gpu-20261124 -j8 \
--target abacus_pw_gpu MODULE_HSOLVER_ppcg_gpu
export OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1
ctest --test-dir build-ppcg-gpu-20261124 -V -R '^MODULE_HSOLVER_ppcg_gpu$'
The extra CCCL include flags apply to this local CUDA 13.5 installation; they are not a repository-wide toolchain change. Run Compute Sanitizer with --tool memcheck --leak-check full --error-exitcode 1 on the GPU test executable. Profile it with nsys profile --trace=cuda --sample=none --cpuctxsw=none, selecting --gtest_filter=DiagoPPCGGPU.GeneralizedComplexDouble, and export the report to SQLite to inspect CUPTI_ACTIVITY_KIND_MEMCPY.
For application checks, create a temporary case list containing the six scf_ppcg_* fixtures and run from tests/11_PW_GPU:
ABACUS_MPIEXEC_PREFLAGS='--bind-to core --map-by core' \
bash ../integrate/Autotest.sh -a /absolute/path/to/abacus_pw_gpu \
-n 2 -o 1 -j 1 -f /absolute/path/to/selected_gpu_cases.txt
When native CUDA support was introduced, the workflow explicitly ran the PPCG GPU unit target and included all six application fixtures then added to 11_PW_GPU. Current coverage uses the common HSolver GPU selection and seven ordinary PPCG fixtures, as listed above. Local logs, the transfer audit, executable hashes and the failed-probe diagnostics are archived in /mnt/data/Cheerly/ppcg-review-20261124/gpu-port/.
Formatting follow-up#
On 2026-11-25, a formatting-only cleanup applied the repository’s configured tools to new files and modified regions. All 16 new C++/CUDA source/header files passed clang-format 23.1.3 --dry-run --Werror. The MPI shell helper uses the exact shfmt output from CI and passes bash -n. CPU and CUDA applications were rebuilt; focused CPU MPI CTest passed 6/6, non-MPI CTest passed 3/3, and the GPU target passed all six cases again. Numerical settings, references and iteration budgets were unchanged.
The repository-wide pre-commit job is advisory (continue-on-error: true). Its raw clang-format, cmake-format and shfmt hooks failed even though GitHub displayed a successful job. The log included formatting changes in 2,475 files outside this PR and unsupported JSON-language configuration errors. A green job result therefore does not certify repository-wide formatting; the focused checks above describe this PR’s validation. Existing files were formatted only in the modified regions to avoid an unrelated repository-wide rewrite.
A subsequent raw CI formatter audit of 71e6ab31a changed no newly added PR file. Repository-wide formatter failures remained in existing files; the non-blocking workflow status is still not a full formatting pass.
A subsequent independent cmake-format CI job checks only PR-touched CMake files and is blocking. Its three reported files were formatted with the configured tool; all six PR-touched CMake files now pass the local check. CMake regeneration and the PPCG INPUT CTest also passed. This focused fix does not change the numerical implementation or expand into repository-wide cleanup.