Skip to main content

Module parallel

Module parallel 

Source
Expand description

Parallel execution on the rayon pool

Constants§

PARALLEL_MIN_WORK
Parallel regions with less work than this, in f64 operations, run on the calling thread (dispatching to the pool would cost more than it saves). On an M1 Pro, compute_sve was fastest at about this threshold both in f64 (ε ≥ 10⁻⁸) and, counting a double-double operation as 16 f64 ones, in double-double.

Functions§

for_each_chunk
Run f(start, chunk) over contiguous chunks of out, where start is the index of chunk[0] in out; on the thread pool when work (in f64 operations) 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 when work (in f64 operations, 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 parallel feature or inside sequential
run_on_pool
Run jobs on 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 the parallel feature, or with a single thread, the jobs run in order on the calling thread.
sequential
Run f with all the parallel regions it reaches on the calling thread, even with the parallel feature (as the C API does for every call)