Skip to main content

with_prove_pool

Function with_prove_pool 

Source
pub(crate) fn with_prove_pool<R: Send>(f: impl FnOnce() -> R + Send) -> R
Expand description

Run a proving closure in a scoped rayon thread pool sized by KIMCHI_PROVE_THREADS, falling back to the global pool when unset. Lets a long-running worker prove different tasks at different thread counts – e.g. low rayon for the many parallel base proofs, high rayon for the low-concurrency compression proofs – without rebuilding its global pool.

The thread count does not affect the proof, so this is VK-preserving.

Pools are checked out of a per-N freelist and returned after use: warm threads are reused, but concurrent proves of the same N each get their own pool (the freelist grows to the peak concurrency for that N), so parallelism is preserved.