Skip to main content

Module parallel_orchestrator

Module parallel_orchestrator 

Source
Expand description

Parallel solver orchestration for multi-stage physics pipelines.

This module provides a dependency-aware scheduler that organizes solver stages into parallel waves via topological sorting. Stages within the same wave have no mutual dependencies and can conceptually execute in parallel, while stages in later waves depend on earlier ones.

§Architecture

The orchestrator works in three phases:

  1. Registration - stages and their dependencies are added via ParallelOrchestrator::add_stage.
  2. Scheduling - ParallelOrchestrator::compute_schedule performs a topological sort to group independent stages into waves (Kahn’s algorithm with cycle detection).
  3. Execution - ParallelOrchestrator::execute runs each wave sequentially, executing stages within each wave. Per-stage wall-clock timings are accumulated.

§Future: rayon-based parallelism

Currently stages within a wave run sequentially. When rayon is added as a workspace dependency, intra-wave parallelism can be enabled behind a feature flag (e.g. parallel-rayon) by replacing the sequential loop with rayon::scope or rayon::join.

Structs§

ParallelOrchestrator
Orchestrates the execution of multiple solver stages respecting dependencies.
PipelineSchedule
A computed execution schedule produced by topological sorting.
StageDependency
Describes ordering constraints for a single stage.

Enums§

OrchestratorError
Errors that can occur during orchestration scheduling or execution.

Traits§

SolverStage
A single stage in a physics solver pipeline.

Functions§

topological_sort
Performs a topological sort of n stages using Kahn’s algorithm.