computer science 320 parallel computing design patterns

17
Computer Science 320 Parallel Computing Design Patterns

Upload: suzan-summers

Post on 16-Dec-2015

226 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Computer Science 320 Parallel Computing Design Patterns

Computer Science 320

Parallel ComputingDesign Patterns

Page 2: Computer Science 320 Parallel Computing Design Patterns

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

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

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

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

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

Result Parallelism with Dependencies

Page 8: Computer Science 320 Parallel Computing Design Patterns

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

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

Agenda Parallelism with Reduction

Compute in parallel and then apply a reduction operator

Page 11: Computer Science 320 Parallel Computing Design Patterns

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

Specialist Parallelism

For each star Calculate position Render image Store in PNG file

Page 13: Computer Science 320 Parallel Computing Design Patterns

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

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

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

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

For Next Time

Introduction to parallel Java, and a first parallel program!