computer science 320 parallel computing design patterns
TRANSCRIPT
![Page 1: Computer Science 320 Parallel Computing Design Patterns](https://reader036.vdocuments.us/reader036/viewer/2022062320/56649ccc5503460f949966f4/html5/thumbnails/1.jpg)
Computer Science 320
Parallel ComputingDesign Patterns
![Page 2: Computer Science 320 Parallel Computing Design Patterns](https://reader036.vdocuments.us/reader036/viewer/2022062320/56649ccc5503460f949966f4/html5/thumbnails/2.jpg)
Problem Solving: How to Start?
• See if your problem fits into a class of problems that have already been solved
• Look for a suggestion for your solution in that class of solutions
![Page 3: Computer Science 320 Parallel Computing Design Patterns](https://reader036.vdocuments.us/reader036/viewer/2022062320/56649ccc5503460f949966f4/html5/thumbnails/3.jpg)
Design Patterns
• A design pattern provides a template for suggested solutions to a class of siliarly structured problems
• Identify a design pattern that best matches your problem
![Page 4: Computer Science 320 Parallel Computing Design Patterns](https://reader036.vdocuments.us/reader036/viewer/2022062320/56649ccc5503460f949966f4/html5/thumbnails/4.jpg)
Parallel Design Patterns
Three patterns in 1989 paper by Carriero and Gelernter:
– Result parallelism
– Agenda parallelism
– Specialist parallelism
![Page 5: Computer Science 320 Parallel Computing Design Patterns](https://reader036.vdocuments.us/reader036/viewer/2022062320/56649ccc5503460f949966f4/html5/thumbnails/5.jpg)
Result Parallelism
Good for processing each element in a data structure, such as the pixels in an image or the frames in a movie
Ideally, the results of the computations are independent of each other
![Page 6: Computer Science 320 Parallel Computing Design Patterns](https://reader036.vdocuments.us/reader036/viewer/2022062320/56649ccc5503460f949966f4/html5/thumbnails/6.jpg)
Result Parallelism
Bottleneck: sequential dependencies, where one result must await the computation of another
Positions of multiple stars in a time sequence
Spreadsheet recalculations
![Page 7: Computer Science 320 Parallel Computing Design Patterns](https://reader036.vdocuments.us/reader036/viewer/2022062320/56649ccc5503460f949966f4/html5/thumbnails/7.jpg)
Result Parallelism with Dependencies
![Page 8: Computer Science 320 Parallel Computing Design Patterns](https://reader036.vdocuments.us/reader036/viewer/2022062320/56649ccc5503460f949966f4/html5/thumbnails/8.jpg)
Agenda Parallelism
Good for computing one result from a large number of inputs
See if any DNA sequences match a query sequence
May also run into sequential dependencies, where tasks must wait
![Page 9: Computer Science 320 Parallel Computing Design Patterns](https://reader036.vdocuments.us/reader036/viewer/2022062320/56649ccc5503460f949966f4/html5/thumbnails/9.jpg)
Agenda Parallelism: BLAST
Basic Local Alignment Search Tool
Unlike result parallelism, only interested in some results or combination thereof
![Page 10: Computer Science 320 Parallel Computing Design Patterns](https://reader036.vdocuments.us/reader036/viewer/2022062320/56649ccc5503460f949966f4/html5/thumbnails/10.jpg)
Agenda Parallelism with Reduction
Compute in parallel and then apply a reduction operator
![Page 11: Computer Science 320 Parallel Computing Design Patterns](https://reader036.vdocuments.us/reader036/viewer/2022062320/56649ccc5503460f949966f4/html5/thumbnails/11.jpg)
Specialist Parallelism
Each processor performs a specialized task on a series of data items (also known as pipelining)
![Page 12: Computer Science 320 Parallel Computing Design Patterns](https://reader036.vdocuments.us/reader036/viewer/2022062320/56649ccc5503460f949966f4/html5/thumbnails/12.jpg)
Specialist Parallelism
For each star Calculate position Render image Store in PNG file
![Page 13: Computer Science 320 Parallel Computing Design Patterns](https://reader036.vdocuments.us/reader036/viewer/2022062320/56649ccc5503460f949966f4/html5/thumbnails/13.jpg)
What if There Aren’t Enough Processors?
Large problems have billions of results to compute or tasks to perform, but we don’t yet have billions of processors
The specialist pattern usually requires fewer processors
![Page 14: Computer Science 320 Parallel Computing Design Patterns](https://reader036.vdocuments.us/reader036/viewer/2022062320/56649ccc5503460f949966f4/html5/thumbnails/14.jpg)
Result Pattern: Clumping/Slicing
Clumping: lump many conceptual processors into one real processor
Slicing: partition a data structure into pieces and dedicate a process to each piece
![Page 15: Computer Science 320 Parallel Computing Design Patterns](https://reader036.vdocuments.us/reader036/viewer/2022062320/56649ccc5503460f949966f4/html5/thumbnails/15.jpg)
Agenda Pattern: Clumping/Slicing
Clumping: lump many conceptual processors into one real processor
Slicing: partition a data structure into pieces and dedicate a process to each piece
![Page 16: Computer Science 320 Parallel Computing Design Patterns](https://reader036.vdocuments.us/reader036/viewer/2022062320/56649ccc5503460f949966f4/html5/thumbnails/16.jpg)
Agenda Pattern: Master-Worker
A conceptual design usually for clusters
The master processor manages the agenda of tasks, and delegates these to the worker processors
The master receives the results and combines them
![Page 17: Computer Science 320 Parallel Computing Design Patterns](https://reader036.vdocuments.us/reader036/viewer/2022062320/56649ccc5503460f949966f4/html5/thumbnails/17.jpg)
For Next Time
Introduction to parallel Java, and a first parallel program!