Expand description
Parallel execution on the rayon pool
Constants§
- PARALLEL_
MIN_ WORK - Parallel regions with less work than this, in
f64operations, run on the calling thread (dispatching to the pool would cost more than it saves). On an M1 Pro,compute_svewas fastest at about this threshold both inf64(ε ≥ 10⁻⁸) and, counting a double-double operation as 16f64ones, in double-double.
Functions§
- for_
each_ chunk - Run
f(start, chunk)over contiguous chunks ofout, wherestartis the index ofchunk[0]inout; on the thread pool whenwork(inf64operations) is large. Each element must depend only on its own index, so the result does not depend on the chunking. - map_
on_ pool [f(0), ..., f(n - 1)], one pool job per item whenwork(inf64operations, for all items) is large- n_
threads - Number of threads the parallel regions may use: that of the current
rayon pool, or 1 without the
parallelfeature or insidesequential - run_
on_ pool - Run
jobson the rayon pool and wait for all of them. Pool threads do not have the caller’s FPU state, so every job runs under it. Without theparallelfeature, or with a single thread, the jobs run in order on the calling thread. - sequential
- Run
fwith all the parallel regions it reaches on the calling thread, even with theparallelfeature (as the C API does for every call)