tile
Safe HaskellNone
LanguageGHC2024

Tile.Execution

Description

These functions interpret divergence schedules as pure results. A divergence schedule has edges directed from root toward leaves; it is the form produced by buildSchedule. Each collective derives convergence internally where the operation requires it.

These functions provide a denotational reference for the concurrent interpreters in Tile.Execution.Concurrent.

Synopsis

Pure execution semantics

broadcastResult :: Ord m => Schedule m -> m -> p -> Map m p Source #

Deliver a payload from the root to every reachable member.

Takes a divergence schedule. The result includes the root, which holds the payload from the start. This records reachable members, not only receivers of schedule steps.

reduceResult :: Ord m => Schedule m -> m -> Map m v -> (v -> v -> v) -> v Source #

Combine all member values into a single result at the root.

Takes a divergence schedule. Folds over the tree rooted at root, combining each member's local value with those of its subtree.

Precondition: the value map contains every member reachable from the root.

gatherResult :: Ord m => Schedule m -> m -> Map m v -> [(m, v)] Source #

Collect all member values at the root as a list of pairs.

Takes a divergence schedule. Values are returned in preorder over the divergence tree.

Precondition: the value map contains every member reachable from the root.

scatterResult :: Ord m => Schedule m -> m -> [(m, p)] -> Map m p Source #

Deliver destination-specific payloads from the root.

Takes a divergence schedule. Only payloads whose destinations are reachable from the root are delivered.

allReduceResult :: Ord m => Schedule m -> m -> Map m v -> (v -> v -> v) -> Map m v Source #

Combine all member values and deliver the result to every member.

Takes a divergence schedule. Every reachable member ends with the value obtained by combining all member values with combine.

Precondition: the value map contains every member reachable from the root.