Kiko
June 30, 2016

# ParT abstraction

Presentation for OPLSS (Oregon Programming Language Summer School) where I explained how the ParT abstraction works. This presentation includes an introduction to the Encore language, how the actor model (with futures) work in Encore and a brief explanation of the ParT abstraction with a SAT-solver follow-along example.

June 30, 2016

## Transcript

5. ### Pre-ParT: Encore Encore threads Tasks … Futures ParT Standard Library

Concurrent GC Actors Work stealing PonyRT EncoreRT Compiler: Haskell RunTime: C def main(): void let w = new World in { w.add( …) } .enc 0001100011110 101010011001 executable

10. ### Actors ↝ :: Fut t → (t → t’) →

Fut t’ Asynchronous Yes
11. ### ParT: Basic Idea Bunch Futures & values • How can

we create non-blocking complex parallel coordination patterns? • What about speculative computations?
12. ### ParT & combinators Abstraction that encapsulate parallel and asynchronous computations

Functional data structure Async Parallel Combinators to control the abstraction Automatically kill-off computations (when not needed) [Combinators borrowed from Orc]
13. ### Example Parallel Portfolio-based SAT solver Goal: is a Formula satisﬁable

or not? Input: Array of Strategies, Formula, Assignment Output: Maybe Assignment
14. ### Example [Strategies] fml: Formula a: Assignments each( ) >>= \(s:

Strategy) -> solve(s, fml, a)
15. ### Example [Strategies] each( ( ParT each: [t] → Par t

Formula Assignments
16. ### Example [Strategies] each( ( ParT >>= closure each: [t] →

Par t λ strategy: Strategy → solve(strategy, formula, assignment) Formula Assignments >>= :: Par t → (t → Par t’) → Par t’
17. ### Example [Strategies] each( ( ParT solve each: [t] → Par

t >>= :: Par t → (t → Par t’) → Par t’ solve solve (strategy, formula, assignment)
18. ### Example [Strategies] each( ( ParT solve each: [t] → Par

t >>= :: Par t → (t → Par t’) → Par t’ solve solve Strategy 1. Take variable 2. Split variable (strategy, formula, assignment)
19. ### Example solve (t → Par t’) → Par t’ solve

solve Strategy Take variable Split variable
20. ### Example solve (t → Par t’) → Par t’ solve

solve Strategy Take variable Split variable Split variable: v1 = ( v, ) v2 = (v, ) {evalFormula(…, v1)} false true evalFormula :: … → (Maybe Bool, Assignment) { • } :: t → Par t
21. ### Example solve (t → Par t’) → Par t’ solve

solve Strategy Take variable Split variable Split variable: v1 = ( v, ) v2 = (v, ) {evalFormula(…, v1)} || {evalFormula(…, v2)} false true evalFormula :: … → (Maybe Bool, Assignment) { • } :: t → Par t
22. ### Example solve (t → Par t’) → Par t’ solve

solve Strategy Take variable Split variable Split variable: v1 = ( v, ) v2 = (v, ) {evalFormula(…, v1)} || {evalFormula(…, v2)} false true evalFormula :: … → (Maybe Bool, Assignment) { • } :: t → Par t || :: Par t → Par t → Par t
23. ### Example solve (t → Par t’) → Par t’ solve

solve Strategy Take variable Split variable Split variable: v1 = ( v, ) v2 = (v, ) {evalFormula(…, v1)} || {evalFormula(…, v2)} false true evalFormula :: … → (Maybe Bool, Assignment) { • } :: t → Par t || :: Par t → Par t → Par t || doesn’t spawn new tasks! It declares that these can be evaluated in parallel
24. ### Example solve (t → Par t’) → Par t’ solve

solve Strategy Take variable Split variable || :: Par t → Par t → Par t evalFormula evalFormula ||
25. ### satisﬁable? Example solve ) → Par t’ solve solve le

e || :: Par t → Par t → Par t evalFormula evalFormula || satisﬁable? :: (Maybe Bool, Assignment) → Par Assignment >>=
26. ### satisﬁable? Example solve ) → Par t’ solve solve le

e || :: Par t → Par t → Par t evalFormula evalFormula || satisﬁable? satisﬁable? :: (Maybe Bool, Assignment) → Par Assignment >>= Nothing

28. ### Example << function << :: (Fut (Maybe t) → Par

t’) → Par t → Par t’ ParT

30. ### Example << function ParT << :: (Fut (Maybe t) →

Par t’) → Par t → Par t’
31. ### Conclusions • Future: handle to an asynchronous computation • ParT:

handle to a collection of parallel computations • Asynchronous combinators (compute on demand) • Kill-off speculative computations when not needed
32. ### Future work • From prototype to fast implementation • Multiversioning

compiler for Task-fusion • Cache-efﬁcient scheduling • Type-based optimisations • Add rich set of (non-blocking) combinators (LinQ, Spark, MapReduce, etc)
33. ### References • Fully concurrent garbage collection of actors on many-core

machines (OOPSLA 2013) Sylvan Clebsch and Sophia Drossopoulou • Parallel Objects for Multicores: A Glimpse at the Parallel Language Encore. SFM 2015: 1-56 • Ownership and Reference Counting based Garbage Collection in the Actor World (ICOOOLPS 2015) Sylvan Clebsch, Sebastian Blessing, Juliana Franco, Sophia Drossopoulou • Reference Capabilities for Concurrency Control (ECOOP’16) Elias Castegren and Tobias Wrigstad • ParT: An Asynchronous Parallel Abstraction for Speculative Pipeline Computations (COORDINATION’16) Kiko Fernandez-Reyes, Dave Clarke, Daniel S. McCain • Kappa: Insights, Current Status and Future Work (IWAKO’16) Elias Castegren and Tobias Wrigstad • Towards Enabling Low-Level Memory Optimisations at the High-Level with Ownership Annotations (IWAKO’16) Juliana Franco, Tobias Wrigstad, Sophia Drossopoulou