Expand description
Parallel execution utilities with work-stealing scheduler.
This module provides advanced parallel execution infrastructure:
- Work-stealing scheduler for dynamic load balancing
- NUMA-aware memory allocation for multi-socket systems
- Thread pool management with configurable worker counts
- Task dependencies and execution ordering
- Load balancing metrics and monitoring
§Example
ⓘ
use tensorlogic_infer::{WorkStealingScheduler, ParallelConfig, Task};
// Create a work-stealing scheduler
let config = ParallelConfig::default()
.with_num_workers(8)
.with_steal_strategy(StealStrategy::Random);
let scheduler = WorkStealingScheduler::new(config);
// Submit tasks
for task in tasks {
scheduler.submit(task)?;
}
// Execute in parallel with work stealing
let results = scheduler.execute_all()?;
// Check load balancing stats
let stats = scheduler.stats();
println!("Steal count: {}", stats.steal_count);
println!("Load balance: {:.2}%", stats.load_balance_ratio * 100.0);Structs§
- Load
Balance Stats - Load balancing statistics.
- Numa
Node - NUMA node identifier.
- Parallel
Config - Parallel execution configuration.
- Scheduler
Stats - Scheduler statistics.
- Task
- A parallel task.
- Work
Stealing Scheduler - Work-stealing scheduler.
Enums§
- Numa
Strategy - NUMA allocation strategy.
- Parallel
Error - Parallel execution errors.
- Steal
Strategy - Work-stealing strategy.
- Task
Priority - Task priority level.
Type Aliases§
- TaskId
- Task identifier.