Repository navigation
refactor(lcao): decouple basis indexing from block-cyclic layouts - #8295
Conversation
Purely additive: no call site changes, inheritance still in place. para_2d() (const + non-const) returns *this while Parallel_Orbitals derives from Parallel_2D, giving the two escape hatches a const getter cannot serve (LR_Util::setup_2d_division mutation, test-side descriptor writes). get_blacs_ctxt() completes the inherited getter family, which covers the other seven public data members.
…rate module_rt call sites
…igrate module_dftu call sites
…rate module_dm call sites
…ate pyabacus call sites
…rate module_lr call sites
…rate misc_prod call sites
…bitals, migrate module_operator_lcao call sites
…rate test_side call sites
…, migrate module_current call sites
…rate module_ao call sites
…it para_2d() access
…is_serial() accessor
…s (zero production delta vs D4)
…r only, zero production delta)
… (getter-equiv, derived-layer sync, value-semantics static_assert, MPI+serial dual coverage)
…arallel_2D to using alias, full-repo getter-ization - new class BlockCyclicDistributionInformation owns all Parallel_2D responsibilities: data members (snake_case + trailing underscore), initialize/set/set_serial/set_coord, move semantics, getter family, global_to_local_*, owner_*, owns_index - Parallel_2D demoted to 'using Parallel_2D = BlockCyclicDistributionInformation;' (removal in S5) with DEPRECATED-ALIAS/DELETION-COMMIT markers - all legacy Parallel_2D direct field accesses replaced by getters (A0 burn-down = 0) - dual build (MPI+serial) zero error; parallel_orbitals + composition tests green; D0 four-case byte-compare ok=36 diff=0
…Information - Parallel_Orbitals member Parallel_2D para_2d_ -> BlockCyclicDistributionInformation para_2d_ - para_2d() accessor return types updated to BlockCyclicDistributionInformation& / const& - composition test binds para_2d() to const BlockCyclicDistributionInformation& - Parallel_2D alias untouched (deletion in S5); setup_2d_division signature unchanged - dual build zero error; MPI ctest 7/7, serial ctest 3/3; D0 four cases byte-identical (ok=36 diff=0) - all content from codex S2 run
…y.h stays MPI-free)
… / gtest / legacy make / pyabacus) - zero changes needed
…ll references to BlockCyclicDistributionInformation
- delete parallel_2d.{h,cpp} (alias header + empty TU) and parallel_2d_test.{cpp,sh}
- rewrite ~127 files: Parallel_2D whole-word refs -> BlockCyclicDistributionInformation, drop parallel_2d.h includes
- burn-down == 0: git grep Parallel_2D / parallel_2d.h / build entries all zero
- build verification performed by computer-agent (serial+MPI zero-error, related tests green, D0 4-case byte-diff clean)
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
The new governance regression expects an unimplemented checker rule and needs to be aligned with the checker. The other inline notes are non-blocking cleanup.
Static review at 1fd814e: git diff --check and the governance checker completed successfully (warnings only). Builds, numerical/runtime tests and CI diagnostics were not run.
|
@ABACUS-PR-BOT All problems have been solved, could you review again? |
AsTonyshment
left a comment
There was a problem hiding this comment.
LGTM overall!
Just a heads-up: our current guidance on forward declarations is a bit contradictory. The ABACUS C++ guide recommends avoiding them, while agent_governance_check.py and even the review bot recommend the opposite.
This is also a debated topic in software engineering, with major projects taking different approaches. For example, Google generally discourages forward declarations, while LLVM encourages minimizing header inclusions and using forward declarations where appropriate. It's essentially a trade-off between maintainability (e.g., explicit dependencies and avoiding fragile declarations) and compile-time efficiency (e.g., reduced header coupling and unnecessary recompilation).
We're planning to put together an updated version of the ABACUS development guidelines to clear up inconsistencies like this. No need to change anything here over this, though :) I'm just pointing it out, and we can leave the discussion of whether forward declarations are preferable for another time.
|
@AsTonyshment Thanks for your review.
As for the compile time management, I am not sure about the preference of other developers, so I cannot give a clear suggestion. C++ provides many language features allowing developers coding in many different ways, but maintainers should be cautious on this feature before the code is "dry" or atomic enough. Cheers, |
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
Both verification filters omit the renamed layout tests; the inline note identifies the update.
Static incremental review at adbb919: full and incremental git diff --check passed. Builds, runtime tests, numerical probes and CI diagnostics were not run; the reported test counts remain author-reported.
|
@AsTonyshment update: to enhance the readability of the forward declaration I have to make at the intermediate stage of the big refactor, I append the inline comments to point to the place where the classes are really declared. In the next PR, the number of forward declaration used will be decreased significantly because of the introduction of Matrix2d container. |
…ayout-v2 # Conflicts: # source/source_hamilt/module_hcontainer/hcontainer.cpp
…ayout-v2 # Conflicts: # source/source_lcao/module_rt/test/test_boundary_fix.cpp # source/source_md/unittests/CMakeLists.txt # source/source_md/unittests/test_md_base.cpp
|
Conflict resolution is pushed at |
ABACUS-PR-BOT
left a comment
There was a problem hiding this comment.
The incremental source changes introduce no new implementation defect identified by static review; the inline note preserves a removed lifecycle regression case.
Reviewed d7789c6cf against a2beda0ea, including contributor changes and merge resolution. Full and incremental git diff --check passed. Builds, product tests, numerical/MPI/GPU checks and CI diagnostics were not run; author-reported results were not independently verified.
Resolve conflicts with the Parallel_Blkcyclic refactor (deepmodeling#8291, deepmodeling#8295) and the new LCAO_Orbitals parameter of write_eband_terms.
Key design: the atom basis function layout (ityp, iat, l, izeta, m) := mu is not necessary to be coupled with the block-cyclic distribution mechanism: one is about the matrix layout, the other is about how matrix is distributed
Summary
Parallel_Orbitalsdissolution plan by passing the block-cyclic basis and matrix layouts explicitly instead of relying on implicit inheritance or forwarding.BasisFlattenedIndexingandAtomBasisViewas a single basis-indexing boundary shared byHContainer, LCAO operators, and their consumers.para_2d()layouts.BlockCyclicDistributiontoParallel_Blkcyclic; the class documentation definesBlkcyclicas the ABACUS shorthand for block-cyclic. This addresses issue Rename block_cyclic_distribution and normalize its BLACS constants #8299.The PR-scoped diff is limited to this refactor. Upstream synchronization added no CSR-reader, workflow, documentation, or repository-local agent-memory changes to the PR.
Behavior
No INPUT, output-format, numerical, or public workflow behavior changes. Documentation updates are not required because this is an internal ownership and interface refactor; the affected contracts are documented inline.
Regression coverage
The first revision of this PR retained a duplicate inline
nspin=4Mulliken path that bypassed the already correctedcollect_MW_nspin4helper. Existing unit tests exercised only the helper, so they did not cover the productionOutput_Mulliken::collect_MW()path where the regression occurred. Integration and CUDA CI caught the resultingspin2/spin4sign reversal.The new
OutputMullikenSpinTest.Nspin4ProductionPathPreservesMySigntest callsOutput_Mulliken::collect_MW()directly. It fails with the old implementation (My=-1instead of+1) and passes after restoring the corrected helper path.Verification
The final class-name rename and interface-cleanup state was verified at
7ba7fa9bcwithabacus-dev/1.0, GNU 11.4.0, andOMP_NUM_THREADS=1:7ba7fa9bc: default CPU+MPI+LCAO+testing build[100%];9/9focused tests passed, includingMODULE_BASE_parallel_blkcycand its four-rank MPI test.7ba7fa9bc: LibRI/LibXC build[100%]; the same9/9focused tests passed.1fd814ea2: pre-rename production integration casescf_out_mul_spin4passed with both 1 and 4 MPI ranks.7ba7fa9bc: governance check has no blockers andgit diff --checkis clean.After merging
upstream/developat52bc79789, the current head8462a195fwas rebuilt with the same module environment and LibRI/LibXC/EXX enabled:8462a195f: EXX/LibRI/LibXC CPU+MPI+LCAO+testing build[100%](4850/4850).8462a195f:23/23focused tests passed, including the four-rank block-cyclic MPI test, seven HContainer tests, the upstream EXX/RI regression tests, Mulliken, boundary correction, and LR layout tests.8462a195f:git diff --checkis clean; governance has warnings only and the global dependency budget is net-5.AGENTS.md,CONTEXT.md, ADRs, developer-governance documents, and.qoder.Review follow-up at
77c9095f4:EKineticandOverlappair-levelcal_force_IJR/cal_stress_IJRinterfaces. Their legacyParallel_Orbitals*parameter is replaced by explicitBasisFlattenedIndexingandParallel_Blkcyclicinputs.gather_eijand name distribution parameters/memberspara_layout.16/16targets.8/8focused tests pass: EKinetic/Overlap serial, MPI, and three-center variants; RT evolve/band-energy; and theT_NL_cdcheck.git diff --checkis clean and governance has warnings only.Upstream synchronization at
d7789c6cf:upstream/developthrougha2beda0ea, including the RT/MD boundary-test split from test(rt): move boundary tests out of MD unit tests #8300.MODULE_MD_base_mpinow contains only MD-state tests, while boundary correction and the MD-to-RT contract live under the RT test fixture.BasisFlattenedIndexing/Parallel_Blkcyclicinterface and renamedparallel_blkcyc.cppbuild input.1132/1132incremental targets).16/16boundary, MD/RT contract, td-folding, and MD-base tests passed across serial, 4-rank MPI, and OpenMP variants.git diff --checkis clean.Governance Exception
test/directories before the new rule landed.Parallel_Orbitalsremoval and would create a large, noisy second refactor.unittests/layouts in a dedicated follow-up PR, using Governance: block unit tests outside a flat unittests/ directory and sources there without a test_ prefix #8245 as the tracking governance rule.Auto-merge is intentionally disabled.