The dynamic multithreading model (part 1) CSE 6230, Fall 2014 - - PowerPoint PPT Presentation

the dynamic multithreading model part 1
SMART_READER_LITE
LIVE PREVIEW

The dynamic multithreading model (part 1) CSE 6230, Fall 2014 - - PowerPoint PPT Presentation

The dynamic multithreading model (part 1) CSE 6230, Fall 2014 August 26 1 Recall: DAG model of parallel computation Work = Total ops. Could interpret as sequential time. Span (or depth ) = Length of longest seq. dependence chain. Example: W =


slide-1
SLIDE 1

The dynamic multithreading model (part 1)

CSE 6230, Fall 2014 August 26

1

slide-2
SLIDE 2

Recall: DAG model of parallel computation

Work = Total ops. Could interpret as sequential time. Span (or depth) = Length of longest seq. dependence chain. Example: W = 15, D = 4. “Available” parallelism = W / D = 3.75

2

slide-3
SLIDE 3

Relating work, depth, and time on p “ideal” processors

Work & span laws

  • Speedup & ideal speedup
  • Brent’s theorem

3

Tp ≥ W p Tp ≥ D Sp ≡ T1 Tp ≤ p Tp ≤ D + W − D p

slide-4
SLIDE 4

Parallel primitives to generate DAGs

A dynamic multithreading model

Augment the usual sequential model with three concurrency keywords: spawn, sync, parallel-for Generates nested data-parallel DAGs Permits “simple” analysis of work, depth See new “readings” link at website for PDF file

Data-parallel operations, e.g., vector-add, scan

4

slide-5
SLIDE 5

Quicksort

“Natural” parallelism exists at each branch in the recursion.

5

3 1 4 7 9 5 2 8 3 1 7 9 5 2 8 4 1 2 3 5 7 9 8 8 9

slide-6
SLIDE 6

Quicksort

6

1: function Y ← qsort(X) // |X| = n 2: if |X| ≤ 1 then 3:

return Y ← X

4: else 5:

XL, YM, XR ← partition-seq(X) // Pivot

6:

YL ← qsort(XL)

7:

YR ← qsort(XR)

8:

return Y ← YL ∪ YM ∪ YR

9: endif

slide-7
SLIDE 7

Quicksort

7

1: function Y ← qsort(X) // |X| = n 2: if |X| ≤ 1 then 3:

return Y ← X

4: else 5:

XL, YM, XR ← partition-seq(X) // Pivot

6:

YL ← spawn qsort(XL)

7:

YR ← spawn qsort(XR)

8:

return Y ← YL ∪ YM ∪ YR

9: endif

slide-8
SLIDE 8

Quicksort

8

1: function Y ← qsort(X) // |X| = n 2: if |X| ≤ 1 then 3:

return Y ← X

4: else 5:

XL, YM, XR ← partition-seq(X) // Pivot

6:

YL ← spawn qsort(XL)

7:

YR ← spawn qsort(XR)

8:

sync

9:

return Y ← YL ∪ YM ∪ YR

10: endif

slide-9
SLIDE 9

Quicksort

9

1: function Y ← qsort(X) // |X| = n 2: if |X| ≤ 1 then 3:

return Y ← X

4: else 5:

XL, YM, XR ← partition-seq(X) // Pivot

6:

YL ← spawn qsort(XL)

7:

YR ← qsort(XR)

8:

sync

9:

return Y ← YL ∪ YM ∪ YR

10: endif

slide-10
SLIDE 10

Parallel loops

10

1: for i ← 1 to n do 2:

f(i)

slide-11
SLIDE 11

Parallel loops

11

1: parallel-for i ← 1 to n do 2:

f(i)

slide-12
SLIDE 12

Parallel loops

12

1: parallel-for i ← 1 to n do 2:

f(i) Work and span?