Skip to main content

Module hybrid

Module hybrid 

Source
Expand description

§Hybrid CPU-GPU Processing

Adaptive processing that routes workloads to CPU or GPU based on size and characteristics. Small/irregular workloads use CPU (via Rayon), while bulk parallel operations use GPU.

§Decision Heuristics

Workload SizeGPU OverheadDecision
< thresholdHighCPU
>= thresholdAmortizedGPU

For irregular access patterns (sparse updates, random traversal), CPU may outperform GPU even at larger scales.

§Example

use ringkernel_core::hybrid::*;

// Define your workload
struct MyWorkload { data: Vec<f32> }

impl HybridWorkload for MyWorkload {
    type Result = Vec<f32>;

    fn workload_size(&self) -> usize { self.data.len() }
    fn execute_cpu(&self) -> Self::Result { /* ... */ }
    fn execute_gpu(&self) -> Result<Self::Result, HybridError> { /* ... */ }
}

// Create dispatcher and execute
let dispatcher = HybridDispatcher::new(HybridConfig::default());
let result = dispatcher.execute(&workload);

Structs§

HybridConfig
Configuration for hybrid processing.
HybridConfigBuilder
Builder for HybridConfig.
HybridDispatcher
Dispatcher for routing workloads between CPU and GPU.
HybridStats
Statistics for hybrid processing decisions.
HybridStatsSnapshot
A point-in-time snapshot of hybrid processing statistics.

Enums§

HybridError
Error type for hybrid processing operations.
ProcessingMode
Processing mode for hybrid execution.

Traits§

HybridWorkload
Trait for workloads that can be executed on CPU or GPU.

Type Aliases§

HybridResult
Result type for hybrid processing operations.