Skip to main content

Module parallel

Module parallel 

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

LoadBalanceStats
Load balancing statistics.
NumaNode
NUMA node identifier.
ParallelConfig
Parallel execution configuration.
SchedulerStats
Scheduler statistics.
Task
A parallel task.
WorkStealingScheduler
Work-stealing scheduler.

Enums§

NumaStrategy
NUMA allocation strategy.
ParallelError
Parallel execution errors.
StealStrategy
Work-stealing strategy.
TaskPriority
Task priority level.

Type Aliases§

TaskId
Task identifier.