|
flow 1.4.0
Kokkos cut-cell IBM incompressible Navier-Stokes solver + pnm pore extraction
|
ctest mg_fp32_vcycle: the FP32 V-cycle preconditioner's data, eligibility and kernels (doc/vof_projection_cost_design.md §4, gate G-D1 of §13). More...
#include <algorithm>#include <cmath>#include <cstdio>#include <cstdlib>#include <cstring>#include <Kokkos_Core.hpp>#include <random>#include <stdexcept>#include <string>#include <vector>#include "mac_cutcell_mg.hpp"#include "mg_fp32_problems.hpp"Go to the source code of this file.
Functions | |
| int | main (int argc, char **argv) |
ctest mg_fp32_vcycle: the FP32 V-cycle preconditioner's data, eligibility and kernels (doc/vof_projection_cost_design.md §4, gate G-D1 of §13).
Problems (single rank; the face coefficient handed to setOpenness is c_f = open_f / rho_f with rho_f the arithmetic face mean, the form the projection builds): column 128x96x64, walls on y, x and z periodic: the bubble column's grid with five gas spheres at rho_g / rho_l = 0.02 (a synthetic stand-in for the VoF case's field); cyl 32^3 periodic, the probe's cylinder along y (R = 0.25 N) with face openness clamp(0.5 + sdf, 0, 1) at the face centre, and a sharp heavy blob at ratio 1e4; pack 64^3, walls on z: a 4x4x4 lattice of spheres (R = 6.5, deterministic jitter) with the same face openness, and a sharp heavy slab (z < 32) at ratio 1e4 (a synthetic stand-in for the probe's packing_ring.vti bed, which a C++ ctest cannot read). Checks, on every non-bottom level of each problem: (b) |u^T W v - v^T W u| <= 1e-6 |u| |v| max D for 10 random pairs (W: the flux form on the stored FP32 weights, evaluated in long double on the host); (c) max_f |w_f / t_f - 1| <= 2^-24 (t_f = open_f * gf from the level's own operands), and the FP32 decoupled set (all six weights 0) equals the FP64 AC < 1e-30 set; the setter's rebuild from the stored openness gives the fused build's weights bitwise; an 'fp64' hierarchy allocates no FP32 data; (d) eligibility is false (and names the condition) on an outflow, an overlay, an odd-dimension and a single-level configuration and on a face weight below 1e-30 (the distributed case is checked in the MPI ctest cutcellmg_aniso_mpi); (f) the default is 'auto' (WO-F, USER 2026-10-19) and its solve is bitwise the explicit 'auto' solve; on a host backend it builds no FP32 data; on the ineligible outflow and odd-dimension configurations a PCG solve with 'fp32' raises, naming the condition; 'auto' (opt-in) is bitwise (x, iterations, reported precision) to 'fp32' on an eligible configuration (to 'fp64' on a host backend: 'auto' is FP32 on device backends only, doc/vof_projection_distributed_design.md WO-A) and to 'fp64' on the outflow, odd-dimension and face-range ones (the last also with the exact outer, i.e. through the D5 deferral: FP32 data built, the FP64 data rebuilt on demand); (a) the FP32 residual of x = c * 1, b = 0 is exactly 0 for c in {1, -3.7, 1e5, 2^-60}; (e) host: one FP32 smoother colour pass and the FP32 residual equal a scalar plain-float reference of §4.4.3 bitwise (device: within 1e-5 relative – the device contracts FMAs); G-D2 (a) scale covariance B(2^k r) = 2^k B(r) bitwise for k in {-40, 0, 37}, and (d) the nonlinearity |B(r1 + r2) - B r1 - B r2|_2 / |B r1|_2 <= 1e-4 on the column's level 0 (B = one FP32 V-cycle as the PCG applies it); the FP32 / FP64 V-cycle difference is printed for the record; G-D3 (b)-(e) on the three problems, PCG and FCG, 'fp32' against 'fp64' on the same build: (a) iterations <= fp64 + max(1, 5 %) at rtol 1e-8 (cap 200); (b) the attainable floor (rtol 1e-14, cap 300) <= 2x fp64's; (c) at exit max|P(b - A x)| / max|P b| <= 1.5 rtol; (d) no capped solve where fp64 converges, no failure flag ((a), (c), (d), (e) only where fp64 converges: rulings 2026-10-15, design §13 G-D3, §15 R-4); (e) the health ratio |r_{k+1}^T z_k| / |r_{k+1}^T z_{k+1}| (setHealthTrace): fp32's per-solve median <= max(1.1x fp64's, 1e-2) (ruling 2026-10-15: the absolute 1e-2 of §13 G-D3 is unattainable by the trilinear FP64 V-cycle itself, so relative; since the symmetric V-cycle became the default (doc/mg_depth_policy.md A3) fp64's ratio is round-off, 2e-15..3e-13, and fp32's is FP32 rounding, 2e-8..2e-7 measured, so the design's absolute 1e-2 is the floor). G-K1 (doc/vof_projection_distributed_design.md §8): the distributed launch forms of the FP32 smoother and residual (box kernels, plain offsets, ghosts filled by fillWrap) are bitwise the in-kernel wrap kernels on every non-bottom level of column, cyl, pack and a 64^3 periodic box, and an interior + shell split equals one full-box pass. D5 (§4.4.7): the deferred FP64 V-cycle data are built on demand, bitwise the eager build, by a run-time switch to 'fp64', a non-exact apply and (review E0/X1 finding 1) a projected-guess solve (E, §5.3) whose fused guess matvec is the first reader after the exact outer is turned off.
Definition in file test_mg_fp32_vcycle.cpp.
| int main | ( | int | argc, |
| char ** | argv ) |
Definition at line 836 of file test_mg_fp32_vcycle.cpp.
References peclet_flow_fp32_problems::boxProblem(), peclet_flow_fp32_problems::columnProblem(), peclet_flow_fp32_problems::cylProblem(), fails, peclet_flow_fp32_problems::packProblem(), peclet_flow_fp32_problems::slabProblem(), and solverChecks().