47#include <Kokkos_Core.hpp>
61void check(
bool ok,
const std::string& what) {
62 int bad =
ok ? 0 : 1, any = 0;
63 MPI_Allreduce(&bad, &any, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
65 std::printf(
" %-100s %s\n",
what.c_str(), any ?
"FAIL" :
"PASS");
75 mg.initMpi(
P.nx,
P.ny,
P.nz,
P.levels, MPI_COMM_WORLD);
80 const std::size_t
n = (std::size_t)
e.x *
e.y *
e.z;
81 std::vector<double>
ox(n, 0.0), oy(n, 0.0),
oz(n, 0.0);
82 for (
int z = g;
z <
e.z -
g; ++
z)
83 for (
int y = g;
y <
e.y -
g; ++
y)
84 for (
int x = g;
x <
e.x -
g; ++
x) {
85 const long li = (long)x + (
long)
y *
e.x + (long)z * (
long)
e.x *
e.y;
86 const long gi =
P.idx(x - g +
og.x, y - g +
og.y, z - g +
og.z);
96long ringMismatches(
CutcellMG& mg,
int L) {
101 Kokkos::deep_copy(s, *w);
102 lv.devf->exchange(s);
104 for (std::size_t i = 0;
i < hw.size(); ++
i)
105 if (std::memcmp(&hw[i], &hs[i],
sizeof(
VReal)) != 0)
111void ringChecks(
CutcellMG& mg,
const std::string& tag) {
114 for (
int L = 0;
L <= last; ++
L) {
116 const bool built =
lv.devf !=
nullptr &&
lv.WX.extent(0) ==
lv.n &&
lv.wOk;
117 check(built, tag +
": L" + std::to_string(L) +
" (g " + std::to_string(
lv.g) +
118 ") carries the FP32 data and its GridHalo<float>");
121 ca +=
lv.g == 2 ? 1 : 0;
122 const long bad = ringMismatches(mg, L);
123 check(bad == 0, tag +
": G-K2 L" + std::to_string(L) +
" ghost WX/WY/WZ == owner (" +
124 std::to_string(bad) +
" cells differ)");
127 MPI_Allreduce(&ca, &caMax, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
129 std::printf(
" %s: fp32Last %d of %d levels, %d CA (g = 2) FP32 levels\n",
tag.c_str(), last,
132 for (
int L = 0;
L <= last; ++
L)
134 check(ok, tag +
": the allreduced range flags pass on every FP32 level");
137void problemChecks(
const Problem& P) {
138 const std::string
tag =
P.name +
" np" + std::to_string(size);
143 ringChecks(mg, tag +
" build");
147 ringChecks(mg, tag +
" setter rebuild");
149 check(why ==
nullptr, tag +
": eligible distributed (WO-D2): " + (why ? why :
"eligible"));
156 none = none && mg.
level(L).devf ==
nullptr && mg.
level(L).
WX.extent(0) == 0 &&
158 check(none, tag +
": an 'fp64' build creates no GridHalo<float> and no FP32 arrays");
164constexpr int kMaxit = 200;
165constexpr double kRtol = 1
e-10;
169inline double gdd2aBound(
double refMax) {
170 return std::max(1e-8, 1e-12 * refMax);
175 return P.idx(x - l0.
g + l0.
og.
x, y - l0.
g + l0.
og.
y, z - l0.
g + l0.
og.
z);
181 for (
int z = g;
z <
e.z -
g; ++
z)
182 for (
int y = g;
y <
e.y -
g; ++
y)
183 for (
int x = g;
x <
e.x -
g; ++
x)
184 f(x, y, z, (
long)x + (
long)y *
e.x + (
long)z * (
long)
e.x *
e.y);
188 const std::vector<double>& global) {
189 std::vector<double>
v(l0.
n, 0.0);
190 forInner(l0, [&](
int x,
int y,
int z,
long li) {
v[li] = global[globalIndex(P, l0, x, y, z)]; });
200 const std::vector<double>& ref) {
202 forInner(l0, [&](
int x,
int y,
int z,
long li) {
203 const double r =
ref[globalIndex(P, l0, x, y, z)];
204 const double v = std::fabs(a[li] - r);
205 if (!(v <=
d.maxAbs))
207 d.refMax = std::max(
d.refMax, std::fabs(r));
208 if (std::memcmp(&a[li], &r,
sizeof(
double)) != 0)
211 double m[2] = {
d.maxAbs,
d.refMax}, gm[2];
212 MPI_Allreduce(m, gm, 2, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
214 MPI_Allreduce(&
d.bits, &gb, 1, MPI_LONG, MPI_SUM, MPI_COMM_WORLD);
215 return Diff{gm[0], gm[1], gb};
217std::string
num(
double v) {
219 std::snprintf(b,
sizeof(b),
"%.3e", v);
224 int it = -1, restarts = 0, discarded = -1;
225 bool failed =
false, fp32 =
false, threw =
false;
226 std::vector<double>
x;
227 bool converged()
const {
return !threw && !
failed &&
it < kMaxit; }
229std::string itStr(
const Run& r) {
231 ? std::string(
"threw")
232 : std::to_string(
r.
it) + (
r.
failed ?
" failed" :
"") + (
r.fp32 ?
" fp32" :
" fp64");
234bool gLineRelax =
true;
236Run solveOn(
CutcellMG& mg,
const std::vector<double>& hb,
int driver,
int kind = 0,
int at = 0,
237 int maxit = kMaxit,
double rtol = kRtol) {
238 const std::size_t
n =
hb.size();
239 CCField b =
toDevice(hb,
"b"),
x(
"x", n),
r(
"r", n),
p(
"p", n),
z(
"z", n), zp(
"zp", n),
245 out.it =
driver == 0 ? mg.
solvePCG(b, x, r, p, z, Ap, maxit, rtol, 2, 2, 12)
246 : mg.
solveFCG(b, x, r, p, z, zp, Ap, maxit, rtol, 2, 2, 12);
247 }
catch (
const std::runtime_error&) {
260Run single(
const Problem& P,
int mode,
int driver,
int kind = 0,
int at = 0) {
265 r = solveOn(mg,
rhsOf(P), driver, kind, at);
267 int v[6] = {
r.it,
r.restarts,
r.discarded,
r.failed,
r.fp32,
r.threw};
268 MPI_Bcast(v, 6, MPI_INT, 0, MPI_COMM_WORLD);
269 long n = (long)
r.x.size();
270 MPI_Bcast(&n, 1, MPI_LONG, 0, MPI_COMM_WORLD);
271 r.x.resize((std::size_t)n);
272 MPI_Bcast(
r.x.data(), (
int)n, MPI_DOUBLE, 0, MPI_COMM_WORLD);
276 r.failed =
v[3] != 0;
281Run dist(
const Problem& P,
int mode,
int driver,
int kind = 0,
int at = 0,
int ca =
kCaBoth,
282 int maxit = kMaxit,
double rtol = kRtol,
int teleForce = -1) {
284 setUpDist(mg, P, mode, ca, teleForce);
285 return solveOn(mg,
sliceOf(P, mg.
level(0),
rhsOf(P)), driver, kind, at, maxit, rtol);
290 explicit DistLevel0(
const Problem& P,
int ca =
kCaBoth) {
293 const CutcellMG::Level& l0() {
return mg.level(0); }
295bool sameRun(
const Run& a,
const Run& b) {
296 return a.x.size() ==
b.x.size() &&
297 std::memcmp(
a.x.data(),
b.x.data(),
a.x.size() *
sizeof(
double)) == 0 &&
a.it ==
b.it;
300bool allRanks(
bool v) {
301 int a =
v ? 1 : 0,
g = 0;
302 MPI_Allreduce(&a, &g, 1, MPI_INT, MPI_MIN, MPI_COMM_WORLD);
307std::vector<double> oneVcycle(
CutcellMG& mg,
const std::vector<double>& hr) {
309 const std::size_t
n = l0.
n;
311 CCField s0(
"s0", n),
s1(
"s1", n),
s2(
"s2", n),
s3(
"s3", n),
s4(
"s4", n),
s5(
"s5", n);
312 mg.
solvePCG(s0, s1, s2, s3, s4, s5, 0, 1e-8, 2, 2, 12);
321double trueResidual(
CutcellMG& mg,
const std::vector<double>& hb,
const std::vector<double>& hx) {
325 const double bn = mg.
maxabs(l0, b);
327 mg.
axpy(b, -1.0, Ap);
329 return mg.
maxabs(l0, b) / bn;
333 return std::max(1, (
int)std::ceil(0.05 * ref));
336void d2aChecks(
const Problem& P) {
337 const std::string
tag =
P.name +
" np" + std::to_string(size);
343 const char* why =
probe.fp32VcycleIneligible(
true);
344 if (why !=
nullptr) {
345 check(
false, tag +
": ineligible distributed: " + why);
349 std::printf(
" %s: %d levels, fp32Last %d, eligible\n",
tag.c_str(),
probe.nLevels(),
352 const char* dn[2] = {
"PCG",
"FCG"};
356 auto mname = [](
int m) {
359 bool fp64Converges[2] = {
false,
false};
360 for (
int driver : {0, 1}) {
362 for (std::size_t k = 0;
k < modes.size(); ++
k)
363 ref[k] = single(P, modes[k], driver);
367 const bool run =
size == 1 ||
ref[0].converged() ||
ref[1].converged();
370 std::printf(
" %-100s n/a\n", (tag +
" " + dn[driver] +
371 ": G-DD2 (a), (c) single rank converges in neither mode (" +
372 itStr(ref[0]) +
", " + itStr(ref[1]) +
")")
376 for (std::size_t k = 0;
k < modes.size(); ++
k)
377 got[k] = dist(P, modes[k], driver);
378 fp64Converges[
driver] = got[1].converged();
379 for (std::size_t k = 0;
k < modes.size(); ++
k) {
380 const std::string
t =
tag +
" " + dn[
driver] +
" '" + mname(modes[k]) +
"'";
381 const Diff d = diffInner(P, l0, got[k].x, ref[k].x);
382 const bool itEq = allRanks(got[k].it == ref[k].it);
386 check(
false, t +
": did not run the FP32 V-cycle (" + itStr(got[k]) +
")");
390 check(
d.bits == 0 && itEq && got[k].failed == ref[k].failed,
391 t +
": G-DD1 x memcmp == single rank (" + std::to_string(
d.bits) +
392 " cells differ), iterations " + itStr(got[k]) +
" / " + itStr(ref[k]));
393 }
else if (ref[k].converged()) {
394 const bool itOk = std::abs(got[k].it - ref[k].it) <= within(ref[k].it);
395 check(
d.maxAbs <= gdd2aBound(
d.refMax) && allRanks(itOk),
396 t +
": G-DD2 (a) max|x - x1| " +
num(
d.maxAbs) +
" (max|x| " +
num(
d.refMax) +
397 "), iterations " + itStr(got[k]) +
" vs " + itStr(ref[k]));
398 }
else if (rank == 0) {
399 std::printf(
" %-100s n/a\n", (t +
": G-DD2 (a) single rank does not converge (" +
400 itStr(ref[k]) +
"), np " + itStr(got[k]))
405 if (got[1].converged())
406 check(got[0].it <= got[1].it + within(got[1].it),
407 tag +
" " + dn[driver] +
": G-DD2 (c) 'fp32' " + itStr(got[0]) +
" <= 'fp64' " +
408 itStr(got[1]) +
" + max(1, 5 %)");
410 std::printf(
" %-100s n/a\n",
411 (tag +
" " + dn[driver] +
": G-DD2 (c) 'fp64' does not converge (" +
412 itStr(got[1]) +
"), 'fp32' " + itStr(got[0]))
416 const bool vcycleCase =
P.name ==
"cyl" ||
P.name ==
"box64";
417 if (size == 1 || vcycleCase) {
421 const bool sameDepth =
ms.nLevels() == md.
nLevels();
422 const std::vector<double> rhs =
rhsOf(P);
423 const std::vector<double> zs = oneVcycle(ms, rhs);
424 const std::vector<double> zd = oneVcycle(md,
sliceOf(P, md.
level(0), rhs));
425 const Diff d = diffInner(P, md.
level(0), zd, zs);
427 check(
d.bits == 0, tag +
": G-DD1 (a) one FP32 V-cycle z memcmp == single rank (" +
428 std::to_string(
d.bits) +
" cells differ)");
430 check(
d.maxAbs <= 1e-11 *
d.refMax,
431 tag +
": G-DD2 (b) one FP32 V-cycle max|dz|/max|z| " +
num(
d.maxAbs /
d.refMax));
433 std::printf(
" %s: G-DD2 (b) n/a (depth %d vs single rank %d)\n",
tag.c_str(), md.
nLevels(),
438 for (
int driver : {0, 1}) {
439 if (!fp64Converges[driver])
443 for (
int k = 0;
k < 2; ++
k) {
447 const Run
r = solveOn(mg, hb, driver, 0, 0, 300, 1e-14);
449 fl[
k] = trueResidual(mg, hb,
r.x);
451 check(fl[0] <= 2.0 * fl[1], tag +
" " + dn[driver] +
": G-DD2 (d) floor fp32 " +
num(fl[0]) +
452 " (" + std::to_string(its[0]) +
" it) <= 2 x fp64 " +
453 num(fl[1]) +
" (" + std::to_string(its[1]) +
" it)");
456 if (size > 1 && vcycleCase) {
461 check(allRanks(sameRun(on, off)),
462 tag +
": G-DD2 (e) CA on == CA off bitwise (" + itStr(on) +
" / " + itStr(off) +
")");
468 check(allRanks(sameRun(a, b)), tag +
": G-DD2 (g) two runs bitwise (" + itStr(a) +
")");
473void restartChecks(
const Problem& P) {
474 const std::string
tag =
P.name +
" np" + std::to_string(size);
478 if (
probe.fp32VcycleIneligible(
true) !=
nullptr)
481 for (
int driver : {0, 1}) {
482 const std::string
t =
tag + (
driver == 0 ?
" PCG" :
" FCG");
484 auto restartedIsFp64 = [&](
const Run&
a) {
485 return allRanks(sameRun(a, ref64) &&
a.failed == ref64.failed && !
a.fp32 &&
a.restarts == 1 &&
488 auto restartsAgree = [&](
const Run&
a) {
490 MPI_Allreduce(&
a.restarts, &mn, 1, MPI_INT, MPI_MIN, MPI_COMM_WORLD);
491 MPI_Allreduce(&
a.restarts, &mx, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
496 check(allRanks(sameRun(a, ref64) && !
a.fp32 &&
a.restarts == 0),
497 t +
": G-R (h) host 'auto' == 'fp64', the fault inert, no restart (" + itStr(a) +
")");
500 check(restartedIsFp64(a) && restartsAgree(a),
501 t +
": G-R (h)(a) kind 1 at 3 -> restart == fp64 cold (" + itStr(a) +
", discarded " +
502 std::to_string(
a.discarded) +
")");
504 check(restartedIsFp64(b) &&
b.discarded == 2 && restartsAgree(b),
505 t +
": G-R (h)(b) kind 2 at 2 -> restart == fp64 cold, discarded " +
506 std::to_string(
b.discarded));
510 const Diff d = diffInner(P,
D.l0(),
a.x, sa.x);
511 check(
d.bits == 0 &&
a.it == sa.it &&
a.restarts == sa.restarts,
512 t +
": G-R (h) np 1 restart memcmp == the single-rank restart (" +
513 std::to_string(
d.bits) +
" cells differ)");
518 check(allRanks(
c1.restarts == 0 &&
c1.failed &&
c1.fp32 &&
c2.restarts == 0 &&
c2.it == 2 &&
520 t +
": G-R (h)(c) forced 'fp32': no restart; kind 1 " + itStr(c1) +
", kind 2 " +
526void teleChecks(
const Problem& P,
int teleForce) {
527 const std::string
tag =
528 P.name + (teleForce >= 0 ?
" forced-tele L" + std::to_string(teleForce) :
" natural-tele") +
529 " np" + std::to_string(
size);
533 for (
int L = 0;
L <
probe.nLevels(); ++
L)
534 if (
probe.level(L).tele) {
538 int tlMin = 0, tlMax = 0;
539 MPI_Allreduce(&tl, &tlMin, 1, MPI_INT, MPI_MIN, MPI_COMM_WORLD);
540 MPI_Allreduce(&tl, &tlMax, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
543 std::printf(
" %s: does not telescope at this np (n/a)\n",
tag.c_str());
546 check(tlMin == tlMax &&
probe.fp32Last() == tl,
547 tag +
": the first telescope level " + std::to_string(tl) +
" is fp32Last (" +
548 std::to_string(
probe.fp32Last()) +
") on every rank");
549 const char* why =
probe.fp32VcycleIneligible(
true);
550 check(why ==
nullptr, tag +
": eligible: " + (why ? why :
"yes"));
554 std::printf(
" %s: %d levels on rank 0, FP32 on 0..%d, FP64 below\n",
tag.c_str(),
555 probe.nLevels(), tl);
556 const char* dn[2] = {
"PCG",
"FCG"};
560 for (
int driver : {0, 1}) {
562 for (std::size_t k = 0;
k < modes.size(); ++
k) {
563 ref[
k] = single(P, modes[k], driver);
564 got[
k] = dist(P, modes[k], driver, 0, 0,
kCaBoth, kMaxit, kRtol, teleForce);
566 for (std::size_t k = 0;
k < modes.size(); ++
k) {
569 const std::string
t =
572 check(
false, t +
": did not run the FP32 V-cycle (" + itStr(got[k]) +
")");
575 const Diff d = diffInner(P,
probe.level(0), got[k].x, ref[k].x);
576 if (ref[k].converged()) {
577 const bool itOk = std::abs(got[k].it - ref[k].it) <= within(ref[k].it);
578 check(
d.maxAbs <= gdd2aBound(
d.refMax) && allRanks(itOk),
579 t +
": G-DD2 (f)(a) max|x - x1| " +
num(
d.maxAbs) +
" (max|x| " +
num(
d.refMax) +
580 "), iterations " + itStr(got[k]) +
" vs " + itStr(ref[k]));
581 }
else if (rank == 0) {
584 (t +
": G-DD2 (f)(a) single rank does not converge (" + itStr(ref[k]) +
")").c_str());
587 if (got[1].converged())
588 check(got[0].it <= got[1].it + within(got[1].it),
589 tag +
" " + dn[driver] +
": G-DD2 (f)(c) 'fp32' " + itStr(got[0]) +
" <= 'fp64' " +
590 itStr(got[1]) +
" + max(1, 5 %)");
592 std::printf(
" %-100s n/a\n",
593 (tag +
" " + dn[driver] +
": G-DD2 (f)(c) 'fp64' does not converge (" +
607 MPI_Allreduce(&depth, &depthMax, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
608 const std::vector<double> rhs =
rhsOf(P);
609 const std::vector<double> zs = oneVcycle(ms, rhs);
610 const std::vector<double> zd = oneVcycle(md,
sliceOf(P, md.
level(0), rhs));
611 const Diff d = diffInner(P, md.
level(0), zd, zs);
612 if (depthMax !=
ms.nLevels()) {
614 std::printf(
" %s: G-DD2 (f)(b) n/a (depth %d vs single rank %d)\n",
tag.c_str(), depthMax,
616 }
else if (tl ==
ms.nLevels() - 2) {
617 check(
d.maxAbs <= 1e-11 *
d.refMax,
618 tag +
": G-DD2 (f)(b) one FP32 V-cycle max|dz|/max|z| " +
num(
d.maxAbs /
d.refMax));
624 CCField s0(
"s0", l0.
n),
s1(
"s1", l0.
n),
s2(
"s2", l0.
n),
s3(
"s3", l0.
n),
s4(
"s4", l0.
n),
626 m64.
solvePCG(s0, s1, s2, s3, s4, s5, 0, 1e-8, 2, 2, 12);
631 const std::vector<double> z64 =
toHost(z);
632 double dm = 0.0, zm = 0.0;
633 for (
int zc = 1; zc <=
P.nz; ++zc)
634 for (
int y = 1;
y <=
P.ny; ++
y)
635 for (
int x = 1;
x <=
P.nx; ++
x) {
636 const long i =
P.idx(x - 1, y - 1, zc - 1);
637 dm = std::max(dm, std::fabs(z64[i] - zs[i]));
638 zm = std::max(zm, std::fabs(zs[i]));
642 " %s: G-DD2 (f)(b) info: FP64 below L%d (single rank FP32 to L%d): "
643 "max|dz|/max|z| %s vs single rank (single-rank fp32 vs fp64 V-cycle %s)\n",
644 tag.c_str(), tl,
ms.nLevels() - 2,
num(
d.maxAbs /
d.refMax).c_str(),
645 num(dm / zm).c_str());
658Problem lineProblem(
const std::string& name,
int nz,
int levels,
bool walls) {
659 int bc[6] = {0, 0, 0, 0, 0, 0};
662 auto rho = [nz](
double x,
double y,
double z) {
663 const double dx =
x - 24,
dy =
y - 40,
dz = (
z - 0.5 * nz) * 3.0;
666 return makeProblem(name, 64, 64, nz, levels, bc, [](
double,
double,
double) {
return 1.0; },
rho);
668void lineChecks(
const Problem& P, std::vector<int> modes) {
669 const std::string
tag =
P.name +
" np" + std::to_string(size);
674 ls =
ms.lineSmoothedLevels();
677 tag +
": the hierarchy has triggered smoothed levels (" + std::to_string(ls.size()) +
")");
678 int held = 0, on = 0;
688 check(on == held && (size > 1 || held == (
int)ls.size()),
689 tag +
": every triggered level a rank holds is line-relaxed (s whole on the blocks)");
693 std::vector<bool> ctlEq(modes.size(),
false);
694 for (
int lr : {0, 1})
695 for (std::size_t k = 0;
k < modes.size(); ++
k) {
696 const int mode = modes[
k];
697 gLineRelax =
lr == 1;
698 const std::string
t =
700 const Run
ref = single(P, mode, 0);
701 const Run got = dist(P, mode, 0);
703 const Diff d = diffInner(P,
D.l0(), got.x,
ref.x);
704 const bool itEq = allRanks(got.it ==
ref.it);
706 const bool eq =
d.bits == 0 && itEq && got.failed ==
ref.failed;
707 const std::string
what =
t +
": x memcmp == single rank (" + std::to_string(
d.bits) +
708 " cells differ), iterations " + itStr(got) +
" / " + itStr(ref);
715 " %-100s %s\n",
what.c_str(),
716 lr ?
"n/a (the LR-off control differs too)" : (eq ?
"(control) =" :
"(control) !="));
718 const bool itOk = allRanks(std::abs(got.it -
ref.it) <= within(
ref.it));
719 check(
ref.converged() && got.converged() &&
d.maxAbs <= gdd2aBound(
d.refMax) && itOk,
720 t +
": max|dx| " +
num(
d.maxAbs) +
" <= " +
num(gdd2aBound(
d.refMax)) +
721 ", iterations " + itStr(got) +
" vs " + itStr(ref));
728int main(
int argc,
char** argv) {
729 MPI_Init(&argc, &argv);
730 Kokkos::initialize(argc, argv);
731 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
732 MPI_Comm_size(MPI_COMM_WORLD, &size);
734 std::printf(
"mg_fp32_vcycle_mpi np=%d (doc/vof_projection_distributed_design.md §5, G-K2)\n",
745 if (size == 4 || size == 8) {
754 std::printf(
"%s (%d failure%s)\n",
fails ?
"FAIL" :
"PASS",
fails,
fails == 1 ?
"" :
"s");
757 return fails ? 1 : 0;
static constexpr bool kHostMemory
void axpy(CCField y, double a, CCField x)
void removeMean(Level &lv, CCField f, bool stopGuard=false)
int solvePCG(CCField b, CCField x, CCField r, CCField p, CCField z, CCField Ap, int maxit, double rtol, int pre, int post, int bottom, const StarOverlay *star=nullptr, int nStar=0, C3 nnStar=C3{0, 0, 0})
void precondVcycleFp32(CCField zz, CCField rr, int e, int k, CCField p)
void matvecOverlap(Level &l0, CCField y, CCField v)
void debugSetFp32Fault(int kind, int at)
const char * fp32VcycleIneligible(bool krylov) const
void setOpenness(CCConst ox, CCConst oy, CCConst oz, double idx2, double idy2, double idz2)
void setBoundaryConditions(const int bc[6])
double maxabs(Level &lv, CCField a)
bool lineRelaxOn(const Level &lv) const
void precondVcycle(CCField zz, CCField rr)
bool fp32Carriable() const
int lastDiscardedIters() const
bool lastVcycleFp32() const
void setTelescopeForceLevel(int L)
void setLineRelaxation(bool on)
A2.4 (doc/mg_depth_policy.md, WO-7): zebra line relaxation along the blocked strong axis on the trigg...
int vcycleRestarts() const
int solveFCG(CCField b, CCField x, CCField r, CCField p, CCField z, CCField zp, CCField Ap, int maxit, double rtol, int pre, int post, int bottom, const StarOverlay *star=nullptr, int nStar=0, C3 nnStar=C3{0, 0, 0})
bool fp32WeightsOk(int L) const
void setCommAvoiding(int mask)
Communication-avoiding smoothing mask (kCaMomentum | kCaMg); only kCaMg is read here.
void setVcyclePrecision(int mode)
flow — portable (Kokkos) geometric multigrid for the cut-cell (variable-openness) pressure Poisson.
The FP32 V-cycle test problems (column, cyl, slab, pack) and their right-hand side,...
std::string num(double v)
Kokkos::View< const double *, CCMem > CCConst
Kokkos::View< VReal *, CCMem > VField
Kokkos::View< double *, CCMem > CCField
std::vector< double > rhsOf(const Problem &P)
Problem slabProblem(double ratio=1e3)
CCField toDevice(const std::vector< double > &v, const char *name)
void setUp(CutcellMG &mg, const Problem &P, int mode)
Problem makeProblem(const std::string &name, int nx, int ny, int nz, int levels, const int bc[6], Open open, Rho rho)
std::vector< typename V::non_const_value_type > toHost(const V &f)
Kokkos::View< VReal *, CCMem > WX
Kokkos::View< VReal *, CCMem > xf
static void check(bool ok, const std::string &what)
static constexpr double F
static std::vector< double > sliceOf(const std::vector< double > &g, int ox, int oy, int oz, int lnx, int lny, int lnz)