Principle of Parallel Algorithm Design Alexandre David B2-206 - - PowerPoint PPT Presentation

principle of parallel algorithm design
SMART_READER_LITE
LIVE PREVIEW

Principle of Parallel Algorithm Design Alexandre David B2-206 - - PowerPoint PPT Presentation

Principle of Parallel Algorithm Design Alexandre David B2-206 Today Preliminaries (3.1). Decomposition Techniques (3.2). Surprise. 21-02-2006 Alexandre David, MVP'06 2 Overview Introduction to parallel algorithms. Tasks


slide-1
SLIDE 1

Principle of Parallel Algorithm Design

Alexandre David B2-206

slide-2
SLIDE 2

21-02-2006 Alexandre David, MVP'06 2

Today

Preliminaries (3.1). Decomposition Techniques (3.2). Surprise.

slide-3
SLIDE 3

21-02-2006 Alexandre David, MVP'06 3

Overview

Introduction to parallel algorithms.

Tasks and decomposition. Processes and mapping. Processes vs. processors.

Decomposition techniques.

Recursive decomposition. Exploratory decomposition. Hybrid decomposition.

slide-4
SLIDE 4

21-02-2006 Alexandre David, MVP'06 4

Introduction

Parallel algorithms have the added

dimension of concurrency.

Typical tasks:

Identify concurrent works. Map them to processors. Distribute inputs, outputs, and other data. Manage shared resources. Synchronize the processors.

slide-5
SLIDE 5

21-02-2006 Alexandre David, MVP'06 5

Decomposing Problems

Decomposition into concurrent tasks.

No unique solution. Different sizes. Decomposition illustrated as a directed graph:

Nodes = tasks. Edges = dependency.

Task dependency graph

slide-6
SLIDE 6

21-02-2006 Alexandre David, MVP'06 6

Example: Matrix * Vector

N tasks, 1 task/row: Matrix Vector Task dependency graph?

slide-7
SLIDE 7

21-02-2006 Alexandre David, MVP'06 7

Example: Database Query Processing

MODEL = ``CIVIC'' AND YEAR = 2001 AND (COLOR = ``GREEN'' OR COLOR = ``WHITE)

slide-8
SLIDE 8

21-02-2006 Alexandre David, MVP'06 8

A Solution

slide-9
SLIDE 9

21-02-2006 Alexandre David, MVP'06 9

Another Solution

slide-10
SLIDE 10

21-02-2006 Alexandre David, MVP'06 10

Granularity

Number and size of tasks.

Fine-grained: many small tasks. Coarse-grained: few large tasks.

Related: degree of concurrency.

Maximal degree of concurrency. Average degree of concurrency.

slide-11
SLIDE 11

21-02-2006 Alexandre David, MVP'06 11

Coarser Matrix * Vector

N tasks, 3 task/row: Matrix Vector

slide-12
SLIDE 12

21-02-2006 Alexandre David, MVP'06 12

Granularity

Average degree of concurrency if we take

into account varying amount of work?

Critical path = longest directed path

between any start & finish nodes.

Critical path length = sum of the weights

  • f nodes along this path.

Average degree of concurrency = total

amount of work / critical path length.

slide-13
SLIDE 13

21-02-2006 Alexandre David, MVP'06 13

Database Example

Critical path (3). Critical path (4). Critical path length = 27. Critical path length = 34.

  • Av. deg. of concurrency = 63/27.
  • Av. deg. of conc. = 64/34.

2.33 1.88

slide-14
SLIDE 14

21-02-2006 Alexandre David, MVP'06 14

Interaction Between Tasks

Tasks often share data. Task interaction graph:

Nodes = tasks. Edges = interaction. Optional weights.

Task dependency graph is a sub-graph of

the task interaction graph.

slide-15
SLIDE 15

21-02-2006 Alexandre David, MVP'06 15

Example: Sparse Matrix Multiplication

slide-16
SLIDE 16

21-02-2006 Alexandre David, MVP'06 16

Processes and Mapping

Tasks run on processors. Process: processing agent executing the

  • tasks. Not exactly like in your OS course.

Mapping = assignment of tasks to

processes.

API expose processes and binding to

processors not always controlled.

slide-17
SLIDE 17

21-02-2006 Alexandre David, MVP'06 17

Mapping Example

slide-18
SLIDE 18

21-02-2006 Alexandre David, MVP'06 18

Processes vs. Processors

Processes = logical computing agent. Processor = hardware computational unit. In general 1-1 correspondence but this

model gives better abstraction.

Useful for hardware supporting multiple

programming paradigms.

Now remains the question: How do you decompose?

slide-19
SLIDE 19

21-02-2006 Alexandre David, MVP'06 19

Decomposition Techniques

Recursive decomposition.

Divide-and-conquer.

Data decomposition.

Large data structure.

Exploratory decomposition.

Search algorithms.

Speculative decomposition.

Dependent choices in computations.

slide-20
SLIDE 20

21-02-2006 Alexandre David, MVP'06 20

Recursive Decomposition

Problem solvable by divide-and-conquer:

Decompose into sub-problems.

Do it recursively.

Combine the sub-solutions.

Do it recursively.

Concurrency: The sub-problems are solved

in parallel.

slide-21
SLIDE 21

21-02-2006 Alexandre David, MVP'06 21

Quicksort Example

<5≤ <3≤ <9≤ <7≤ <10≤ <11≤

slide-22
SLIDE 22

21-02-2006 Alexandre David, MVP'06 22

Minimal Number

4 9 1 7 8 11 2 12

slide-23
SLIDE 23

21-02-2006 Alexandre David, MVP'06 23

Data Decomposition

2 steps:

Partition the data. Induce partition into tasks.

How to partition data? Partition output data:

Independent “sub-outputs”.

Partition input data:

Local computations, followed by combination.

slide-24
SLIDE 24

21-02-2006 Alexandre David, MVP'06 24

Matrix Multiplication

slide-25
SLIDE 25

21-02-2006 Alexandre David, MVP'06 25

Intermediate Data Partitioning

Linear combination

  • f the intermediate

results.

slide-26
SLIDE 26

21-02-2006 Alexandre David, MVP'06 26

Owner Compute Rule

Process assigned to some data

is responsible for all computations associated

with it.

Input data decomposition:

All computations done on the (partitioned)

input data are done by the process.

Output data decomposition:

All computations for the (partitioned) output

data are done by the process.

slide-27
SLIDE 27

21-02-2006 Alexandre David, MVP'06 27

Exploratory Decomposition

15-puzzle example

slide-28
SLIDE 28

21-02-2006 Alexandre David, MVP'06 28

Search

slide-29
SLIDE 29

21-02-2006 Alexandre David, MVP'06 29

Anomalous Behavior Possible

Work depends on the order of the search!

slide-30
SLIDE 30

21-02-2006 Alexandre David, MVP'06 30

Speculative Decomposition

Dependencies between tasks are not

known a-priori.

How to identify independent tasks? Conservative approach: identify tasks that are

guaranteed to be independent.

Optimistic approach: schedule tasks even if we

are not sure – may roll-back later.

slide-31
SLIDE 31

21-02-2006 Alexandre David, MVP'06 31

Speculative Decomposition Example

?