embedded3 R6-2: the device classification default ON (RTX_E3_MASK_DEVICE=0 restores the host rebuild; needs the device geometry and a CUDA build)

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Omar Sobh
2026-09-24 22:25:49 -05:00
co-authored by Claude Opus 5.5
parent d9847cd818
commit 6ae5312b6f
4 changed files with 11 additions and 8 deletions
@@ -1,4 +1,4 @@
//! R6-2 (`RTX_E3_MASK_DEVICE=1`): the host mirror of a moving mask whose //! R6-2 (default ON; `RTX_E3_MASK_DEVICE=0` off): the host mirror of a moving mask whose
//! classification ran on the device. The device computes, on the changed set //! classification ran on the device. The device computes, on the changed set
//! of the step (the cells touched by either build, dilated by one) and the //! of the step (the cells touched by either build, dilated by one) and the
//! faces of those cells, exactly the values the host rebuild computes over //! faces of those cells, exactly the values the host rebuild computes over
@@ -16,11 +16,14 @@ use super::wall::{FaceKind, Mask};
use super::Grid; use super::Grid;
use rayon::prelude::*; use rayon::prelude::*;
/// `RTX_E3_MASK_DEVICE=1`, with the device geometry it requires (default /// The device classification: default ON (R6-2's two-period 3D ny 62 gate
/// ON since R6-1's gate; `RTX_E3_GEOM_DEVICE=0` turns both off). /// held 2026-09-25); `RTX_E3_MASK_DEVICE=0` restores the host rebuild. It
/// needs the device geometry (default ON; `RTX_E3_GEOM_DEVICE=0` turns both
/// off) and a CUDA build (a host-only build never keeps the arrays it needs).
#[must_use] #[must_use]
pub fn mask_device_enabled() -> bool { pub fn mask_device_enabled() -> bool {
std::env::var("RTX_E3_MASK_DEVICE").is_ok_and(|v| v == "1") cfg!(feature = "cuda")
&& !std::env::var("RTX_E3_MASK_DEVICE").is_ok_and(|v| v == "0")
&& !std::env::var("RTX_E3_GEOM_DEVICE").is_ok_and(|v| v == "0") && !std::env::var("RTX_E3_GEOM_DEVICE").is_ok_and(|v| v == "0")
} }
@@ -166,7 +166,7 @@ pub struct DeviceStep {
steps_since_hierarchy: usize, steps_since_hierarchy: usize,
/// R6-1: the persistent device cut geometry (default ON; `RTX_E3_GEOM_DEVICE=0` off). /// R6-1: the persistent device cut geometry (default ON; `RTX_E3_GEOM_DEVICE=0` off).
geom: Option<geom::DeviceGeom>, geom: Option<geom::DeviceGeom>,
/// R6-2: the device classification (`RTX_E3_MASK_DEVICE=1`). /// R6-2: the device classification (default ON, `RTX_E3_MASK_DEVICE=0` off).
dmask: Option<mask::DeviceMask>, dmask: Option<mask::DeviceMask>,
} }
@@ -1,5 +1,5 @@
//! R6-2: the moving mask's classification on the device (`e3_mask.cu`), //! R6-2: the moving mask's classification on the device (`e3_mask.cu`),
//! behind `RTX_E3_MASK_DEVICE=1` (which needs `RTX_E3_GEOM_DEVICE=1`). After //! default ON (`RTX_E3_MASK_DEVICE=0` off; needs the device geometry). After
//! the device geometry of the step (R6-1), the changed set, the faces of the //! the device geometry of the step (R6-1), the changed set, the faces of the
//! changed cells, the kinds, the step apertures and open flags, the space-time //! changed cells, the kinds, the step apertures and open flags, the space-time
//! activity, the merging masters, the centroid shifts, the GCL wall-flux //! activity, the merging masters, the centroid shifts, the GCL wall-flux
@@ -102,7 +102,7 @@ struct Apertures {
unsafe impl DeviceRepr for Apertures {} unsafe impl DeviceRepr for Apertures {}
unsafe impl ValidAsZeroBits for Apertures {} unsafe impl ValidAsZeroBits for Apertures {}
/// `RTX_E3_MASK_DEVICE=1` with `RTX_E3_GEOM_DEVICE=1`. /// Default ON (`RTX_E3_MASK_DEVICE=0` off); needs the device geometry.
pub(super) fn enabled() -> bool { pub(super) fn enabled() -> bool {
crate::solvers::incompressible::embedded3::maskupdate::mask_device_enabled() crate::solvers::incompressible::embedded3::maskupdate::mask_device_enabled()
} }
@@ -305,7 +305,7 @@ pub struct Solver {
pub(super) geom_pool: super::cut::GeomPool, pub(super) geom_pool: super::cut::GeomPool,
pub(super) apertures_old_gen: u64, pub(super) apertures_old_gen: u64,
/// R6-2: the next moving rebuild's classification, computed on the /// R6-2: the next moving rebuild's classification, computed on the
/// device (`RTX_E3_MASK_DEVICE=1`); `rebuild_moving_mask` assembles the /// device (default ON, `RTX_E3_MASK_DEVICE=0` off); `rebuild_moving_mask` assembles the
/// mask from it instead of classifying the whole grid. /// mask from it instead of classifying the whole grid.
pub(super) pending_mask: Option<super::maskupdate::MaskUpdate>, pub(super) pending_mask: Option<super::maskupdate::MaskUpdate>,
/// R6-2: the instantaneous arrays of the mask retired at the previous /// R6-2: the instantaneous arrays of the mask retired at the previous