Skip to main content

with_nested_parallel

Function with_nested_parallel 

Source
pub fn with_nested_parallel<T>(body: impl FnOnce() -> T) -> T
Expand description

Run body with the current thread marked as inside a data-parallel row region, so any faer GEMM it issues (directly or transitively) pins to Par::Seq via effective_global_parallelism instead of re-fanning the global Rayon pool. The guard is held for exactly the duration of body and dropped on return — including early ? returns from inside body, since the guard lives in this function’s frame.

Call this from the per-chunk/per-row closure of an into_par_iter whose body performs GEMM, to prevent the Rayon-pool × faer-pool oversubscription.