Function lattice_qcd_rs::thread::run_pool_parallel_rayon
source · pub fn run_pool_parallel_rayon<Key, Data, CommonData, F>(
iter: impl Iterator<Item = Key> + Send,
common_data: &CommonData,
closure: F
) -> Vec<Data>where
CommonData: Sync,
Key: Eq + Send,
Data: Send,
F: Sync + Fn(&Key, &CommonData) -> Data,
Expand description
Run a parallel pool using external crate [rayon
].
Example.
let iter = 0..1000;
let c = 5;
let result = run_pool_parallel_rayon(iter, &c, |i, c1| i * i * c1);
assert_eq!(result[687], 687 * 687 * c);
assert_eq!(result[10], 10 * 10 * c);
Panic.
panic if the closure panic at any point during the evaluation
ⓘ
let iter = 0..10;
let result = run_pool_parallel_rayon(iter, &(), |_, _| panic!("message"));