Expand description
Deterministic parallelism for the kernel’s embarrassingly parallel stages.
The rule that makes parallelism admissible here at all: the answer must
be bit-identical at any thread count. map_ordered guarantees it
structurally: each item is computed independently from shared read-only
input, results are collected in item order, and nothing about scheduling
can reach the output. A stage that cannot meet that bar stays sequential.
The thread count comes from threads: the machine’s parallelism by
default, overridable process-wide with set_threads, including down
to one, which is also what tiny workloads collapse to on their own.
Worker threads re-install the caller’s progress watch, so cancellation
reaches into the workers.
Functions§
- map_
ordered - Map
foveritemson up tothreadsscoped threads, returning results in item order.freceives the item index and the item. - set_
threads - Set the process-wide thread count for parallel stages.
0restores the machine default. The answer never depends on this; only the wall clock does. - threads
- The thread count parallel stages will use.