parallelize_chunks

Function parallelize_chunks 

Source
pub fn parallelize_chunks<T, F>(v: &mut [T], chunk_size: usize, f: F)
where T: Send, F: Fn(&mut [T], usize) + Send + Sync + Clone,
Expand description

This utility function will parallelize an operation that is to be performed over a mutable slice.

Assumes that slice length is a multiple of chunk_size and parallelization preserves the chunks so each slice in a thread is still multiple of chunk_size.

The closure f takes (thread_slice, idx) where thread_slice is a sub-slice starting at v[idx].