embedded3 PERF-3 P1-1: the moving path's host work, digit-identical — impose_from's solid faces by z plane in parallel (1.95 -> 0.62 s per step at 11.6 M cells), the f32 fine export derived from the f64 level the refresh already builds (export_fine 1.04 -> 0.34 s); sub-laps in the mask rebuild; rebuild block 9.4 -> 7.4 s
Documentation / Build User Guide (push) Successful in 5s
Documentation / Build API Documentation (push) Failing after 7s
CI / Build CPU-Only (Explicit) (push) Failing after 8s
CI / Format Check (push) Failing after 12s
CI / Build (ubuntu-latest) (push) Failing after 1m51s
CI / Clippy Check (push) Failing after 2m5s
Performance Benchmarks / Run Benchmarks (push) Successful in 2m45s
CI / Build (macos-latest) (push) Canceled after 0s
CI / Test (macos-latest) (push) Canceled after 0s
CI / Test (ubuntu-latest) (push) Canceled after 0s
CI / Python Bindings (maturin) (macos-latest) (push) Canceled after 0s
CI / Python Bindings (maturin) (ubuntu-latest) (push) Canceled after 0s
CI / WASM Build + Size Check (push) Canceled after 0s
CI / Distributed Training Tests (push) Canceled after 0s
CI / CI Success (push) Canceled after 0s

Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
Omar Sobh
2026-09-19 15:59:19 -05:00
co-authored by Claude Fable 5.1
parent 103e2576ae
commit 40268ad19b
4 changed files with 102 additions and 46 deletions
@@ -5,6 +5,7 @@
use super::body::Body;
use super::wall::{FaceKind, Mask};
use rayon::prelude::*;
/// The imposition band of a cut mask, in cells.
pub(crate) const IMPOSE_BAND_CELLS: f64 = 4.0;
@@ -52,55 +53,70 @@ impl Mask {
Some(c) => (&c.d_u, &c.d_v, &c.d_w),
None => (&[], &[], &[]),
};
for k in 0..nz {
for j in 0..ny {
for i in 1..nx {
let idx = g.uface(k, j, i);
if self.u_kind[idx] == FaceKind::Solid && near(d_u, idx) {
u[idx] = body
.surface_velocity(
i as f64 * dx,
(j as f64 + 0.5) * dy,
(k as f64 + 0.5) * dz,
t,
)
.0;
// One z plane per task: every solid face is written from the body's
// surface velocity alone (no reduction), so the parallel loop is
// digit-identical to the serial one (PERF-3 P1-1: 1.95 s of a 9.4 s
// step at 11.6 M cells, serial).
u.par_chunks_mut(ny * (nx + 1))
.take(nz)
.enumerate()
.for_each(|(k, plane)| {
for j in 0..ny {
for i in 1..nx {
let idx = g.uface(k, j, i);
if self.u_kind[idx] == FaceKind::Solid && near(d_u, idx) {
plane[j * (nx + 1) + i] = body
.surface_velocity(
i as f64 * dx,
(j as f64 + 0.5) * dy,
(k as f64 + 0.5) * dz,
t,
)
.0;
}
}
}
}
for j in 1..ny {
for i in 0..nx {
let idx = g.vface(k, j, i);
if self.v_kind[idx] == FaceKind::Solid && near(d_v, idx) {
v[idx] = body
.surface_velocity(
(i as f64 + 0.5) * dx,
j as f64 * dy,
(k as f64 + 0.5) * dz,
t,
)
.1;
});
v.par_chunks_mut((ny + 1) * nx)
.take(nz)
.enumerate()
.for_each(|(k, plane)| {
for j in 1..ny {
for i in 0..nx {
let idx = g.vface(k, j, i);
if self.v_kind[idx] == FaceKind::Solid && near(d_v, idx) {
plane[j * nx + i] = body
.surface_velocity(
(i as f64 + 0.5) * dx,
j as f64 * dy,
(k as f64 + 0.5) * dz,
t,
)
.1;
}
}
}
}
}
for k in 0..=nz {
for j in 0..ny {
for i in 0..nx {
let idx = g.wface(k, j, i);
if self.w_kind[idx] == FaceKind::Solid && near(d_w, idx) {
w[idx] = body
.surface_velocity(
(i as f64 + 0.5) * dx,
(j as f64 + 0.5) * dy,
k as f64 * dz,
t,
)
.2;
});
w.par_chunks_mut(ny * nx)
.take(nz + 1)
.enumerate()
.for_each(|(k, plane)| {
for j in 0..ny {
for i in 0..nx {
let idx = g.wface(k, j, i);
if self.w_kind[idx] == FaceKind::Solid && near(d_w, idx) {
plane[j * nx + i] = body
.surface_velocity(
(i as f64 + 0.5) * dx,
(j as f64 + 0.5) * dy,
k as f64 * dz,
t,
)
.2;
}
}
}
}
}
});
let u_vals: Vec<f64> = self
.u_ghosts
.iter()