Upgrade to Pro — share decks privately, control downloads, hide ads and more …

COORDINATION'16

Kiko
September 26, 2016

 COORDINATION'16

ParT types presentation given at COORDINATION'16

Kiko

September 26, 2016
Tweet

More Decks by Kiko

Other Decks in Research

Transcript

  1. PART: AN ASYNCHRONOUS PARALLEL ABSTRACTION FOR SPECULATIVE PIPELINE COMPUTATIONS Kiko

    Fernandez-Reyes, Dave Clarke and Daniel S.McCain Uppsala University, Sweden
  2. PART: AN ASYNCHRONOUS PARALLEL ABSTRACTION FOR SPECULATIVE PIPELINE COMPUTATIONS Asynchronous:

    Don’t stop the world Parallel Abstraction: manycore era + parallel collection
  3. PART: AN ASYNCHRONOUS PARALLEL ABSTRACTION FOR SPECULATIVE PIPELINE COMPUTATIONS Asynchronous:

    Don’t stop the world Parallel Abstraction: manycore era + parallel collection Speculative: kill-off computations Better use for CPU
  4. PART: AN ASYNCHRONOUS PARALLEL ABSTRACTION FOR SPECULATIVE PIPELINE COMPUTATIONS Asynchronous:

    Don’t stop the world Parallel Abstraction: manycore era + parallel collection Speculative: kill-off computations Better use of CPU Pipeline: highly parallelizable
  5. Tasks calculateF ƒ1 get ƒ1 (Block until future is fulfilled)

    return Maybe(bool) 1. 2. 3. 4. Steps: 2 let fut : Fut(Maybe bool) = async { calculateF(f, a); } in return get(fut) (get :: Fut t → t)
  6. Tasks 3 let fut : Maybe bool = async {

    calculateF(f, a); } in fut ⤳ (\(m: Maybe bool) -> match m with Just true => a …) calculateF ƒ1 1. 2. Steps: ƒ1 ⤳ (\(m: Maybe bool) -> match m with … ƒ2 = ⤳ :: Fut t → (t → t’) → Fut t’
  7. Motivation Encore Programming Language: • Asynchronous • Parallel • Futures

    as synchronisation point Actors & Tasks Actors and tasks lack of an abstraction for the asynchronous and parallel nature of their computations 4
  8. Motivation 5 Parallel Portfolio-based SAT solver Goal: is a Formula

    satisfiable or not? Input: Array of Strategies, Formula Output: Maybe Assignment
  9. Motivation 6 Parallel Portfolio-based SAT solver foreach s: strategies async

    solve(formula, s, new Assignment()) Futures Asynchronously continue running
  10. Motivation 6 Parallel Portfolio-based SAT solver foreach s: strategies async

    solve(formula, s, new Assignment()) Futures Asynchronously continue running How can I select the first one that finishes?
  11. Motivation 7 Parallel Portfolio-based SAT solver solve solve solve Strategy

    1. Take Variable 2. Split variable 3. Evaluate formula
  12. Motivation 7 Parallel Portfolio-based SAT solver solve solve solve Strategy

    1. Take Variable 2. Split variable 3. Evaluate formula async
  13. Motivation 7 Parallel Portfolio-based SAT solver solve solve solve Strategy

    1. Take Variable 2. Split variable 3. Evaluate formula async async
  14. Motivation 7 Parallel Portfolio-based SAT solver solve solve solve Strategy

    1. Take Variable 2. Split variable 3. Evaluate formula EvalFormula async async
  15. Motivation 7 Parallel Portfolio-based SAT solver solve EvalFormula solve solve

    Strategy 1. Take Variable 2. Split variable 3. Evaluate formula EvalFormula async async
  16. Motivation 7 Parallel Portfolio-based SAT solver solve EvalFormula solve solve

    Strategy 1. Take Variable 2. Split variable 3. Evaluate formula EvalFormula ⤳ satisfiable? async async
  17. Motivation 8 EvalFormula solve solve solve Strategy 1. Take Variable

    2. Split variable 3. Evaluate formula EvalFormula ⤳ satisfiable? async async Parallel Portfolio-based SAT solver ⤳ satisfiable?
  18. Motivation 8 EvalFormula solve solve solve Strategy 1. Take Variable

    2. Split variable 3. Evaluate formula EvalFormula ⤳ satisfiable? Don’t know solve async async Parallel Portfolio-based SAT solver ⤳ satisfiable?
  19. Motivation 8 EvalFormula solve solve solve Strategy 1. Take Variable

    2. Split variable 3. Evaluate formula EvalFormula False ⤳ satisfiable? Don’t know solve async async Parallel Portfolio-based SAT solver ⤳ satisfiable?
  20. Contributions • Parallel abstraction for handling complex coordination patterns •

    Asynchronous Combinators • Kills-off speculative computations when no longer needed • Prototypes in Encore and Clojure 12
  21. Index • ParT & Combinators • Example: Parallel Portfolio-based SAT

    solver • Implementation: under the hood • Future work & Limitations • Conclusion 19
  22. ParT & Combinators 13 Functional data structure Encapsulates parallel &

    asynchronous computations Controlled via parallel combinators derived from Orc… typed & asynchronous async computation async computation async computation ParT
  23. ParT & Combinators 13 Functional data structure Encapsulates parallel &

    asynchronous computations Controlled via parallel combinators derived from Orc… typed & asynchronous async computation async computation async computation ParT
  24. ParT & Combinators 13 Functional data structure Encapsulates parallel &

    asynchronous computations Controlled via parallel combinators derived from Orc… typed & asynchronous async computation async computation async computation ParT Handle to ongoing parallel computations
  25. Example: SAT solver Formula [Strategies] s1 s2 sn solve Strategy

    1. Take variable 2. Split variable 15 each
  26. Example: SAT solver olve Strategy 1. Take variable 2. Split

    variable evalFormula evalFormula 16 ||
  27. Example: SAT solver olve Strategy 1. Take variable 2. Split

    variable evalFormula evalFormula 16 || doesn’t spawn new asynchronous computations! It rather declares there is possibility for parallelism ||
  28. Example: SAT solver olve Strategy 1. Take variable 2. Split

    variable evalFormula evalFormula 16 || doesn’t spawn new asynchronous computations! It rather declares there is possibility for parallelism || >>= >>= satisfiable? satisfiable?
  29. Example: SAT solver Formula [Strategies] << Computation Parallel and Asynchronous

    computations captured in the ParT abstraction This computation can start immediately 21
  30. ParT Example: SAT solver Formula [Strategies] << Computation Parallel and

    Asynchronous computations captured in the ParT abstraction This computation can start immediately 21
  31. Example: SAT solver << fut2Par << (each(sts) >>= \(s: Strategy)

    -> (async sat(s, fml, new Assignment())✝)) 22 ParT Computation
  32. Example: SAT solver << fut2Par << (each(sts) >>= \(s: Strategy)

    -> (async sat(s, fml, new Assignment())✝)) 22 ParT Computation
  33. Example: SAT solver << fut2Par << (each(sts) >>= \(s: Strategy)

    -> (async sat(s, fml, new Assignment())✝)) 22 ParT Computation
  34. Implementation • Futures are essential to ParT • Futures are

    handles to single parallel computations • ParT are handle to collection of parallel computations 23
  35. Implementation ( )✝ :: Fut (Par t) → Par t

    ( ) :: Fut t → Par t ⚬ { v } :: t → Par t ƒParT LIFT 24 ƒ1 VALUE
  36. Par Implementation ( )✝ :: Fut (Par t) → Par

    t ( ) :: Fut t → Par t ⚬ { v } :: t → Par t ƒParT LIFT 24 Par Par ƒ1 VALUE
  37. Implementation >> :: Par t → (t → t’) →

    Par t’ ParT ƒ1 >> function ParT ƒ2 = SEQUENCE 25
  38. Implementation >> :: Par t → (t → t’) →

    Par t’ ParT ƒ1 >> function ParT ƒ2 ƒ1 ⤳ = SEQUENCE 25 =
  39. Implementation >> :: Par t → (t → t’) →

    Par t’ ParT ƒ1 >> function ParT ƒ2 ƒ1 ⤳ = ParT >> function ParT = VALUE VALUE’ SEQUENCE 25 =
  40. Combinators << :: (Fut(Maybe t) → Par t’) → Par

    t→ Par t’ ƒ1 → → ƒ2 → function Par t’ ParT << VALUE PRUNE 33
  41. Combinators << :: (Fut(Maybe t) → Par t’) → Par

    t→ Par t’ ƒ1 → → ƒ2 → function Par t’ ParT << VALUE PRUNE 33
  42. Combinators << :: (Fut(Maybe t) → Par t’) → Par

    t→ Par t’ ƒ1 → → ƒ2 → function Par t’ ParT << VALUE PRUNE 33
  43. Combinators << :: (Fut(Maybe t) → Par t’) → Par

    t→ Par t’ ƒ1 → function Par t’ ParT << VALUE PRUNE 33
  44. Combinators << :: (Fut(Maybe t) → Par t’) → Par

    t→ Par t’ ƒ1 → function Par t’ ParT << VALUE PRUNE 33 ParT
  45. Combinators << :: (Fut(Maybe t) → Par t’) → Par

    t→ Par t’ ƒ1 → function Par t’ ParT << VALUE PRUNE 33 ParT
  46. Future work & Limitations • Limitation: Computations must be side-effect

    free • Integration with actors possible via software transactional memory • Adding more combinators • Improving the current implementation 26
  47. Conclusions • ParT: abstraction to handle parallel and async computations

    • Non-blocking combinators • Tracks down and kills-off speculative work 27