pub struct ThreadPoolOptimizer { /* private fields */ }Expand description
Thread pool optimizer for better parallelization
Implementations§
Source§impl ThreadPoolOptimizer
impl ThreadPoolOptimizer
Sourcepub fn set_num_threads(&mut self, num_threads: usize)
pub fn set_num_threads(&mut self, num_threads: usize)
Set number of threads
Sourcepub fn get_num_threads(&self) -> usize
pub fn get_num_threads(&self) -> usize
Get number of threads
Sourcepub fn set_affinity_enabled(&mut self, enabled: bool)
pub fn set_affinity_enabled(&mut self, enabled: bool)
Enable thread affinity
Sourcepub fn get_cache_aware_chunk_size(
&self,
total_size: usize,
element_size: usize,
) -> usize
pub fn get_cache_aware_chunk_size( &self, total_size: usize, element_size: usize, ) -> usize
Get cache-aware chunk size for optimal memory access patterns
Sourcepub fn get_optimal_chunk_size(
&self,
total_size: usize,
min_chunk_size: usize,
) -> usize
pub fn get_optimal_chunk_size( &self, total_size: usize, min_chunk_size: usize, ) -> usize
Get optimal chunk size for parallel operations (legacy method)
Sourcepub fn get_matrix_block_size(
&self,
_matrix_elements: usize,
element_size: usize,
) -> usize
pub fn get_matrix_block_size( &self, _matrix_elements: usize, element_size: usize, ) -> usize
Calculate optimal block size for matrix operations
Sourcepub fn get_cache_aligned_size(&self, size: usize) -> usize
pub fn get_cache_aligned_size(&self, size: usize) -> usize
Get cache line aligned size
Sourcepub fn parallel_for<F>(&self, range: Range<usize>, op: F)
pub fn parallel_for<F>(&self, range: Range<usize>, op: F)
Execute parallel operation with optimal chunking
Sourcepub fn parallel_for_cache_aware<F>(
&self,
range: Range<usize>,
element_size: usize,
op: F,
)
pub fn parallel_for_cache_aware<F>( &self, range: Range<usize>, element_size: usize, op: F, )
Execute cache-aware parallel operation with memory locality optimization
Sourcepub fn parallel_map<T, R, F>(&self, data: &[T], op: F) -> Vec<R>
pub fn parallel_map<T, R, F>(&self, data: &[T], op: F) -> Vec<R>
Execute parallel map operation with cache-aware chunking
Sourcepub fn parallel_matrix_blocks<F>(
&self,
rows: usize,
cols: usize,
element_size: usize,
op: F,
)
pub fn parallel_matrix_blocks<F>( &self, rows: usize, cols: usize, element_size: usize, op: F, )
Cache-aware parallel matrix multiplication block processing
Sourcepub fn parallel_reduce<T, F, R, C>(
&self,
data: &[T],
identity: R,
map_op: F,
reduce_op: C,
) -> R
pub fn parallel_reduce<T, F, R, C>( &self, data: &[T], identity: R, map_op: F, reduce_op: C, ) -> R
Parallel reduction with work stealing optimization
Sourcepub fn get_work_stealing_stats(&self) -> (f64, f64)
pub fn get_work_stealing_stats(&self) -> (f64, f64)
Get work stealing statistics
Sourcepub fn reset_stats(&self)
pub fn reset_stats(&self)
Reset work stealing statistics
Sourcepub fn get_cache_info(&self) -> (usize, usize, usize)
pub fn get_cache_info(&self) -> (usize, usize, usize)
Get cache information
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ThreadPoolOptimizer
impl !UnwindSafe for ThreadPoolOptimizer
impl Freeze for ThreadPoolOptimizer
impl Send for ThreadPoolOptimizer
impl Sync for ThreadPoolOptimizer
impl Unpin for ThreadPoolOptimizer
impl UnsafeUnpin for ThreadPoolOptimizer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more