Skip to main content

DataParallel

Trait DataParallel 

Source
pub trait DataParallel {
    // Required methods
    fn for_each_indexed<C, F>(
        &self,
        priority: Priority,
        locality_hint: Option<usize>,
        count: usize,
        task: F,
    ) -> ExecutorResult<()>
       where C: WorkClass,
             F: Fn(usize) + Send + Sync;
    fn map_reduce_indexed<C, T, Map, Reduce>(
        &self,
        priority: Priority,
        locality_hint: Option<usize>,
        count: usize,
        identity: T,
        map: Map,
        reduce: Reduce,
    ) -> ExecutorResult<T>
       where C: WorkClass,
             T: Send + Clone,
             Map: Fn(usize) -> T + Send + Sync,
             Reduce: Fn(T, T) -> T + Send + Sync;
}
Expand description

Indexed data-parallel fan-out without per-item result storage.

Calls partition non-empty domains across the available worker-plus-caller lanes. Operation-level execution policies own profitability thresholds before invoking this scheduler seam.

Required Methods§

Source

fn for_each_indexed<C, F>( &self, priority: Priority, locality_hint: Option<usize>, count: usize, task: F, ) -> ExecutorResult<()>
where C: WorkClass, F: Fn(usize) + Send + Sync,

Apply task to every index in 0..count, completing before return.

§Errors

Returns an ExecutorError if the scheduler is draining or a chunk panics.

Source

fn map_reduce_indexed<C, T, Map, Reduce>( &self, priority: Priority, locality_hint: Option<usize>, count: usize, identity: T, map: Map, reduce: Reduce, ) -> ExecutorResult<T>
where C: WorkClass, T: Send + Clone, Map: Fn(usize) -> T + Send + Sync, Reduce: Fn(T, T) -> T + Send + Sync,

Map every index in 0..count and reduce the results with identity as the neutral element of reduce.

§Errors

Returns an ExecutorError if the scheduler is draining or a chunk panics.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<const BLOCKING_QUEUE_CAPACITY: usize, const SPIN_LIMIT: usize> DataParallel for ThreadScheduler<BLOCKING_QUEUE_CAPACITY, SPIN_LIMIT>