Expand description
Parallel operations abstraction layer
This module provides a unified interface for parallel operations across the SciRS2 project.
It wraps Rayon functionality when the parallel feature is enabled, and provides
sequential fallbacks when it’s disabled.
§Usage
use scirs2_core::parallel_ops::*;
// Works with or without the parallel feature
let results: Vec<i32> = (0..1000)
.into_par_iter()
.map(|x| x * x)
.collect();Structs§
- Thread
Pool - Represents a user-created thread pool.
- Thread
Pool Builder - Used to create a new
ThreadPoolor to configure the global rayon thread pool.
Traits§
- From
Parallel Iterator FromParallelIteratorimplements the creation of a collection from aParallelIterator. By implementingFromParallelIteratorfor a given type, you define how it will be created from an iterator.- Indexed
Parallel Iterator - An iterator that supports “random access” to its data, meaning that you can split it at arbitrary indices and draw data from those points.
- Into
Parallel Iterator IntoParallelIteratorimplements the conversion to aParallelIterator.- Into
Parallel RefIterator IntoParallelRefIteratorimplements the conversion to aParallelIterator, providing shared references to the data.- Into
Parallel RefMut Iterator IntoParallelRefMutIteratorimplements the conversion to aParallelIterator, providing mutable references to the data.- Parallel
Bridge - Conversion trait to convert an
Iteratorto aParallelIterator. - Parallel
Drain Full ParallelDrainFullcreates a parallel iterator that moves all items from a collection while retaining the original capacity.- Parallel
Drain Range ParallelDrainRangecreates a parallel iterator that moves a range of items from a collection while retaining the original capacity.- Parallel
Extend ParallelExtendextends an existing collection with items from aParallelIterator.- Parallel
Iterator - Parallel version of the standard iterator trait.
- Parallel
Slice - Parallel extensions for slices.
- Parallel
Slice Mut - Parallel extensions for mutable slices.
- Parallel
String - Parallel extensions for strings.
Functions§
- current_
num_ threads - Alias for rayon compatibility - returns the number of threads in the current pool
- get_
num_ threads - Alias for num_threads() for compatibility
- is_
parallel_ enabled - Check if parallel processing is available
- num_
threads - Get the number of threads that would be used for parallel operations
- par_
chunks - Helper function for parallel chunks processing
- par_
chunks_ mut - Helper function for parallel mutable chunks processing
- par_
join - Parallel join helper Takes two closures and potentially runs them in parallel. It returns a pair of the results from those closures.
- par_
range - Helper function to create a parallel iterator from a range
- par_
scope - Parallel-aware scope helper
Creates a “fork-join” scope
sand invokes the closure with a reference tos. This closure can then spawn asynchronous tasks intos. Those tasks may run asynchronously with respect to the closure; they may themselves spawn additional tasks intos. When the closure returns, it will block until all tasks that have been spawned intoscomplete. - parallel_
batch_ process - Parallel batch processing with progress tracking
- parallel_
map - Simple parallel map function that returns Result type
- parallel_
map_ collect - Parallel map-collect operation on a collection
- parallel_
map_ numa_ aware - NUMA-aware parallel processing
- parallel_
map_ reduce - Parallel map operation on array data with chunking
- parallel_
map_ reduce_ indexed - Parallel map-reduce operation on indexed chunks
- parallel_
map_ result - Parallel map function that handles Results
- parallel_
map_ work_ stealing - Work-stealing parallel map for unbalanced workloads
- parallel_
matrix_ rows - Parallel matrix row operations
- parallel_
scan - Parallel scan (prefix sum) operation
- parallel_
sort - Parallel sorting with custom comparison
- parallel_
tree_ reduce - Parallel reduction with tree-based approach
- parallel_
zip - Parallel zip operation for multiple arrays
- set_
num_ threads - Set the number of threads for parallel operations