Parallel Design Patterns
Total Page:16
File Type:pdf, Size:1020Kb
Parallel design patterns M. Danelutto Introduction Parallel design Parallel design patterns patterns Finding concurrency design space Marco Danelutto Algorithm Structure design space Dept. of Computer Science, University of Pisa, Italy Supporting structures design space May 2011, Pisa Implementation mechanisms design space Conclusions Contents Parallel design patterns M. Danelutto 1 Introduction Introduction Parallel design 2 Parallel design patterns patterns Finding concurrency 3 Finding concurrency design space design space Algorithm 4 Algorithm Structure design space Structure design space Supporting 5 Supporting structures design space structures design space Implementation 6 Implementation mechanisms design space mechanisms design space Conclusions 7 Conclusions T s(n) = seq (speedup) Tpar (n) T d T (n) = i = seq (efficiency) Tpar (n) n × Tpar (n) 1 s(n) = 1−f (Amdhal law) f + n Parallel computing Parallel design patterns M. Danelutto The problem Introduction Solve a problem using nw processing resources Parallel design Obtaining a (close to) nw speedup with respect to time patterns spent sequentially Finding concurrency design space Algorithm Structure design space Supporting structures design space Implementation mechanisms design space Conclusions Parallel computing Parallel design patterns M. Danelutto The problem Introduction Solve a problem using nw processing resources Parallel design Obtaining a (close to) nw speedup with respect to time patterns spent sequentially Finding concurrency design space Algorithm Tseq Structure s(n) = (speedup) design space Tpar (n) Supporting structures Ti d Tseq design space (n) = = (efficiency) Implementation Tpar (n) n × Tpar (n) mechanisms design space 1 Conclusions s(n) = 1−f (Amdhal law) f + n Parallelism exploitation program activities (threads, processes) program interactions (communications, sycnhronizations) ! overhead The problems Parallel design patterns M. Danelutto Introduction Find potentially concurrent activities Parallel design patterns alternative decompositions Finding with possibly radically differences concurrency design space Algorithm Structure design space Supporting structures design space Implementation mechanisms design space Conclusions The problems Parallel design patterns M. Danelutto Introduction Find potentially concurrent activities Parallel design patterns alternative decompositions Finding with possibly radically differences concurrency design space Algorithm Structure Parallelism exploitation design space program activities (threads, processes) Supporting structures design space program interactions (communications, sycnhronizations) Implementation ! overhead mechanisms design space Conclusions Algorithmic skeletons Cole 1988 ! common, parametric, reusable parallelism exploitation pattern languages & libraries since '90 (P3L, Skil, eSkel, ASSIST, Muesli, SkeTo, Mallba, Muskel, Skipper, BS, ...) high level parallel abstractions (parallel programming community) hiding most of the technicalities related to parallelism exploitation directly exposed to application programmers Parallel design patterns Massingill, Mattson, Sanders 2000 ! \Patterns for parallel programming" book (2006) (software engineering community) design patterns `ala Gamma book name, problem, solution, use cases, etc. concurrency, algorithms, implementation, mechanisms Structured parallel programming Parallel design patterns M. Danelutto Introduction Parallel design patterns Finding concurrency design space Algorithm Structure design space Supporting structures design space Implementation mechanisms design space Conclusions Parallel design patterns Massingill, Mattson, Sanders 2000 ! \Patterns for parallel programming" book (2006) (software engineering community) design patterns `ala Gamma book name, problem, solution, use cases, etc. concurrency, algorithms, implementation, mechanisms Structured parallel programming Parallel design Algorithmic skeletons patterns M. Danelutto Cole 1988 ! common, parametric, reusable parallelism exploitation pattern Introduction languages & libraries since '90 (P3L, Skil, eSkel, ASSIST, Parallel design patterns Muesli, SkeTo, Mallba, Muskel, Skipper, BS, ...) Finding high level parallel abstractions (parallel programming concurrency community) design space hiding most of the technicalities related to parallelism Algorithm Structure exploitation design space directly exposed to application programmers Supporting structures design space Implementation mechanisms design space Conclusions Structured parallel programming Parallel design Algorithmic skeletons patterns M. Danelutto Cole 1988 ! common, parametric, reusable parallelism exploitation pattern Introduction languages & libraries since '90 (P3L, Skil, eSkel, ASSIST, Parallel design patterns Muesli, SkeTo, Mallba, Muskel, Skipper, BS, ...) Finding high level parallel abstractions (parallel programming concurrency community) design space hiding most of the technicalities related to parallelism Algorithm Structure exploitation design space directly exposed to application programmers Supporting structures Parallel design patterns design space Implementation Massingill, Mattson, Sanders 2000 ! \Patterns for parallel mechanisms programming" book (2006) (software engineering community) design space design patterns `ala Gamma book Conclusions name, problem, solution, use cases, etc. concurrency, algorithms, implementation, mechanisms New architectures Heterogeneous in Hw & Sw Multicore NUMA, cache coherent architectures Further non functional concerns security, fault tolerance, power management, ::: Concept evolution Parallel design patterns M. Danelutto Parallelism Introduction parallelism exploitation patterns shared among applications Parallel design patterns separation of concerns: Finding system programmers ! efficient implementation of parallel concurrency patterns design space application programmers ! application specific details Algorithm Structure design space Supporting structures design space Implementation mechanisms design space Conclusions Further non functional concerns security, fault tolerance, power management, ::: Concept evolution Parallel design patterns M. Danelutto Parallelism Introduction parallelism exploitation patterns shared among applications Parallel design patterns separation of concerns: Finding system programmers ! efficient implementation of parallel concurrency patterns design space application programmers ! application specific details Algorithm Structure design space New architectures Supporting Heterogeneous in Hw & Sw structures design space Multicore NUMA, cache coherent architectures Implementation mechanisms design space Conclusions Concept evolution Parallel design patterns M. Danelutto Parallelism Introduction parallelism exploitation patterns shared among applications Parallel design patterns separation of concerns: Finding system programmers ! efficient implementation of parallel concurrency patterns design space application programmers ! application specific details Algorithm Structure design space New architectures Supporting Heterogeneous in Hw & Sw structures design space Multicore NUMA, cache coherent architectures Implementation mechanisms Further non functional concerns design space Conclusions security, fault tolerance, power management, ::: Parallel design patterns Parallel design patterns Researchers active since beginning of the century M. Danelutto S. MacDonald, J. Anvik, S. Bromling, J. Schaeffer, D. Szafron, and Introduction K. Tan. 2002. From patterns to frameworks to parallel programs. Parallel design Parallel Comput. 28, 12 (December 2002), 1663-1683. patterns Berna L. Massingill, Timothy G. Mattson, Beverly A. Sanders: A Finding Pattern Language for Parallel Application Programs (Research Note). concurrency design space Euro-Par 2000, LNCS, pp. 678-681, 2000 Algorithm Berna L. Massingill, Timothy G. Mattson , Beverly A. Sanders, Structure design space Parallel programming with a pattern language, Springer Verlag, Int. Supporting J. STTT 3:1-18, 2001 structures design space Berna L. Massingill, Timothy G. Mattson , Beverly A. Sanders, Implementation Patterns for Finding Concurrency for Parallel Application Programs, mechanisms (pre-book) design space Timothy G. Mattson, Beverly A. Sanders, Berna L. Massingill, Conclusions Patterns for parallel programming, Addison Wesley, Pearson Education, 2005 Parallel design patterns Parallel design patterns M. Danelutto Introduction Parallel design patterns Finding concurrency design space Algorithm Structure design space Supporting structures design space Implementation mechanisms design space Conclusions The pattern framework Parallel design patterns M. Danelutto Four patter classes: Introduction 1 Finding concurrency Parallel design patterns 2 Algorithm structure Finding concurrency 3 Supporting structure design space Algorithm 4 Implementation mechanisms Structure design space These are \design spaces" Supporting structures different concerns design space different \kind of programmers" involved Implementation mechanisms upper layers ! application programmers design space lower layers ! system programmers Conclusions Finding concurrency design space Parallel design patterns M. Danelutto Three main blocks Introduction 1 Decomposition Parallel design patterns ! Decomposition of problems into pieces that can be Finding concurrency computed concurrently design space 2 Dependency analysis Algorithm Structure design space ! support task grouping and dependency analysis Supporting 3 Design evaluation structures design space