Module reduction

Module reduction 

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

CooperativeBarrier
Helper to create a cooperative sync barrier
GlobalReduction
Global reduction tracker for K2K coordination
InterPhaseReduction
Inter-phase reduction state
ReductionBuilder
Builder for reduction operations
ReductionConfig
Configuration for inter-phase reduction

Enums§

PhaseState
Phase state for multi-phase reductions
ReductionError
Reduction errors
ReductionOp
Reduction operation type
SyncMode
Synchronization mode for multi-phase reductions