COORDINATION'16

2df7339e6f646abdc75d6fe1e954814a?s=47 Kiko
September 26, 2016

 COORDINATION'16

ParT types presentation given at COORDINATION'16

2df7339e6f646abdc75d6fe1e954814a?s=128

Kiko

September 26, 2016
Tweet

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
  3. PART: AN ASYNCHRONOUS PARALLEL ABSTRACTION FOR SPECULATIVE PIPELINE COMPUTATIONS Asynchronous:

    Don’t stop the world Parallel: manycore era
  4. PART: AN ASYNCHRONOUS PARALLEL ABSTRACTION FOR SPECULATIVE PIPELINE COMPUTATIONS Asynchronous:

    Don’t stop the world Parallel Abstraction: manycore era + parallel collection
  5. 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
  6. 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
  7. Motivation Encore Programming Language: • Asynchronous • Parallel • Futures

    as synchronisation point 1
  8. Motivation Encore Programming Language: • Asynchronous • Parallel • Futures

    as synchronisation point Actors & Tasks 1
  9. 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)
  10. 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’
  11. Motivation Encore Programming Language: • Asynchronous • Parallel • Futures

    as synchronisation point Actors & Tasks 4
  12. 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
  13. Motivation 5 Parallel Portfolio-based SAT solver Goal: is a Formula

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

    solve(formula, s, new Assignment())
  15. Motivation 6 Parallel Portfolio-based SAT solver foreach s: strategies async

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

    solve(formula, s, new Assignment()) Futures Asynchronously continue running
  17. 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?
  18. Motivation 7 Parallel Portfolio-based SAT solver solve solve solve

  19. Motivation 7 Parallel Portfolio-based SAT solver solve solve solve Strategy

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

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

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

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

    Strategy 1. Take Variable 2. Split variable 3. Evaluate formula EvalFormula async async
  24. 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
  25. 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?
  26. 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?
  27. 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?
  28. Motivation 9

  29. Motivation 9

  30. Motivation 9

  31. Motivation 9

  32. Motivation 9 value ƒ2 ƒ1 ƒ3 ƒ2

  33. Motivation 10 value ƒ2 ƒ1 ƒ3 ƒ2

  34. Motivation 10 value ƒ2 ƒ1 ƒ3 ƒ2

  35. Motivation 10 value ƒ2 ƒ1 ƒ3 ƒ2

  36. Motivation 10 value ƒ2 ƒ1 ƒ3 ƒ2 ƒ1

  37. Motivation 10 value ƒ2 ƒ1 ƒ3 ƒ2 ƒ1 true

  38. Motivation 10 value ƒ2 ƒ1 ƒ3 ƒ2 ƒ1 true

  39. Motivation 11 ƒ1 ƒ3 ƒ1 true value ƒ2 ƒ2

  40. Motivation 11 ƒ1 ƒ3 ƒ1 true

  41. Motivation 11 ƒ1 ƒ1 true

  42. Contributions • Parallel abstraction for handling complex coordination patterns •

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

    solver • Implementation: under the hood • Future work & Limitations • Conclusion 19
  44. 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
  45. 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
  46. 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
  47. Example • SAT solver • Multiple strategies • Pipeline and

    Speculative parallelism 14
  48. Example: SAT solver Formula [Strategies] 15

  49. Example: SAT solver Formula [Strategies] s1 s2 sn 15 each

  50. Example: SAT solver Formula [Strategies] s1 s2 sn solve 15

    each
  51. Example: SAT solver Formula [Strategies] s1 s2 sn solve Strategy

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

    variable 16
  53. Example: SAT solver olve Strategy 1. Take variable 2. Split

    variable evalFormula evalFormula 16 ||
  54. 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 ||
  55. 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?
  56. Example: SAT solver Formula [Strategies] s1 s2 sn 17

  57. Example: SAT solver Formula [Strategies] s1 s2 sn formula not

    solved 17
  58. Example: SAT solver Formula [Strategies] s1 s2 sn formula not

    solved false x 17
  59. Example: SAT solver Formula [Strategies] s1 s2 sn formula not

    solved false true x 17
  60. Example: SAT solver Formula [Strategies] s1 s2 sn true 18

  61. Example: SAT solver Formula [Strategies] s1 s2 sn true 18

  62. Example: SAT solver Formula [Strategies] s1 s2 sn true 18

  63. Example: SAT solver Formula [Strategies] s1 s2 sn true 18

  64. Example: SAT solver Formula [Strategies] s1 s2 sn true 18

  65. Example: SAT solver Formula [Strategies] s1 s2 sn true 19

  66. Example: SAT solver Formula [Strategies] s1 s2 sn true 19

  67. Example: SAT solver Formula [Strategies] 20

  68. Example: SAT solver Formula [Strategies] 20 ParT

  69. Example: SAT solver Formula [Strategies] 20 ParT

  70. Example: SAT solver Formula [Strategies] << 20 ParT

  71. Example: SAT solver Formula [Strategies] << Computation 20 ParT

  72. Example: SAT solver Formula [Strategies] << Computation Parallel and Asynchronous

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    t→ Par t’ ƒ1 → function Par t’ ParT << VALUE PRUNE 33 ParT
  89. 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
  90. Conclusions • ParT: abstraction to handle parallel and async computations

    • Non-blocking combinators • Tracks down and kills-off speculative work 27
  91. Questions 28