PERF-2 P0: intra-step profiler — StepTimers on the overset solver (RTX_PROFILE; overlap build / predictors / patch BiCGSTAB / background Poisson with its setup-vs-iterate split / round exchange / apply / end exchange), PoissonSolution carries setup_ns and iterate_ns, the harness times advance / restore / snapshot / load sampling / force / FEA predictor and prints the wall split of the coupled phase; no clock is read when profiling is off; the reclassified/step progress denominator fixed (was ×4)
CI / Build (macos-latest) (push) Waiting to run
CI / Test (macos-latest) (push) Blocked by required conditions
CI / Test (ubuntu-latest) (push) Blocked by required conditions
CI / Python Bindings (maturin) (macos-latest) (push) Blocked by required conditions
CI / Python Bindings (maturin) (ubuntu-latest) (push) Blocked by required conditions
CI / WASM Build + Size Check (push) Blocked by required conditions
CI / Distributed Training Tests (push) Blocked by required conditions
CI / CI Success (push) Blocked by required conditions
CI / Format Check (push) Failing after 6s
CI / Build (ubuntu-latest) (push) Failing after 5s
CI / Clippy Check (push) Failing after 5s
Documentation / Build User Guide (push) Successful in 6s
Performance Benchmarks / Run Benchmarks (push) Failing after 27s
CI / Build CPU-Only (Explicit) (push) Failing after 1m24s
Documentation / Build API Documentation (push) Failing after 1m34s

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01YJPeT6WA2e7YvAnS875AHL
This commit is contained in:
Omar Sobh
2026-09-15 22:25:52 -05:00
co-authored by Claude Fable 5.1
parent 2d2fed7181
commit 172a26dee4
11 changed files with 223 additions and 40 deletions
@@ -41,7 +41,7 @@ mod projection;
use super::ale::{AleBoundaries, SideBoundary};
use super::embedded_body::{EmbeddedBody, EmbeddedMask, FaceKind};
use super::poisson::{
solve_multigrid_pcg, MgPrecision, MultigridParameters, PoissonProblem, PoissonSolverKind,
MgPrecision, MultigridParameters, PoissonProblem, PoissonSolverKind, solve_multigrid_pcg,
};
use super::simple::ConvectionScheme;
use super::{FlowField, SolverResult};
@@ -168,6 +168,9 @@ pub struct EmbeddedPisoSolver {
/// (measured: at 1e-2 the first corrector's rounds never settled below
/// a 1e-3 relative change — 20/20 rounds every step).
inner_stop_factor: f64,
/// PERF-2 P0: Poisson `(setup ns, iterate ns, calls)` summed over
/// every multigrid-PCG solve (`docs/perf2_campaign.md`).
poisson_profile: std::cell::Cell<(u64, u64, u64)>,
moving: bool,
/// Mask hysteresis band in multiples of the min cell size (0 = off).
mask_hysteresis: f64,
@@ -194,6 +197,7 @@ impl EmbeddedPisoSolver {
fringe: None,
fringe_correction: Vec::new(),
inner_stop_factor: 1e-2,
poisson_profile: std::cell::Cell::new((0, 0, 0)),
moving: false,
mask_hysteresis: 0.0,
time: 0.0,
@@ -290,6 +294,11 @@ impl EmbeddedPisoSolver {
}
/// Relative part of the pressure solve's inner stop (see the field).
/// The Poisson solves' `(setup ns, iterate ns, calls)` so far.
pub fn poisson_profile(&self) -> (u64, u64, u64) {
self.poisson_profile.get()
}
pub fn set_inner_stop_factor(&mut self, factor: f64) {
self.inner_stop_factor = factor;
}
@@ -4,12 +4,12 @@
//! meshes before applying the correction once.
use super::EmbeddedPisoSolver;
use crate::CfdResult;
use crate::solvers::incompressible::ale::SideBoundary;
use crate::solvers::incompressible::poisson::{
solve_multigrid_pcg, MultigridParameters, PoissonProblem, PoissonSolverKind,
MultigridParameters, PoissonProblem, PoissonSolverKind, solve_multigrid_pcg,
};
use crate::solvers::incompressible::{EmbeddedMask, FlowField};
use crate::CfdResult;
impl EmbeddedPisoSolver {
/// The pressure-correction system of one projection as a
@@ -304,6 +304,9 @@ impl EmbeddedPisoSolver {
inner_stop,
anchor_cell,
);
let (s0, i0, c0) = self.poisson_profile.get();
self.poisson_profile
.set((s0 + solution.setup_ns, i0 + solution.iterate_ns, c0 + 1));
// Unconverged: fall back to the SOR sweeps for this projection
// rather than apply a correction that did not reach the stop.
multigrid_converged = solution.converged;
@@ -337,44 +340,28 @@ impl EmbeddedPisoSolver {
// prescribed: a domain side with velocity data, or a
// non-fluid interior face.
let ae = if i + 1 == nx {
if b.right == outlet {
ae_outlet
} else {
0.0
}
if b.right == outlet { ae_outlet } else { 0.0 }
} else if self.u_is_fluid(j, i + 1) {
ae_interior
} else {
0.0
};
let aw = if i == 0 {
if b.left == outlet {
ae_outlet
} else {
0.0
}
if b.left == outlet { ae_outlet } else { 0.0 }
} else if self.u_is_fluid(j, i) {
ae_interior
} else {
0.0
};
let an = if j + 1 == ny {
if b.top == outlet {
an_outlet
} else {
0.0
}
if b.top == outlet { an_outlet } else { 0.0 }
} else if self.v_is_fluid(j + 1, i) {
an_interior
} else {
0.0
};
let as_ = if j == 0 {
if b.bottom == outlet {
an_outlet
} else {
0.0
}
if b.bottom == outlet { an_outlet } else { 0.0 }
} else if self.v_is_fluid(j, i) {
an_interior
} else {