Commit 99b64eb
authored
* Document why the MG coarse level must be small (#644, #643)
bknight1 hit an OOM at Pawsey: the FMG coarse solve is redundant+LU, which
replicates the coarse factorization on every rank, and his coarsest level still
carried 14k velocity DOFs - ~300 MB/rank replicated, killed at the 900 MB cap.
Agreed on the issue that this is not a bug but a documentation gap.
The premise the docs never stated: multigrid is cheap because the bottom of the
hierarchy is solved exactly at negligible cost, and that is only true if the
bottom is genuinely tiny. Nothing in the method makes it so and nothing warns
when it is not. A 14k-DOF coarsest level means the hierarchy was built from too
fine a base with too few levels, so the premise never held - the fix is another
level underneath, not a different bottom solve. Doubling the base cell size and
adding one refinement level lands on the same finest grid with every coarser
level ~4x smaller in 2-D (8x in 3-D); bknight1 measured that as 683 -> 416
MB/rank for +11% linear-solve time, with the finest grid and the SNES iteration
sequence unchanged.
Also records that this is PETSc's own choice, not ours: PCSetUp_MG selects
PCREDUNDANT above one rank and PCLU at one rank, its source comment reading
"coarse solve is (redundant) LU by default" (src/ksp/pc/impls/mg/mg.c), which I
confirmed by inspection at np = 1, 2 and 4. We set it explicitly only so a
bundle cannot inherit a sibling's leftover options (#468). Deleting the keys and
letting PETSc decide would change nothing - which is the point, because it puts
the attention back on the hierarchy.
Two corrections to what was there. The page claimed the default coarse solve was
a bare `lu` in both the bundle listing and the parallel section, and told users
to set redundant themselves for large partitions - it has been the default all
along. And the SVD path is documented as what it actually is: keyed on VERIFIED
rotation null modes, not on a problem being "rotated", because a rotated problem
with Dirichlet walls has none and a blanket dense SVD coarse solve cost most of
~0.8 s per V-cycle application in #622.
Adds a snippet to check the hierarchy you actually built (verified to run) and a
rule of thumb: low thousands of DOFs at the bottom, and if it reaches five
figures add a level.
docs-build: succeeded, no warnings on this page.
Underworld development team with AI support from Claude Code
* Adversarial review of my own #666: five defects, two of them wrong advice
Reviewed the docs change by running its claims rather than re-reading them. Five
findings, fixed here.
1. TELESCOPE CANNOT WORK HERE. The page offered
`mg_coarse_pc_type = "telescope"` for large partitions, and my rewrite
promoted it to its own subsection. PCTELESCOPE has no DMPlex support and
every UW3 mesh is a DMPlex, so the snippet aborts the solve: "Support for
DMPLEX is currently not available", PETSc error 56, reproduced at np=2. It is
now a warning that it is unavailable - which strengthens the point, since it
means there is NO bottom-solve escape hatch from an over-large coarse level.
2. THE SVD SNIPPET WAS INERT. `geometric_mg_bundle(coarse="svd")` builds an
MGSettings and discards it; nothing is applied. It read as a user action and
did nothing. Removed - the solver already selects SVD from the verified
rotation-mode count.
3. THE OVERRIDE PROMISE IS FALSE ON THE ROTATED PATH - the one path that wants
SVD. That route writes its bundle under the velocity sub-PC's own prefix,
applies it, then deletes the keys; `solver.petsc_options[...]` sits under the
SNES prefix and never reaches it. Verified the override DOES survive on the
standard path (fieldsplit_velocity_mg_coarse_pc_type = svd after solve), so
the promise is now scoped to that path and the rotated exception is a warning.
4. "LANDS ON THE SAME FINEST GRID" OVERCLAIMED. Measured, cellSize 0.10/ref2
gives 3,872 finest cells against 0.20/ref3 at 4,224 - 9% MORE, not equal,
while the coarsest drops to 27%. #644's own numbers go the other way (227k vs
233k). Now stated as a few percent either side, with both measurements.
5. THE RULE OF THUMB HAD NO np OR MEMORY BUDGET IN IT, yet those are what set
the threshold - the replicated factor is paid per rank against a per-rank cap.
Rewritten around that arithmetic, calibrated on #644's 14k DOFs -> ~300
MB/rank at 5.16x fill.
Claims that survived the review, all verified rather than asserted: the
dm_hierarchy snippet works on a bare mesh (no solver needed); the per-level
growth is exactly 4x in 2-D and 8.00x in 3-D (66/264/1056, 184/1472/11776);
PETSc's own source picks redundant above one rank and lu at one.
docs-build: succeeded, no warnings on this page.
Underworld development team with AI support from Claude Code
1 parent 0b2e3ea commit 99b64eb
1 file changed
Lines changed: 155 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
| 75 | + | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
| |||
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
95 | | - | |
| 96 | + | |
96 | 97 | | |
97 | | - | |
98 | | - | |
99 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 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 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
100 | 188 | | |
101 | 189 | | |
102 | | - | |
103 | | - | |
104 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
105 | 194 | | |
106 | | - | |
107 | | - | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
108 | 230 | | |
109 | 231 | | |
110 | | - | |
111 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
112 | 255 | | |
113 | 256 | | |
114 | 257 | | |
| |||
0 commit comments