Repository navigation
refactor(lcao): decouple basis indexing from block-cyclic layouts #8295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kirk0830
wants to merge
65
commits into
deepmodeling:develop
Choose a base branch
from
kirk0830:pr/06-explicit-layout-v2
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+4,590
−2,747
Open
Changes from all commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
77163dd
C1: add para_2d() accessor and get_blacs_ctxt() to Parallel_Orbitals
kirk0830 c1dc33f
D2(module_rt): drop Parallel_2D inheritance in Parallel_Orbitals, mig…
kirk0830 3806abf
D2(module_dftu): drop Parallel_2D inheritance in Parallel_Orbitals, m…
kirk0830 4785523
D2(module_dm): drop Parallel_2D inheritance in Parallel_Orbitals, mig…
kirk0830 ecafdd5
D2(pyabacus): drop Parallel_2D inheritance in Parallel_Orbitals, migr…
kirk0830 75b5e00
D2(module_lr): drop Parallel_2D inheritance in Parallel_Orbitals, mig…
kirk0830 a278873
D2(misc_prod): drop Parallel_2D inheritance in Parallel_Orbitals, mig…
kirk0830 fe3c4ad
D2(module_operator_lcao): drop Parallel_2D inheritance in Parallel_Or…
kirk0830 7d2a635
D2(test_side): drop Parallel_2D inheritance in Parallel_Orbitals, mig…
kirk0830 0c4dd34
D2(module_current): drop Parallel_2D inheritance in Parallel_Orbitals…
kirk0830 8ccddf5
D2(module_ao): drop Parallel_2D inheritance in Parallel_Orbitals, mig…
kirk0830 c98fe04
D4(module_lr): pass Parallel_Orbitals as explicit para_2d() at upcast…
kirk0830 318b793
D4(module_hs): pass Parallel_Orbitals as explicit para_2d() at upcast…
kirk0830 2efe254
D4(module_io): pass Parallel_Orbitals as explicit para_2d() at upcast…
kirk0830 b5f593c
D4(module_dftu): pass Parallel_Orbitals as explicit para_2d() at upca…
kirk0830 8f69efe
D4(module_ao): remove Parallel_Orbitals implicit upcast operator
kirk0830 a2ece91
D5(test_side): stop writing descriptor/distribution fields directly i…
15ab2e0
D5(test_side): rewrite link-mock TUs to link the real implementation
103a962
D5(test_side): migrate parallel_orbitals_test serial branch to explic…
8f3327e
D5(test_side): keep original is_serial member name, expose read-only …
kirk0830 643f93b
D5(test_side): drop is_serial() accessor, restore direct member acces…
kirk0830 2222368
D5(test_side): merge d5-test-side worktree commits (test-side refacto…
kirk0830 ed3f729
D6(module_ao): add composition regression guard for Parallel_Orbitals…
kirk0830 92ca14d
S1(source_base): extract BlockCyclicDistributionInformation, demote P…
kirk0830 47360b5
S2: converge Parallel_Orbitals composition to BlockCyclicDistribution…
kirk0830 17d2540
S3: bind NDArray to DistributedNDArray thin wrapper (host-side ndarra…
kirk0830 4c79b0a
S4: verify build-system wiring across four build surfaces (CMake main…
kirk0830 516cca9
S5: remove legacy Parallel_2D alias and parallel_2d.{h,cpp}, rewire a…
kirk0830 8dc4d18
Merge remote-tracking branch 'upstream/develop' into pr/02-lcao-expli…
kirk0830 a1c9b49
style: remove trailing whitespace in LCAO layout migration
kirk0830 5e1603e
Merge branch 'pr/02-lcao-explicit-para2d' into pr/03-remove-parallel2…
kirk0830 a6a1532
test: use explicit serial block-cyclic layout
kirk0830 8eb8aaf
refactor: use explicit layout in serial paths
kirk0830 ad12452
refactor: migrate optional backends to explicit layout
kirk0830 1046ce6
Merge branch 'pr/03-remove-parallel2d-inheritance' into pr/04-composi…
kirk0830 c9b15b0
test(module_ao): tighten composition regression guard
kirk0830 3c4c968
Merge branch 'pr/04-composition-guard' into pr/05-blockcyclic-api
kirk0830 8bd23cd
refactor(base): simplify block-cyclic layout API
kirk0830 95cc5c9
style(base): name BLACS descriptor constants with UPPER_CASE
kirk0830 e10a898
refactor(base): make basis identity and distribution self-contained v…
kirk0830 4a3f83d
refactor(hcontainer): construct atom pair shapes from basis values
kirk0830 dd4326f
refactor(lcao): consume explicit basis and matrix layout values
kirk0830 0d09fa1
docs: record the layout boundary and forbid per-element basis offset …
kirk0830 d8edeb9
S1(source_base): extract BlockCyclicDistributionInformation, demote P…
kirk0830 2eba7e9
S2: converge Parallel_Orbitals composition to BlockCyclicDistribution…
kirk0830 dba2e5f
S3: bind NDArray to DistributedNDArray thin wrapper (host-side ndarra…
kirk0830 0c56e72
S5: remove legacy Parallel_2D alias and parallel_2d.{h,cpp}, rewire a…
kirk0830 f506aa8
refactor(base): simplify block-cyclic layout API
kirk0830 1d64b7c
style(base): name BLACS descriptor constants with UPPER_CASE
kirk0830 06bbed1
fix(base): complete explicit block-cyclic migration
kirk0830 39bcfd8
fix(ri): access block-cyclic distribution explicitly
kirk0830 de3f795
Merge branch 'develop' into pr/05-blockcyclic-api-v2
kirk0830 cd65d43
fix(base): correct distributed ndarray layout
kirk0830 dd716b4
Merge branch 'develop' into pr/05-blockcyclic-api-v2
kirk0830 a887b6e
refactor(base): shorten block-cyclic API names
kirk0830 cdc076a
fix(base): make array layout semantics explicit
kirk0830 292aabb
refactor(base): remove unused distributed NDArray adapter
kirk0830 d1e197f
Merge PR-5 block-cyclic API into explicit-layout refactor
kirk0830 c0a1d32
Merge remote-tracking branch 'upstream/develop' into pr/06-explicit-l…
kirk0830 0e96659
fix(io): preserve corrected nspin4 Mulliken spin signs
kirk0830 1fd814e
test(io): cover nspin4 Mulliken production path
kirk0830 74a34df
refactor(lcao): address explicit-layout review feedback
kirk0830 adbb919
refactor(base): rename block-cyclic distribution source
kirk0830 2dccf45
docs(headers): document forward declaration definitions
kirk0830 7ba7fa9
refactor(base): rename block-cyclic distribution type
kirk0830 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| #include "source_base/atom_basis_view.h" | ||
|
|
||
| #include "source_base/basis_flattened_indexing.h" | ||
| #include "source_base/parallel_blkcyc.h" | ||
|
|
||
| #include <stdexcept> | ||
|
|
||
| AtomBasisView::AtomBasisView(const Parallel_Blkcyclic* layout, | ||
| const int ibas0, | ||
| const int local0, | ||
| const int nloc, | ||
| const bool col_axis) | ||
| : layout_(layout), ibas0_(ibas0), local0_(local0), nloc_(nloc), col_axis_(col_axis) | ||
| { | ||
| } | ||
|
|
||
| AtomBasisView AtomBasisView::make(const BasisFlattenedIndexing& basis, | ||
| const Parallel_Blkcyclic& layout, | ||
| const int iat, | ||
| const bool columns) | ||
| { | ||
| const int global_size = columns ? layout.ncglb() : layout.nrglb(); | ||
| if (basis.size() != static_cast<std::size_t>(global_size)) | ||
| { | ||
| throw std::invalid_argument("basis indexing and matrix distribution sizes disagree"); | ||
| } | ||
|
|
||
| const BasisRange basis_range = basis.range(iat); | ||
| const int ibas0 = static_cast<int>(basis_range.ibas0); | ||
| int local0 = -1; | ||
| int last_local = -2; | ||
| int nloc = 0; | ||
| for (std::size_t ibas = basis_range.ibas0; ibas < basis_range.ibas1; ++ibas) | ||
| { | ||
| const int ibas_global = static_cast<int>(ibas); | ||
| const int local = columns ? layout.icloc(ibas_global) : layout.irloc(ibas_global); | ||
| if (local < 0) | ||
| { | ||
| continue; | ||
| } | ||
| if (nloc == 0) | ||
| { | ||
| local0 = local; | ||
| } | ||
| else if (local != last_local + 1) | ||
| { | ||
| throw std::invalid_argument("atom basis entries are not contiguous"); | ||
| } | ||
| last_local = local; | ||
| ++nloc; | ||
| } | ||
| return AtomBasisView(&layout, ibas0, local0, nloc, columns); | ||
| } | ||
|
|
||
| int AtomBasisView::operator[](const std::size_t index) const | ||
| { | ||
| // Reproduces the eager value the old vector stored: the global basis index | ||
| // of the owned local entry minus the atom's first basis index (ibas - ibas0). | ||
| const int local = local0_ + static_cast<int>(index); | ||
| const int ibas_global = col_axis_ ? layout_->icglb(local) : layout_->irglb(local); | ||
| const int entry = ibas_global - ibas0_; | ||
| return entry; | ||
| } | ||
|
|
||
| AtomBasisView AtomBasisView::rows(const BasisFlattenedIndexing& basis, | ||
| const Parallel_Blkcyclic& layout, | ||
| const int iat) | ||
| { | ||
| return make(basis, layout, iat, false); | ||
| } | ||
|
|
||
| AtomBasisView AtomBasisView::cols(const BasisFlattenedIndexing& basis, | ||
| const Parallel_Blkcyclic& layout, | ||
| const int iat) | ||
| { | ||
| return make(basis, layout, iat, true); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| #ifndef ABACUS_SOURCE_BASE_ATOM_BASIS_VIEW_H | ||
| #define ABACUS_SOURCE_BASE_ATOM_BASIS_VIEW_H | ||
|
|
||
| #include <cstddef> | ||
|
|
||
| class BasisFlattenedIndexing; // Defined in source/source_base/basis_flattened_indexing.h | ||
| class Parallel_Blkcyclic; // Defined in source/source_base/parallel_blkcyc.h | ||
|
|
||
| /** | ||
| * @brief Atom-local basis entries derived from basis indexing and distribution. | ||
| * | ||
| * Entries are atom-local basis numbers in local matrix order, materialized on | ||
| * demand from the indexing and distribution inputs; the view allocates nothing. | ||
| */ | ||
| class AtomBasisView | ||
| { | ||
| public: | ||
| static AtomBasisView rows(const BasisFlattenedIndexing& basis, | ||
| const Parallel_Blkcyclic& layout, | ||
| int iat); | ||
| static AtomBasisView cols(const BasisFlattenedIndexing& basis, | ||
| const Parallel_Blkcyclic& layout, | ||
| int iat); | ||
|
|
||
| int nloc() const | ||
| { | ||
| return nloc_; | ||
| } | ||
|
|
||
| bool empty() const | ||
| { | ||
| return nloc_ == 0; | ||
| } | ||
|
|
||
| int local0() const | ||
| { | ||
| return local0_; | ||
| } | ||
|
|
||
| // index must be smaller than nloc(); out-of-range access is not checked. | ||
| // This view borrows the distribution it was derived from; it must not | ||
| // outlive it. | ||
| int operator[](const std::size_t index) const; | ||
|
|
||
| private: | ||
| AtomBasisView(const Parallel_Blkcyclic* layout, | ||
| const int ibas0, | ||
| const int local0, | ||
| const int nloc, | ||
| const bool col_axis); | ||
|
|
||
| static AtomBasisView make(const BasisFlattenedIndexing& basis, | ||
| const Parallel_Blkcyclic& layout, | ||
| const int iat, | ||
| const bool columns); | ||
|
|
||
| const Parallel_Blkcyclic* layout_ = nullptr; | ||
| int ibas0_ = 0; | ||
| int local0_ = 0; | ||
| int nloc_ = 0; | ||
| bool col_axis_ = false; | ||
| }; | ||
|
|
||
| #endif |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.