embedded3 S2-2b-ii: the per-step refresh exports the fine level alone (export_fine) instead of the whole hierarchy
CI / Test (macos-latest) (push) Blocked by required conditions
CI / Test (ubuntu-latest) (push) Blocked by required conditions
CI / Build (macos-latest) (push) Waiting to run
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
Documentation / Build API Documentation (push) Failing after 3s
CI / Build CPU-Only (Explicit) (push) Failing after 4s
Documentation / Build User Guide (push) Successful in 5s
CI / Format Check (push) Failing after 12s
Performance Benchmarks / Run Benchmarks (push) Successful in 2m3s
CI / Clippy Check (push) Failing after 38s
CI / Build (ubuntu-latest) (push) Failing after 1m34s
CI / Test (macos-latest) (push) Blocked by required conditions
CI / Test (ubuntu-latest) (push) Blocked by required conditions
CI / Build (macos-latest) (push) Waiting to run
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
Documentation / Build API Documentation (push) Failing after 3s
CI / Build CPU-Only (Explicit) (push) Failing after 4s
Documentation / Build User Guide (push) Successful in 5s
CI / Format Check (push) Failing after 12s
Performance Benchmarks / Run Benchmarks (push) Successful in 2m3s
CI / Clippy Check (push) Failing after 38s
CI / Build (ubuntu-latest) (push) Failing after 1m34s
Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
3eb40f98ce
commit
9c58fdf602
+3
-3
@@ -243,9 +243,9 @@ impl DeviceCg {
|
||||
self.active_host = fine.active.clone();
|
||||
self.key = OperatorKey::of(problem, params);
|
||||
// The V-cycle's finest level follows the operator (its coarser
|
||||
// levels stay).
|
||||
let levels = export_hierarchy(problem, params);
|
||||
self.vcycle.refresh_fine(&levels[0]);
|
||||
// levels stay): the fine level alone, no hierarchy build.
|
||||
let fine_level = super::export::export_fine(problem);
|
||||
self.vcycle.refresh_fine(&fine_level);
|
||||
}
|
||||
|
||||
pub fn n_cells(&self) -> usize {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
//! lists (cells, colours, the neighbour arrays, the parent map, the CSR
|
||||
//! children) and the seven coefficient arrays.
|
||||
|
||||
use super::{Hierarchy, Problem};
|
||||
use super::{Hierarchy, Level, Problem};
|
||||
use crate::solvers::incompressible::poisson::MultigridParameters;
|
||||
|
||||
/// One exported level. `top`/`bot`: the neighbour above/below each cell
|
||||
@@ -91,6 +91,40 @@ pub fn export_hierarchy(problem: &Problem, params: &MultigridParameters) -> Vec<
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// The finest level alone (its cells, colours, neighbours, the geometric
|
||||
/// parent map and coefficients; no children lists — those belong to the
|
||||
/// coarse level's restriction and stay with the kept hierarchy): what a
|
||||
/// per-step operator refresh needs, without building the hierarchy.
|
||||
pub fn export_fine(problem: &Problem) -> LevelExport {
|
||||
let lv = Level::<f32>::new(problem.clone());
|
||||
let (_, coarse_of) = lv.coarsen();
|
||||
let to_u32 = |v: &[usize]| {
|
||||
v.iter()
|
||||
.map(|&i| if i == usize::MAX { u32::MAX } else { i as u32 })
|
||||
.collect::<Vec<u32>>()
|
||||
};
|
||||
LevelExport {
|
||||
nx: lv.problem.nx,
|
||||
ny: lv.problem.ny,
|
||||
nz: lv.problem.nz,
|
||||
cells: to_u32(&lv.cells),
|
||||
red: to_u32(&lv.red),
|
||||
black: to_u32(&lv.black),
|
||||
top: to_u32(&lv.top),
|
||||
bot: to_u32(&lv.bot),
|
||||
coarse_of: to_u32(&coarse_of),
|
||||
children_ptr: Vec::new(),
|
||||
children_idx: Vec::new(),
|
||||
ae: lv.ae,
|
||||
aw: lv.aw,
|
||||
an: lv.an,
|
||||
as_: lv.as_,
|
||||
at: lv.at,
|
||||
ab: lv.ab,
|
||||
ap: lv.ap,
|
||||
}
|
||||
}
|
||||
|
||||
/// `z = M⁻¹ r` by the host f32 V-cycle: the reference a device V-cycle is measured against.
|
||||
pub fn vcycle_f32_reference(
|
||||
problem: &Problem,
|
||||
|
||||
+1
-1
@@ -206,7 +206,7 @@ impl<T: MgScalar> Level<T> {
|
||||
}
|
||||
|
||||
/// Galerkin coarsening by 2 in every direction (the 2D rule with k).
|
||||
fn coarsen(&self) -> (Problem, Vec<usize>) {
|
||||
pub(crate) fn coarsen(&self) -> (Problem, Vec<usize>) {
|
||||
let p = &self.problem;
|
||||
let (nx, ny, nz) = (p.nx, p.ny, p.nz);
|
||||
let nxc = (nx / 2).max(1);
|
||||
|
||||
Reference in New Issue
Block a user