Simple work-stealing data parallelism for Rust
open sourceMIT OR Apache-2.0free
Rayon is a lightweight data-parallelism library for Rust that turns sequential computations into parallel ones, usually by changing iter() to par_iter(). Its parallel iterators decide how to split the work into tasks and adapt dynamically, backed by a work-stealing thread pool; join and scope create parallel tasks by hand, and custom thread pools replace the global one. Its APIs guarantee data-race freedom, so code that compiles generally does what the sequential version did, with side effects possibly in a different order. Dual-licensed MIT or Apache-2.0.
Problems it solves
- make a loop over a large vector in Rust use all my CPU cores
- parallelise an iterator chain in Rust without managing threads
- split recursive work like a parallel quicksort across threads safely in Rust
Features
- parallel iterators: change iter() to par_iter()
- work-stealing scheduler that adapts task splitting dynamically
- join and scope for creating parallel tasks by hand
- custom thread pools alongside the global pool
- data-race freedom guaranteed by its APIs
Alternatives
The same job
These do what Rayon does.
- Crossbeam Tools for concurrent programming in Rust: channels, queues, atomics and scoped threads
