Expand description
Reduction Primitives
Provides GPU reduction operations and multi-phase kernel synchronization for iterative algorithms like PageRank, K-Means, and graph analytics.
§Reduction Modes
- Single-pass: Simple reductions completed in one kernel launch
- Multi-phase: Complex reductions requiring intermediate storage
- Cooperative: GPU-wide synchronization using cooperative groups
§Sync Modes
- Cooperative: Use CUDA cooperative groups for grid-wide sync
- SoftwareBarrier: Software-based barrier with atomic operations
- MultiLaunch: Separate kernel launches per phase
§Example
ⓘ
use rustkernel_core::memory::reduction::{InterPhaseReduction, SyncMode};
let reduction = InterPhaseReduction::<f64>::new(1000, SyncMode::Cooperative);
// Phase 1: Local reduction
reduction.phase_start(0);
// ... kernel execution ...
reduction.phase_complete(0);
// Phase 2: Global reduction
reduction.phase_start(1);
// ... kernel execution ...
let result = reduction.finalize();Structs§
- Cooperative
Barrier - Helper to create a cooperative sync barrier
- Global
Reduction - Global reduction tracker for K2K coordination
- Inter
Phase Reduction - Inter-phase reduction state
- Reduction
Builder - Builder for reduction operations
- Reduction
Config - Configuration for inter-phase reduction
Enums§
- Phase
State - Phase state for multi-phase reductions
- Reduction
Error - Reduction errors
- Reduction
Op - Reduction operation type
- Sync
Mode - Synchronization mode for multi-phase reductions