Repository navigation
feat(pw): expose the serial basis assembly as PW_Basis::init_serial - #8268
Zanthoxylum wants to merge 4 commits into
Conversation
The plain serial assembly chain (initgrids -> initparameters -> default FFT mode -> setuptransform -> collect_local_pw) was duplicated in every serial test scaffolding because the production wrappers setup_pwrho / setup_pwwfc bundle it with global parallel state (GlobalV::NPROC_IN_ POOL / RANK_IN_POOL / ofs_running), the full Input_para, K_Vectors and GPU branches -- unreachable from a serial unit test. Expose the chain as public PW_Basis::init_serial and PW_Basis_K::init_serial (FFT-box + k-list variant) so heavily-used test setup references the source API instead of mirroring it; the DFPT serial fixture's SetupBases shrinks to the two init_serial calls plus its (k, q) data wiring. The parallel production path is untouched. All DFPT serial test binaries rebuilt from deleted binaries; full MODULE_DFPT ctest 10/10 (the local 11_PW_GPU integration failure is a pre-existing no-CUDA environment issue, identical on the unmodified baseline).
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
The migrated fixture preserves its original basis initialization sequence. One API-contract clarification is below. Static review at 292c3d0; the reported build and runtime results were not independently verified.
…ction test tool
The DFPTSerialBase base class and its header are removed in favor of
dfpt_test_tool.{h,cpp} (the module_pw test/test_tool pattern): shared
declarations plus one implementation TU of free functions -- setup_cell,
make_coulomb_atom, make_nc_atom, make_two_atom_cell, make_nlcc_two_atom_
cell, setup_bases, vloc_coulomb, analytic_dvloc, fkey, gkey -- and the
shared test-world constants (lat0 / ecutwfc / rho_mult / cubic_edge).
Every test file now derives its own fixture directly from ::testing::Test,
owns its objects as members and calls the utilities it needs; there is no
shared fixture base class and no fixture header. The rho files keep their
file-local RNG. CMakeLists swaps dfpt_serial_fixture.cpp for
dfpt_test_tool.cpp in every target. setup_bases keeps the raw assembly
chains and adopts PW_Basis::init_serial once deepmodeling#8268 lands. All six serial
targets rebuilt from deleted binaries (make rc=0); case counts conserved
(pert 7 / phon 20 / rho 11 / q0 6 / xc 6 / write_dyn 6); full MODULE_DFPT
ctest 10/10.
Per review: the no-initmpi use advertised by init_serial requires the PW sources compiled without __MPI -- with __MPI the initgrids overloads reduce over the object communicator, which is MPI_COMM_NULL on a fresh basis. Both init_serial declarations now state this; the DFPT fixture works because its test targets compile the PW sources with __MPI disabled.
|
Closing this PR: the production setup wrappers (setup_pwrho / For the record, the DFPT test tool keeps its own five-call assembly Nothing on the test side depends on this PR; closing without merge. |
…ction test tool (#8270) * refactor(dfpt): replace the shared fixture base class with a free-function test tool The DFPTSerialBase base class and its header are removed in favor of dfpt_test_tool.{h,cpp} (the module_pw test/test_tool pattern): shared declarations plus one implementation TU of free functions -- setup_cell, make_coulomb_atom, make_nc_atom, make_two_atom_cell, make_nlcc_two_atom_ cell, setup_bases, vloc_coulomb, analytic_dvloc, fkey, gkey -- and the shared test-world constants (lat0 / ecutwfc / rho_mult / cubic_edge). Every test file now derives its own fixture directly from ::testing::Test, owns its objects as members and calls the utilities it needs; there is no shared fixture base class and no fixture header. The rho files keep their file-local RNG. CMakeLists swaps dfpt_serial_fixture.cpp for dfpt_test_tool.cpp in every target. setup_bases keeps the raw assembly chains and adopts PW_Basis::init_serial once #8268 lands. All six serial targets rebuilt from deleted binaries (make rc=0); case counts conserved (pert 7 / phon 20 / rho 11 / q0 6 / xc 6 / write_dyn 6); full MODULE_DFPT ctest 10/10. * fix(dfpt): forward-declare Matrix3 in the tool header; drop duplicate test includes Per review: dfpt_test_tool.h uses Matrix3 and Vector3 only by reference, so they are forward-declared like the other argument types and their definitions are included only where needed (the tool implementation and the fixtures that use them). The include blocks duplicated by the fixture rewrite (the original std/gtest includes surviving below the inserted fixture) are removed -- 28 duplicate lines across ten files, first occurrence kept everywhere. All six serial targets rebuilt from deleted binaries (make rc=0); case counts conserved; full MODULE_DFPT ctest 10/10. * ci: retrigger checks The 'Build with Makefile & Intel compilers' run hit runner disk exhaustion during the container image pull (no space left on device writing libmkl_sycl_blas.so.5, retried 3x) -- an infrastructure failure on that runner; all code-targeting checks are green or in progress. * ci: retrigger checks (Intel container pull hit runner disk exhaustion again) * fix(dfpt): drop the duplicated QList / DFPT_PW_Data forward declarations Per review: the Matrix3 forward-declaration edit left a second copy of the ModuleCell::QList and ModuleDFPT::DFPT_PW_Data blocks in the tool header; one pair removed. Two consuming targets rebuilt from deleted binaries; full MODULE_DFPT ctest 10/10. * docs(dfpt): record why the test tool keeps its own assembly chains The deferred-adoption note pointed at a serial assembly API proposal that is being withdrawn: the production pw::setup_pwrho / setup_pwwfc wrappers already run without __MPI, and the tests keep their own five-call chains because they need rho_mult = 9x ecutwfc (production hardcodes 4x), re-assemble for arbitrary (k, q) pairs per case (the K_Vectors-driven wrapper is not shaped for that), and want to avoid the wrappers' GlobalV::ofs_running read and a fabricated Input_para. Comment-only change; MODULE_DFPT_rho_serial rebuilt from a deleted binary; full ctest 10/10. * docs(dfpt): avoid the global-variable name in the rationale comment The governance checker counts global-class names even in comments; rephrase to 'the running-log global stream'. * ci: retrigger checks (abacuslite SCF failure is unrelated to this test-only PR)
Summary
The plain serial basis assembly chain
was mirrored by every serial test scaffolding, because the production
wrappers
setup_pwrho/setup_pwwfcbundle it with global parallelstate (
GlobalV::NPROC_IN_POOL/RANK_IN_POOL,GlobalV::ofs_runninglogging), the full
Input_para,K_Vectors, and GPU/double-gridbranches — unreachable from a serial unit test. This PR exposes the
chain as a public source API so heavily-used test setup references the
source instead of duplicating it:
PW_Basis::init_serial(lat0, latvec, gridecut)(pw_basis.h /pw_init.cpp): the five-call sequence above, no parallel/device
context, default distribution.
PW_Basis_K::init_serial(lat0, latvec, nx, ny, nz, ecut, nk, kvec_d)(pw_basis_k.h / .cpp): the FFT-box + k-list variant, for a wfc basis
sharing the rho grid's box.
SetupBases— the single most-shared testhelper (every serial DFPT test file reaches it) — shrinks to the two
init_serialcalls plus its (k, q) data wiring.The parallel production path (
setup_pwrho/setup_pwwfc) isuntouched: it interleaves
initmpiand device/precision branchesbetween the same calls, so unifying it onto
init_serialis a separatedecision; this PR only removes the test-side mirror.
Scope and dependency on #8259
dfpt_serial_fixture.cpp'sSetupBasesis the single most-sharedtest helper (every serial DFPT test file reaches it) and the only
test-side file this PR touches. refactor(dfpt): split the oversized DFPT serial tests along the source boundaries #8259 rewrites the test
.cppfiles and their
CMakeLists.txtbut does not modify the fixture, sothe two PRs have zero file overlap and no merge-order constraint.
xc
make_basishelper and the rho/q0 local basis rebuilds) aredeliberately not converted here: those files are being rewritten
by refactor(dfpt): split the oversized DFPT serial tests along the source boundaries #8259, and touching them in parallel would produce avoidable
conflicts. They adopt
init_serialin a small follow-up once refactor(dfpt): split the oversized DFPT serial tests along the source boundaries #8259lands (whichever PR merges second simply rebases that adoption).
Verification
exit code 0 per target); full
MODULE_DFPTsuite 10/10 — thefixture output is byte-identical by construction (the chain is the
same five calls).
11_PW_GPUintegration failure is a pre-existing no-CUDAenvironment issue: verified identical on the unmodified baseline
(stash + rebuild + rerun).
Documentation
No docs change needed: additive internal API, no INPUT or user-facing
behavior change.