Module parallel_ops

Module parallel_ops 

Source
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§

ThreadPool
Represents a user-created thread pool.
ThreadPoolBuilder
Used to create a new ThreadPool or to configure the global rayon thread pool.

Traits§

FromParallelIterator
FromParallelIterator implements the creation of a collection from a ParallelIterator. By implementing FromParallelIterator for a given type, you define how it will be created from an iterator.
IndexedParallelIterator
An iterator that supports “random access” to its data, meaning that you can split it at arbitrary indices and draw data from those points.
IntoParallelIterator
IntoParallelIterator implements the conversion to a ParallelIterator.
IntoParallelRefIterator
IntoParallelRefIterator implements the conversion to a ParallelIterator, providing shared references to the data.
IntoParallelRefMutIterator
IntoParallelRefMutIterator implements the conversion to a ParallelIterator, providing mutable references to the data.
ParallelBridge
Conversion trait to convert an Iterator to a ParallelIterator.
ParallelDrainFull
ParallelDrainFull creates a parallel iterator that moves all items from a collection while retaining the original capacity.
ParallelDrainRange
ParallelDrainRange creates a parallel iterator that moves a range of items from a collection while retaining the original capacity.
ParallelExtend
ParallelExtend extends an existing collection with items from a ParallelIterator.
ParallelIterator
Parallel version of the standard iterator trait.
ParallelSlice
Parallel extensions for slices.
ParallelSliceMut
Parallel extensions for mutable slices.
ParallelString
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 s and invokes the closure with a reference to s. This closure can then spawn asynchronous tasks into s. Those tasks may run asynchronously with respect to the closure; they may themselves spawn additional tasks into s. When the closure returns, it will block until all tasks that have been spawned into s complete.
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