pub fn run_parallel<R, F>(work: F) -> RExpand description
Run work under the active thermal policy, throttling parallelism to the
thermal cap only when appropriate.
Wrap a parallel kernel’s body in this. The rules:
- cap ≥ cores (
max-perf/--threads ≥ N): run on the full global pool. - already inside a rayon worker (nested call): run inline on the current
pool — never nest-
install(avoids surprising thread fan-out / blocking). adaptive(default): full width during a burst, throttle once load is sustained ([decide_sustained]).adaptive == false: always throttle to the cap (fixed, reproducible).
Throttling means install-ing into the [capped_pool], inside which
rayon::current_num_threads() reports the cap — so existing chunkers that
size their work to the live thread count auto-scale. Determinism is
preserved: the choice of pool changes only how many bands/rows run
concurrently, never the per-element math (reductions keep their fixed
within-row order), so output is bit-identical regardless of this decision.