PERF-2 P2: the red-black colour maps, the residual and the V-cycle's per-level maps on rayon threads (MultigridParameters::threads; RTX_THREADS in the harness; rtx_cfd::configure_threads) — each colour's values computed from the unchanged other colour into a scratch and written back, the L1 sum in the serial order: bit-identical to the serial red-black (pin: 4 right-hand sides at 4 threads); the coarsest level stays serial; no effect on the lexicographic regime
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
Performance Benchmarks / Run Benchmarks (push) Failing after 7s
CI / Clippy Check (push) Failing after 7s
CI / Build (ubuntu-latest) (push) Failing after 7s
Documentation / Build User Guide (push) Successful in 7s
CI / Build CPU-Only (Explicit) (push) Failing after 1m19s
Documentation / Build API Documentation (push) Failing after 1m22s
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
Performance Benchmarks / Run Benchmarks (push) Failing after 7s
CI / Clippy Check (push) Failing after 7s
CI / Build (ubuntu-latest) (push) Failing after 7s
Documentation / Build User Guide (push) Successful in 7s
CI / Build CPU-Only (Explicit) (push) Failing after 1m19s
Documentation / Build API Documentation (push) Failing after 1m22s
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01YJPeT6WA2e7YvAnS875AHL
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
364766a54a
commit
7f144e0005
@@ -6,8 +6,8 @@
|
||||
//! red-black solve (the cache keys on the smoother).
|
||||
|
||||
use rtx_cfd::solvers::incompressible::{
|
||||
MgSmoother, MultigridParameters, PcgCache, PoissonProblem, solve_multigrid_pcg,
|
||||
solve_multigrid_pcg_cached,
|
||||
MgSmoother, MultigridParameters, PcgCache, PoissonProblem, configure_threads,
|
||||
solve_multigrid_pcg, solve_multigrid_pcg_cached,
|
||||
};
|
||||
|
||||
fn problem(nx: usize, ny: usize, seed: u64) -> PoissonProblem {
|
||||
@@ -106,3 +106,35 @@ fn red_black_solves_the_masked_problem_and_caches_exactly() {
|
||||
assert!(a.iter().zip(&b).all(|(x, y)| x.to_bits() == y.to_bits()));
|
||||
assert_eq!(sa.iterations, sb.iterations);
|
||||
}
|
||||
|
||||
/// The threaded red-black V-cycle (colour maps, residual on threads) is the
|
||||
/// serial red-black one bit for bit — the same per-cell arithmetic from the
|
||||
/// same inputs, the sums in the same order.
|
||||
#[test]
|
||||
fn threaded_red_black_is_the_serial_red_black_bit_for_bit() {
|
||||
let (nx, ny) = (96, 40);
|
||||
configure_threads(4);
|
||||
for k in 0..4u64 {
|
||||
let prob = problem(nx, ny, 31 + k);
|
||||
let serial = MultigridParameters {
|
||||
smoother: MgSmoother::RedBlack,
|
||||
threads: 1,
|
||||
..MultigridParameters::default()
|
||||
};
|
||||
let threaded = MultigridParameters {
|
||||
smoother: MgSmoother::RedBlack,
|
||||
threads: 4,
|
||||
..MultigridParameters::default()
|
||||
};
|
||||
let (mut a, mut b) = (vec![0.0; nx * ny], vec![0.0; nx * ny]);
|
||||
let sa = solve_multigrid_pcg(&prob, &mut a, &serial, 1e-12, None);
|
||||
let sb = solve_multigrid_pcg(&prob, &mut b, &threaded, 1e-12, None);
|
||||
assert!(sa.converged && sb.converged);
|
||||
assert_eq!(sa.iterations, sb.iterations, "rhs {k}");
|
||||
assert!(
|
||||
a.iter().zip(&b).all(|(x, y)| x.to_bits() == y.to_bits()),
|
||||
"rhs {k}: threaded red-black differs from serial"
|
||||
);
|
||||
}
|
||||
println!(" threaded red-black: 4 right-hand sides bit-identical to serial at 4 threads");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user