PERF-2 P3 bench: per-level comparison of the device V-cycle's work vectors against the CPU's (vcycle_f32_work) to locate the disagreement
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 / Build (ubuntu-latest) (push) Failing after 5s
CI / Build CPU-Only (Explicit) (push) Failing after 5s
Documentation / Build API Documentation (push) Failing after 5s
CI / Format Check (push) Failing after 11s
CI / Clippy Check (push) Failing after 14s
Documentation / Build User Guide (push) Successful in 11s
Performance Benchmarks / Run Benchmarks (push) Successful in 22s

This commit is contained in:
Omar Sobh
2026-09-16 01:08:31 -05:00
parent cb1647c0ef
commit 06a60b5fed
3 changed files with 47 additions and 2 deletions
@@ -69,7 +69,7 @@ pub use piso::{PisoParameters, PisoResult, PisoSolver};
// pub use piso_gpu::PisoGpuSolver;
pub use poisson::{
LevelExport, MgPrecision, MgSmoother, MultigridParameters, PcgCache, PoissonProblem,
PoissonSolution, export_hierarchy, vcycle_f32_reference,
PoissonSolution, export_hierarchy, vcycle_f32_reference, vcycle_f32_work,
PoissonSolverKind, configure_threads, solve_multigrid_pcg, solve_multigrid_pcg_cached,
};
pub use polygon_sdf::PolygonSdf;
@@ -1094,6 +1094,24 @@ pub fn vcycle_f32_reference(
hier.apply_preconditioner(r, z);
}
/// The f32 V-cycle's per-level work vectors after one application on `r`
/// (for locating where a device V-cycle departs from the CPU one): per
/// level `(b, x, r)` — the restricted right-hand side, the level's final
/// correction (after its up-leg smoothing), and its down-leg residual.
pub fn vcycle_f32_work(
problem: &PoissonProblem,
params: &MultigridParameters,
r: &[f64],
) -> Vec<(Vec<f32>, Vec<f32>, Vec<f32>)> {
let mut hier = Hierarchy::<f32>::build(problem, params);
let mut z = vec![0.0; r.len()];
hier.apply_preconditioner(r, &mut z);
hier.work
.iter()
.map(|w| (w.b.clone(), w.x.clone(), w.r.clone()))
.collect()
}
/// A reusable prepared solver per V-cycle precision (PERF-2 P1.1): the
/// operator's hierarchy is rebuilt only when the operator changes.
#[derive(Default)]