Skip to main content

REDUCTION_CHUNK

Constant REDUCTION_CHUNK 

Source
pub const REDUCTION_CHUNK: usize = 4096;
Expand description

Number of consecutive elements summed sequentially inside one chunk of a parallel reduction.

The reductions cut the field into chunks of exactly this many elements, sum each chunk in index order, then combine the partial sums in index order. Fixing this at a compile-time constant — rather than deriving it from the thread count — is what makes the parallel reduction bit-reproducible and thread-count independent (see the module-level “Reduction determinism” section).

Value: 4096 elements, i.e. 32 KiB of f64, which sits comfortably inside a typical L1/L2 data cache so a chunk is summed without cache misses. The final chunk is shorter when the length is not a multiple of 4096; that does not affect reproducibility because the split is still a pure function of the length.