Commit a9dcda3
abacus_fixer
refactor(parallel): step-1a rename ProcessTopology to 8-domain consistent
Scope: 3 files changed, +209 -82 lines.
Build: cmake --build build exit=0, abacus_basic_para linked successfully.
Test : OMP_NUM_THREADS=1 mpirun -np 4 MODULE_BASE_ProcessTopology
-> 7 / 7 tests passed
(5x divide_mpi_groups arithmetic
+ 2x ProcessTopology accessor / value-semantics cases).
Naming decision (after multi-round user review, naming principles:
1. All 8 communicators share the uniform `_world_comm` suffix.
2. The two legacy band-parallel domains INT_BGROUP / BP_WORLD are
renamed directly after the "band-side vs k-side diff/same
relation", ditching historically confusing abbreviations such
as `intra / inter / BP / INT`.
3. Two long-implicit domains are promoted to first-class names:
the matrix 2D block-cyclic BLACS world and the atom 3D
real-space DD (domain decomposition) world -- so callers no
longer rely on the ad-hoc "pick POOL_WORLD or DIAG_WORLD or
MPI_COMM_WORLD depending on the scene" convention.
Final 8-domain map (see parallel_topology.h for the full comment):
Legacy global -> New `*_world_comm` name # 1-line semantic
1. POOL_WORLD -> pw_world_comm # Same-k, same-band-group PW tile (smallest parallel world)
2. KP_WORLD -> kmesh_world_comm # (user-suggested content name) k-mesh root bridge across pools
3. INT_BGROUP -> bsame_kdiff_world_comm # (user-suggested abbreviation) band same, k different; same band-group union across k pools
4. BP_WORLD -> bdiff_ksame_world_comm # (user-suggested abbreviation) band different, k same; intra-pool cross-band-group pair bridge
5. GRID_WORLD -> rgrid_world_comm # explicitly approved by user early on
6. DIAG_WORLD -> diag_world_comm # explicitly approved by user early on
- (previously implicit)-> matrix_world_comm # (user-suggested replacement for blacs_world) 2D block-cyclic matrix BLACS world
- (previously implicit)-> atom_world_comm # (user-suggested) 3D real-space atomic DD / neighlist world
Scalar accessors aligned with the full-word `band_group`:
- `bgroup` shorthand is expanded to the full `band_group`:
my_band_group() / rank_in_band_group() / nproc_in_band_group().
- `bndpar()` is kept because it matches the INPUT `BNDPAR` flag.
- `kpar()` / `my_pool()` / `rank_in_pool()` / `nproc_in_pool()`
are preserved to keep the naming compatible with the 100+
occurrences of `pool` in Parallel_Kpoints and related modules.
New `band_group_root_rank(bg)` accessor:
- Symmetric with `pool_root_rank(pool)` on the pool axis.
- Constructor invariant: bndpar_ * nproc_in_band_group_ ==
world_nproc_, so the root rank formula is simply
`band_group * nproc_in_band_group_` -- this matches
ABACUS divide_pools output exactly.
- Tested on the 10-process / BNDPAR=2 / nproc_in_band_group=5
case: ASSERT band_group_root_rank(0)==0 and
band_group_root_rank(1)==5.
matrix_world_comm / atom_world_comm injection policy:
- Both fields default to MPI_COMM_NULL in the constructor (two
new trailing default parameters; the old 6-comm signature
still works, so AGENTS rule #5 does not apply).
- The "correct" BLACS / DD domain actually depends on the use
case (LCAO diag / GK diag / MD step / ...). Distributed
modules in Step 2 will fill these two handles in from the
appropriate view on an as-needed basis; no real data flow is
touched today.
- Serial fallback default-constructor asserts matrix_world_comm
== MPI_COMM_NULL and atom_world_comm == MPI_COMM_NULL. The
ConstructAndAccessors test injects MPI_COMM_SELF /
MPI_COMM_WORLD respectively and round-trips all 8 comm
accessors plus copy semantics.
Governance (agent_governance_check.py --staged):
- 1 warning only: "Documentation sync review". No user-visible
INPUT / CLI / external API change, so documentation is
correctly not updated. No exception needed.
- GlobalV / PARAM / GlobalC: 0 new reads. All topology data
are injected explicitly through constructor arguments, in
line with AGENTS rule #1 (budget: non-increasing, no new
globals introduced in this patch).
- Header dependencies: only <vector> and <mpi.h> in
parallel_topology.h, both required for self-containment
(member type + MPI_Comm return types). The 6 legacy global
communicators from parallel_comm.h are NOT transitively
pulled in, satisfying rule #3.
- C++11 compatible, one variable per declaration, no direct
MPI calls in this patch.*_world_comm naming1 parent a6e1a67 commit a9dcda3
3 files changed
Lines changed: 209 additions & 82 deletions
File tree
- source/source_base
- test_parallel
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
24 | 26 | | |
25 | 27 | | |
26 | 28 | | |
| |||
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
35 | | - | |
36 | | - | |
37 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
38 | 40 | | |
39 | 41 | | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
46 | 50 | | |
47 | 51 | | |
48 | 52 | | |
| |||
52 | 56 | | |
53 | 57 | | |
54 | 58 | | |
55 | | - | |
56 | | - | |
57 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
58 | 62 | | |
59 | 63 | | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
66 | 72 | | |
67 | 73 | | |
68 | 74 | | |
| |||
80 | 86 | | |
81 | 87 | | |
82 | 88 | | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
87 | 93 | | |
88 | 94 | | |
89 | 95 | | |
| |||
99 | 105 | | |
100 | 106 | | |
101 | 107 | | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
18 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
19 | 42 | | |
20 | 43 | | |
21 | 44 | | |
22 | 45 | | |
23 | 46 | | |
24 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
25 | 54 | | |
26 | 55 | | |
27 | 56 | | |
| |||
36 | 65 | | |
37 | 66 | | |
38 | 67 | | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
39 | 71 | | |
40 | 72 | | |
41 | 73 | | |
| |||
44 | 76 | | |
45 | 77 | | |
46 | 78 | | |
47 | | - | |
48 | | - | |
49 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
50 | 82 | | |
51 | 83 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
58 | 92 | | |
59 | 93 | | |
60 | 94 | | |
61 | 95 | | |
62 | 96 | | |
63 | 97 | | |
64 | 98 | | |
65 | | - | |
| 99 | + | |
66 | 100 | | |
67 | 101 | | |
68 | 102 | | |
| |||
71 | 105 | | |
72 | 106 | | |
73 | 107 | | |
74 | | - | |
| 108 | + | |
75 | 109 | | |
76 | | - | |
77 | | - | |
78 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
79 | 117 | | |
80 | 118 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
88 | 128 | | |
89 | 129 | | |
90 | 130 | | |
| |||
97 | 137 | | |
98 | 138 | | |
99 | 139 | | |
100 | | - | |
101 | | - | |
102 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
103 | 143 | | |
104 | 144 | | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
111 | 153 | | |
112 | 154 | | |
113 | 155 | | |
| |||
0 commit comments