101
*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners The Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar – Rice University [email protected], [email protected] Tutorial CnC09 July 23, 2009

The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

  • Upload
    dodien

  • View
    274

  • Download
    0

Embed Size (px)

Citation preview

Page 1: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

The Concurrent Collections (CnC) Parallel Programming Model

Tutorial

Kathleen Knobe – Intel Vivek Sarkar – Rice University

[email protected], [email protected]

Tutorial CnC′09

July 23, 2009

Page 2: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

2

Outline 1.  Concurrent Collections Model and Languages

2.  Execution Semantics and Properties

3.  Patterns and Examples

4.  Research Topics

Page 3: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

3

The Big Idea

• Don’t specify what operations run in parallel difficult and depends on target

• Specify the semantic ordering constraints only easier and depends only on application

Page 4: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

4

Exactly two sources of ordering requirements

•  Producer / Consumer (Data Dependence) Producer must execute before consumer

•  Controller / Controllee (Control Dependence) Controller must execute before controllee

Page 5: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

5

Notation

(foo)

<T>

[x]

Computation Step

Data Item

Control Tag

(foo)

<T>

[x]

foo

T

x

Slideware Textual White Board

Page 6: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

6

Producer - consumer Controller - controllee

Exactly two sources of ordering requirements

(step1) (step2) [item] (step1) (step2)

<t2>

•  Producer / Consumer (Data Dependence) Producer must execute before consumer

•  Controller / Controllee (Control Dependence) Controller must execute before controllee

Page 7: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

7

Collections of dynamic instances

(step1) (step2) [item]

( ) ( ) [ ] ( )

( )

[ ]

( )

( )

[ ]

[ ]

[ ]

Static

Dynamic

Page 8: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

8

Three main influences

1.  Streaming

2.  Tuple spaces

3.  Dataflow

We will discuss each of them as they become relevant

Page 9: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

9

Influence 1: Streaming

• CnC is like Streaming –  Internals of a step are hidden from the graph that describes their connectivity –  Isolation (step1) doesn’t know that (step2) exists, it simply produces [item] (step2) doesn’t know that (step1) exists. It just consumes [item]

• CnC differs from Streaming –  Not strictly FIFO –  Specified not only data and computation but also control

•  Reference for Streaming in CnC –  Umakishore Ramachandran, Kathleen Knobe, Nissim Harel, Hasnain A. Mandviwala. Distributed

Garbage Collection Algorithms for Timestamped data. IEEE Transactions on Parallel and Distributed Systems, Volume 17(10):1057-1071, October 2006.

(step1) (step2) [item]

Page 10: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

10

Collections of dynamic instances

(step1) (step2)

<t2>

( )

< >

( )

< >

( )

< >

( )

< >

( ) ( )

( ) ( )

Static

Dynamic

Page 11: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

11

Loop nests

loop k = … loop j = … loop i = … Z(i, j, k) = = A(k, j) end end end

Tag collections: new concept

(step1) (step2)

<t2>

(Step2)

components of tag <t2> are k and j

•  Loop iteration space is a sequence <1,1,1>, <1,1,2>, …

•  The body of the loop has access to its indices

•  As each tuple in the sequence is created, the associated body is executed.

• The related tag collection is a set {<1,1>, <1, 2>, …}

• The step code has access to its tags

• The time the associated body is executed is yet to be determined.

Tags are typically related to the semantics of application.

Page 12: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

12

Tag collections: new concept

(step1) (step2)

<t2>

  Recursion space is a sequence <R>, <RR>, <RL>, <L>, <LR>, <LL>

  After instance in the sequence is created, the associated body is executed.

  The related tag collection is a set {<R>, <RR>, <RL>, <L>, <LR>, <LL>}

  The time the associated body is executed is yet to be determined

Tags are typically related to the semantics of application.

Recursion

routine foo( …) … call foo(left_child) call foo(right_child) …

end foo

Page 13: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

13

Influence 2: Tuple Spaces (Linda)

• CnC is like Linda –  Both are coordination languages that specify computations and

communications via a tuple/tag namespace –  Both create new computations by adding new tuples/tags to the namespace

• CnC differs from Linda –  In Linda, an in() operation atomically removes the tuple from the tuplespace,

but a CnC get() operation does not remove the item from the collection –  In Linda, there is no separation between tags and values in a tuple; the

choice of tag is implicit in the use of wildcards –  In CnC, there is a separation between tags and values, and control tags are

first class constructs like data items • CnC used to be called TStreams where T stood for “tagged”

• References: –  “Generative communication in Linda”, David Gelernter, TOPLAS, Jan 1985. –  “Coordination languages and their significance”, David Gelernter and

Nicholas Carriero, CACM, Feb 1992

Page 14: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

14

Quick review

•  3 kinds of collections –  Step –  Item –  Tag

•  3 kinds of relations –  Consumer –  Producer –  Prescription

Page 15: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

15

Objects

Step Collections –  Every step collection is controlled by a tag collection –  Functional. Only side-effects are put objects –  Gets items. Puts tags and items. All gets before any put –  Are tagged. A step has access to its tag value

Item Collections –  Means of communication

among step instances (data dependence) –  Dynamic single assignment

Each instance is associated with exactly one contents.

–  Are tagged

Tag Collections –  Means of communication among

step instances (control dependence) –  A tag collection may control

multiple step collections –  Determines what step instances

will execute

(foo)

<T> [x]

Page 16: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

16

Relationships: Consumer

• Corresponds to gets in steps

• A step may consume multiple distinct item collections [x], [y] -> (foo)

• A step may consume multiple instances of items from a given collection [x: neighbors(i)] -> (foo: i)

• Conservative [x] -> (foo) means that (foo) may consume from [x] If there is no consumer relationship between [y] and (foo) then

(foo) may not consume from [y]

(step2) [item]

Page 17: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

17

Relationships: producer

• Corresponds to puts in steps

• A step may produce multiple distinct item/tags collections (foo) -> [x], [y]

• A step may produce multiple instances of items/tags from a given collection (foo: i) -> [x: neighbors(i)]

• Conservative (foo) -> [x] means that (foo) may produce [x] If there is no producer relationship between [y] and (foo) then

(foo) may not produce [y]

(step1) [item]

(step1) <t2>

Page 18: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

18

Relationships: prescription

• A prescription relationship between tag collection T and step collection S means that if tag instance in T with tag component values t1, …tn is in T then the step with component values t1, …tn will execute.

•  The relationship is always the identity function.

• A tag collection may prescribe multiple step collections.

(step1)

<t>

(step2)

Page 19: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

19

“aaaffqqqmmmmmmm”

An Application (simple in the extreme)

“aaa”

“ff”

“qqq” “mmmmmmm”

“aaa”

“qqq” “mmmmmmm”

Break up an input string - sequences of repeated single characters Filter allowing only - sequences of odd length

Input string

Sequences of repeated characters

Filtered sequences

Page 20: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

20

[span: j, s]

How people think about their application: The white board drawing

What are the high level operations?

What are the chunks of data?

What are the producer/consumer relationships?

What are the inputs and outputs?

[input: j] [results: j, s] (createSpan: j) (processSpan: j, s) (processSpan: j, s) [results: j, s]

[Input] = “aaaffqqqmmmmmmm”

[span: 1] = “aaa”

[span: 2] = “ff”

[span: 3] = “qqq”

[span: 4] = “mmmmmmm”

[results: 1] = “aaa”

[results: 3] = “qqq” [results: 4] = “mmmmmmm”

Page 21: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

21

<spanTag: 1> <spanTag: 2> <spanTag: 3> <spanTag: 4>

[span: j, s]

Make it precise enough to execute How do we distinguish among the instances?

[input: j] [span: j, s] [results: j, s] (createSpan: j) (processSpan: j, s)

<spanTag: j, s>

(processSpan: j, s) [results: j, s]

[Input] = “aaaffqqqmmmmmmm”

[span: 1] = “aaa”

[span: 2] = “ff”

[span: 3] = “qqq”

[span: 4] = “mmmmmmm”

[results: 1] = “aaa”

[results: 3] = “qqq” [results: 4] = “mmmmmmm”

<spanTag: 1> <spanTag: 2> <spanTag: 3> <spanTag: 4>

•  Here the tag values are arbitrary. •  Often the tags have semantic

meaning in the application.

Page 22: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

22

<spanTag: 1> <spanTag: 2> <spanTag: 3> <spanTag: 4>

[span: j, s]

Make it precise enough to execute How do we distinguish among the instances?

[span: j, s] (createSpan: j) (processSpan: j, s)

<spanTag: j, s>

(processSpan: j, s)

[span: 1]

[span: 2]

[span: 3]

[span: 4]

<spanTag: 1> <spanTag: 2> <spanTag: 3> <spanTag: 4>

•  Common case: Control and data dependence are identical. May provide syntax for this in the future.

Page 23: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

23

[input: 1] = “aaaffqqqmmmmmmm” [input: 2] = “rrhhhhxxx” …

Make it precise enough to execute How do we distinguish among the instances?

[input: j] [results: j, s] (createSpan: j) (processSpan: j, s)

<stringTag: j> <spanTag: j, s>

[span: j, s] (processSpan: j, s) [results: j, s]

<stringTag: 1> <stringTag: 2> …

[span: 1, 1] = “aaa”

[span: 1, 2] = “ff”

[span: 1, 3] = “qqq”

[span: 1, 4] = “mmmmmmm”

[results: 1, 1] = “aaa”

[results: 1, 3] = “qqq” [results: 1, 4] = “mmmmmmm”

<spanTag: 1, 1> <spanTag: 1, 2> <spanTag: 1, 3> <spanTag: 1, 4>

Page 24: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

24

Summarize questions: White board level

•  What are the high level operations? (step collections)

•  What are the chunks of data? (item collections)

•  What are the producer/consumer relationships?

•  What are the inputs and outputs? considered to be produced and consumed by the environment

[span] [input] [results]

(createSpan) (processSpan)

[input] [results]

(createSpan) [span]

[span] (processSpan)

Page 25: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

25

Summarize questions: distinguish among instances

[input] (createSpan) [span] (processSpan) [results]

(createSpan: j) [input: j] [span: j, s] (processSpan: j, s) (processSpan: j, s) [results: j, s] [results: j, s]

becomes

Page 26: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

26

Summarize questions: control • Control: Every step is a controllee.

• What are the distinct control tag collections? (iterations spaces)

• What are the controllers? (produce the instances in the control tag collections)

[input: j] [results: j, s] (createSpan: j) (processSpan: j, s)

<stringTag: j> <spanTag: j, s>

[span: j, s] (processSpan: j, s) [results: j, s]

Page 27: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

27

Summary of graph design questions

•  White board level –  What are the high level operations? (step collections) –  What are the chunks of data? (item collections) –  What are the producer/consumer relationships? –  What are the inputs and outputs? (produced and consumed by env)

•  Distinguish among the instances

•  Control –  Every step is a controllee. –  What are the distinct control tag collections? (iterations spaces) –  What are the controllers? (produce the instances in the control tag

collections)

Page 28: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

28

No thinking about parallelism Only domain/application knowledge

Result is: •  Parallel •  Deterministic (wrt results) •  race-free

Page 29: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

29

<Cell tags Initial: K, cell> (Correction filter: K, cell)

(Cell tracker: K) (Arbitrator initial: K)

(Arbitrator final: K)

[Input Image: K]

[Histograms: K]

[Motion corrections: K , cell]

[Labeled cells initial: K]

[Predicted states: K, cell]

[Cell candidates: K ]

[State measurements: K]

[Labeled cells final: K]

[Final states: K]

<K>

(Prediction filter: K, cell)

(Cell detector: K)

Experience with questions: cell tracker

<Cell tags Final: K, cell>

Page 30: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

30

[result]

Available Parallelism

(createSpan)

<stringTag>

[input]

(processSpan) [span]

<spanTag>

Page 31: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

31

(createSpan)

<stringTag>

[input]

[result] (processSpan) (span)

<scanTag>

Page 32: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

32

Scheduling decision

Possible goals •  Minimize latency

•  Maximize utilization

•  Improve predictability

•  Minimize memory footprint

•  Minimize overhead of scheduler

Other inputs to decision •  Number of processors

•  Hierarchical aspects of architecture

•  Range of number of substrings per string

•  Cost of communication

•  Rate of arrival of input strings

These issues do not alter the CnC specification More on scheduling later

More than enough parallelism - Favor processing existing substrings or - Favor starting new input strings

Page 33: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

33

Mapping to target platform

The work of the tuning expert •  Architecture •  Actual parallelism •  Locality •  Overhead •  Load balancing •  Distribution among processors •  Scheduling within a processor

The work of the domain expert •  Semantic correctness •  Constraints required by the application

Concurrent Collections Spec

The application problem The domain expert does not need to know about parallelism

Separation of Concerns between Domain Expert and Tuning Expert

The tuning expert does not need to know about the domain.

Goal: serious separation of concerns:

Page 34: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

34

Another Application (also very simple) •  Consider all possible square windows within an image (all sizes and possibly overlapping)

•  A sequence (cascade) of classifiers where each can determine that the window does not contain a face

•  A window successfully reaching the end of the cascade of classifiers, it is considered to be a face.

Page 35: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

35

(classifier1)

(classifier2)

(classifier3)

[image]

How people think about their application: The white board drawing

What are the high level operations?

What are the chunks of data?

What are the producer/consumer relationships?

What are the inputs and outputs?

Page 36: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

36

Make it precise enough to execute How do we distinguish among the instances?

(classifier1: w)

(classifier2: w)

(classifier3: w)

[image]

Page 37: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

37

Make it precise enough to execute

Control: Every step is a controllee

(classifier1: w)

(classifier2: w)

(classifier3: w)

[image]

<C3Tag: w>

<C1Tag: w>

<C2Tag: w>

What are the distinct controls?

What steps are the controllers?

Each tag collection is a subset of the previous. <C3Tag> specifies the set of faces <C3Tag> is the output of the application.

Page 38: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

38

The Environment

Environment (env) is just a normal main program

•  In addition it starts and finishes the CnC program graph

•  Using the same API used by the step code, it –  Puts items and tags (env acts as a producer) –  Gets items and tags (env acts as a consumer)

•  It has access to the CnC API for puts and gets

•  It doesn’t obey any of the constraints of CnC –  It isn’t tagged –  It isn’t single assignment –  It isn’t functional

•  Env may not know the tags of instances to get –  Consider the result of the face detector –  Iterated get on a collection

Page 39: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

39

Semantic model: instances acquire attributes

[X: 2, 28] (FOO: 3, 28)

<T: 3, 28>

and this tag is available

this step becomes enabled

When this step executes

When these items are available

This tag becomes available

[X: 3, 28] [X: 4, 28]

[Y: 3 ]

<T: 3, 29>

When this tag is available

This step will execute

(sometime)

Page 40: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

40

Influence 3: Dataflow

• CnC semantic model is like dataflow –  No extra serialization --- execution only needs to wait for data

becoming ready –  Steps are functional

• CnC differs from dataflow –  Control is elevated to first class –  Control can be available or not just as data is available or not –  Item collections allow more general indexing than dataflow arrays

(I-structures)

• References: –  “First version of a data flow procedure language”. Jack B. Dennis.

Programming Symposium, Proceedings Colloque sur la Programmation, pages 362–376, 1974.

Page 41: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

41

( ).{prescribed} ( ).{inputs-available}

Summary of attributes: Comparison with Dataflow [ ].{available} < >.{available}

( ).{inputs-available, prescribed} AKA: enabled

( ).{inputs-available, prescribed, executed}

[ ].{available} < >.{available}

Page 42: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

42

Outline 1.  Concurrent Collections Model and Languages

2.  Execution Semantics and Properties

3.  Patterns and Examples

4.  Research Topics

Page 43: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

43

CnC Abstract Interpreter •  Theoretical model used to define operational semantics for CnC

–  Actual CnC implementations will be discussed later

•  Operational semantics is defined with respect to the state of all item, tag, and step collections in a CnC program execution –  Assumes unbounded memory and unbounded number of processors

•  Abstract interpreter continues execution as long as at least one enabled step is not yet executed

•  Motivation for defining abstract interpreter and formal semantics --- establish key properties of the CnC execution model –  Determinism –  Parallelism –  Redundancy

Page 44: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

44

Definitions •  (SC:T) denotes a step in step collection SC with tag T

•  [IC:T] denotes the item in item collection IC with tag T

•  <TC:T> denotes the entry in tag collection TC with tag T •  π(SC) is the (unique) tag collection that prescribes step collection SC

•  consumedBy(SC) is the set of item collections that will be consumed by a step in step collection SC via get operations

•  producedBy(SC) is the set of item and tag collections that may be produced in step collection SC via put operations

•  prescribedBy(TC) is the set of step collections that are prescribed by tag collection TC

•  consumedBy(SC:T) is the set of item instances that will be consumed by step instance (SC:T)

We assume that a CnC program completely specifies all items that will be consumed by a step instance (strict input semantics)

A CnC program that does not satisfy this property can always be transformed to one that does

Page 45: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

45

CnC Program State •  σ = The state of an executing CnC program

•  primitive attributes of item, tag and step collections –  σ.[IC:T].Avail = true if a put operation has been performed on item

collection IC with tag T –  σ.[IC:T].Value = value stored in item collection IC with tag T

if σ.[IC:T].Avail = true, or ┴ (undefined) otherwise –  σ.<TC:T>.Avail = true if a put operation has been performed on tag

collection TC with tag T –  σ.(SC:T).Done = true if step SC(T) has executed and all its put operations

have been performed

•  The null state σ0 –  σ0.[IC:T].Avail = false for all item collections IC and tags T

–  σ0.[IC:T].Value = ┴ (undefined) for all item collections IC and tags T –  σ0.<TC:T>.Avail = false for all tag collections TC and tags T –  σ0.(SC:T).Done = false for all step collections SC and tags T

•  A value of σ = ┴ represents an error state in a CnC program in which all attributes are ┴ (undefined)

Page 46: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

46

Derived attributes •  For convenience, we define the following derived attributes that can be computed

from the primitive state attributes Avail, Value and Done

•  (SC:T).Prescribed = <π(SC):T>.Avail

–  Recall that π(SC) is the (unique) tag collection that prescribes step collection SC

•  (SC:T).InputsAvail = ∧[ICj:Tj] ε consumedBy(SC:T) [ICj:Tj].Avail

•  (SC:T).Enabled = (SC:T).Prescribed ∧ (SC:T).InputsAvail

•  The prefix σ. is omitted when it’s clear from the context which state is being referred to

Page 47: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

47

( ).Prescribed ( ).InputsAvailable

Lifecycle of Primitive and Derived Attributes [ ].Avail <>.Avail

( ).Enabled

( ).Done

[ ].Avail <>.Avail

Primitive Attribute

Derived Attribute

Page 48: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

48

Interaction of a CnC Program with its Environment: Initial State •  The initial state σi of a CnC program is obtained by starting with σ0, and then executing

an Environmental Input computation, EI –  The only CnC operations that can be performed by EI are individual put operations

on item and tag collections

•  Example

Environmental Input computation, EI: put([input: 1], “aaaffqqqmmmmmmm”); put([input: 2], “rrhhhhxxx”); put(<stringTag: 1>); put(<stringTag: 2>);

[input: j] [results: j, s] (createSpan: j) (processSpan: j, s)

<stringTag: j> <spanTag: j, s>

[span: j, s] (processSpan: j, s) [results: j, s]

Page 49: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

49

Interaction of a CnC Program with its Environment: Final State •  The final state σf of a CnC program is examined by executing an Environmental Output

computation EO that can perform the following special CnC operations: –  Nonblocking get operation on a specific item [IC:T], which returns the value if

[IC:T].Avail = true or an error code otherwise (instead of blocking) –  Iterated get operation on an item collection IC, which returns all available items

[IC:T] in IC with their values, [IC:T].Value –  Nonblocking get operation on a specific tag <TC:T> that returns the value of

<TC:T>.Avail –  Iterated get operation on a tag collection TC, which returns the tags for all available

items <TC:T> in TC

[results: 1, 1] = “aaa” [results: 1, 3] = “qqq” [results: 1, 4] = “mmmmmmm”

[input: j] [results: j, s] (createSpan: j) (processSpan: j, s)

<stringTag: j> <spanTag: j, s>

[span: j, s] (processSpan: j, s) [results: j, s]

Environmental Output computation, EO: Iterated get on results

Page 50: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

50

State Mapping for Executed Step •  Execution of step (SC:T) in state σ results in state σ’ following its

execution where σ’ = Apply(σ, (SC:T)) is derived as follows: –  For each put(IC,Ta,V) operation performed by (SC:T), σ’.[IC:Ta].Value is updated from ┴ to V and σ’.[IC:Ta].Avail is set =

true • Single Assignment Rule: If σ.[IC:T].Avail = true, then the entire

state σ’ is set to ┴ –  For each put(TC,Tb) operation performed by (SC:T), σ’.<TC:Tb>.Avail is updated from false to true • Single Assignment Rule: If σ.<TC:Tb>.Avail = true, then the entire

state σ’ is set to ┴ –  σ’.(SC:T).Done is set to true when execution of step (SC:T) is

completed • Note that all derived attributes (Prescribed, InputsAvail,

InputsReady) impacted by step (SC:T)’s execution will resolve to updated values in σ’ after step (SC:T) completes execution

Page 51: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

51

CnC Program Execution •  Red: prescribed •  Blue: inputs available •  Red & blue: enabled •  Yellow: executed

Page 52: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

52

Merge of CnC Program States

We define σ’ = Merge(σ1, σ2), the merge of states σ1 and σ2 as follows:

–  σ’.[IC:T].Avail = σ1.[IC:T].Avail ∨ σ2.[IC:T].Avail

–  σ’.[IC:T].Value = σ1.[IC:T].Value if σ2.[IC:T].Avail = false σ2.[IC:T].Value if σ1.[IC:T].Avail = false σ1.[IC:T].Value if σ1.[IC:T].Avail ∧ σ2.[IC:T].Avail ∧ σ1.[IC:T].Value = σ2.[IC:T].Value

–  σ’ = ┴ if σ1.[IC:T].Avail ∧ σ2.[IC:T].Avail ∧ σ1.[IC:T].Value ≠ σ2.[IC:T].Value

–  σ’.<TC:T>.Avail = σ1.<TC:T>.Avail ∨ σ2.<TC:T>.Avail

–  σ’.(SC:T).Done = σ1.(SC:T).Done ∨ σ2.(SC:T).Done

Page 53: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

53

Partial Order on Program States

We define a partial order relation ≤ on two non-error program states σ1 ≤ σ2 as follows:

•  σ1 ≤ σ2 if and only if all the following conditions are true for all item/tag/step collections IC, TC, SC and tags T

–  σ1 ≠ ┴ ∧ σ2 ≠ ┴ –  σ1.[IC:T].Avail ==> σ2.[IC:T].Avail

–  σ1.[IC:T].Value ≠ ┴ ==> σ2.[IC:T].Value = σ1.[IC:T].Value –  σ1.<TC:T>.Avail ==> σ2.<IC:T>.Avail –  σ1.(SC:T).Done ==> σ2.(SC:T).Done

The following results follow directly from the definition of ≤

•  If σ’ ≠ ┴ then σ0 ≤ σ’

•  If σ’ = Apply(σ, (SC:T)) ∧ σ’ ≠ ┴ ∧ σ ≠ ┴ then σ ≤ σ’

•  If σ’ = Merge(σ1, σ2) ∧ σ’ ≠ ┴ ∧ σ1 ≠ ┴ ∧ σ2 ≠ ┴ then σ1 ≤ σ’ ∧ σ2 ≤ σ’

Thus step execution and state merges lead to states that are monotonically increasing w.r.t. ≤ (when no error state is encountered)

Page 54: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

54

State Transitions in a CnC Program

• During execution, the CnC program will start with initial state σi, go through a number of state transitions •  The program is said to terminate with final state σf

when no step instance (SC:T) remains with

(SC:T).Enabled = true and (SC:T).Done = false

•  Final state σf is said to be incomplete if it contains a step instance with Prescribed = true but Done = false

Page 55: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

55

Parallel Abstract Interpreter (PAI)

• PAI assumes arbitrary resources and executes enabled steps asynchronously in parallel

• Each step starts in its input state and ends in its output state

• PAI first computes the input state of (SC:T) σ = Merge(σP, σ1, σ2, …) as the merge of all “predecessor” states of (SC:T) • σP = output state of step that prescribed (SC:T) • σj = output state of step that produced item [ICj:Tj] which is

consumedBy(SC:T)

•  The output state for (SC:T) is then computed as σ’ = Apply(σ, (SC:T))

Page 56: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

56

Sequential Abstract Interpreter (SAI)

• SAI assumes limited resources: a single processor

• Executes a single enabled step (SC:T) at a time in isolation from other steps

• Each step starts in its input state and ends in its output state

• SAI first computes the input state of (SC:T) as the output state of the previous step •  The output state for (SC:T) is then computed as σ’ =

Apply(σ, (SC:T))

Page 57: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

57

Properties of CnC Execution Semantics •  Determinism

–  For a given CnC program and input store σi, the final output store σf will be the same for all scheduled sequences of steps in the sequential abstract interpreter

•  Parallelism –  For a given CnC program and input store σi, the final output store σf will

be the same for the sequential abstract interpreter and the parallel abstract interpreter

•  Redundancy –  Consider an extension to the single assignment rule in which multiple

puts to the same item [IC:Ta] are permitted with the same value, and multiple puts to the same tag <TC:Tb> are also permitted

–  For a given CnC program and input store σi, a modified abstract interpreter with this extension in which any put to a tag <TC:T> is replicated a bounded number of times will lead to the same final output store σf as the sequential abstract interpreter

Page 58: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

58

Current implementations •  CnC is a programming model that can be embodied in multiple

programming languages

Current implementations

1.  Intel® Concurrent Collections for C++

2.  Rice Concurrent Collections for Java

3.  Rice Concurrent Collections for .NET (preliminary)

Page 59: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

59

grain distribution schedule

CnC supports not only different schedules but a wide range of runtime styles

HP TStreams

Intel CnC

Georgia Tech CnC

HP TStreams

Rice CnC

static static static

static static dynamic

static dynamic dynamic

static dynamic dynamic

dynamic dynamic dynamic

Page 60: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

60

Applications

Body tracking Heat diffusion Face detection PIRO feature extraction Black-Scholes Dedup compression Cholesky Eigenvalue solver Matrix inversion Conjugate gradient Game Of Life

Page 61: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

61

Outline 1.  Concurrent Collections Model and Languages

2.  Execution Semantics and Properties

3.  Patterns and Examples

4.  Research Topics

Page 62: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

62

Eight basic relationships between two steps •  See tutorial on the web site organized around these relationships

•  Shows a complete but very simple example for each one.

Page 63: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

63

yes no

yes

no

Control

Data

(S2) [I]

<T2>

(S1) (S2)

<T2>

(S1)

(S2) [I] (S1) (S2) (S1)

Page 64: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

64

yes no

yes

no

[I] (S)

<T>

[I] (S)

<T>

[I] (S)

<T>

[I] (S)

<T>

Control

Data

Page 65: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

65

Different step collections No constraints

•  Potential task parallelism

•  No ordering constraints

(S2) (S1)

Page 66: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

66

Different step collections Control dependence

•  If

(S1: j) -> <t2: j>

(S1: 8) may or may not put <t2: 8>

•  Nested loop

(S1: j) -> <t2: j, i>

(S1: 8) puts <t2: 8, 1>, <t2: 8, 2>, <t2: 8, 3> , …

•  Arbitrary

(S1: 8) may put <t2: 45, 526, 87>

(S2)

<T2>

(S1)

Page 67: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

67

Different step collections Data dependence

•  Standard streaming paradigm (pipeline parallelism)

Assume the same prescribing tag collection

(S2) [I] (S1)

Page 68: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

68

Different step collections Both control and data dependence

(S2) [I]

<T2>

(S1)

•  Substring span

Page 69: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

69

Same step collection No constraints

•  Loop parallel / data parallel

•  Instances of this step collection can execute in parallel

•  No cycle that we have to analyze to determine that it can be computed in parallel

[I] (S)

<T>

Page 70: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

70

Same step collection Control dependence

•  While loop

•  Data items used in the control cycle are produced outside of the control cycle

[I] (S)

<T>

Page 71: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

71

Same step collection Data dependence

•  Iterative loop

•  Control tags used in the data cycle are produced outside of the data cycle

[I] (S)

<T>

Page 72: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

72

Same step collection Control and data dependences

See next few slides

[I] (S)

<T>

Page 73: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

73

While loop

(whileBody)

[whileItem]

<whileTag>

Initial item Output items

initial tag Optionally output tags

Page 74: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

74

Divide and conquer

(divide)

[divideItem]

<divideTag>

(conquer)

[conquerItem]

<conquerTag> Root tag Leaf tags

Root tag

Leaf tags

Root item Leaf items

Leaf items Root item

Page 75: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

75

Outline 1.  Concurrent Collections Model and Languages

2.  Execution Semantics and Properties

3.  Implementation Approaches

4.  Patterns and Examples

5.  Research Topics Pop up a level and

look at what we’ve done

Page 76: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

76

The problem

• Most serial languages over-constrain orderings – Require arbitrary serialization –  Allow for overwriting of data –  The decision of if and when to execute are bound together

• Most parallel programming languages are embedded within serial languages

–  Inherit problems of serial languages –  Too specific wrt type of parallelism in the application and

wrt the type target architecture

The solution

•  Isolate roles –  Easier for the domain expert – Maximum flexibility for tuning expert

Page 77: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

77

explicitly serial languages (over-constrained)

explicitly parallel languages (over-constrained)

Concurrent Collections (only semantically required constraints)

Raise the level of the programming model just enough to avoid over-constraints

Page 78: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

78

Mapping to target platform

The work of the tuning expert •  Architecture •  Actual parallelism •  Locality •  Overhead •  Load balancing •  Distribution among processors •  Scheduling within a processor

The work of the domain expert •  Semantic correctness •  Constraints required by the application

Concurrent Collections Spec

The application problem The domain expert does not need to know about parallelism

Intel® Concurrent Collections

The tuning expert does not need to know about the domain.

Goal: serious separation of concerns:

Page 79: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

79

Outline 1.  Concurrent Collections Model and Languages

2.  Execution Semantics and Properties

3.  Patterns and Examples

4.  Research Topics

Page 80: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

80

A model not a language

• Don’t care about syntax –  GUI, Textual representation, Class library

• Variety of different choices based on trade-offs among: –  Efficiency –  Ease-of-use –  Generality –  Guarantees –  …

Any suggestions for the names?

•  The tag of a get can depend on the tag of the step. Can it also depend on contents of a previously gotten item?

•  Do we check for single assignment or allow multiple puts as long as the contents are the same?

•  Do we allow for continuous I/O? •  Do we require tags of puts to be static function

of step tag?

Page 81: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

81

Possible projects and research efforts

•  Above CnC: Applications & applications support •  Within CnC: Functionality •  Within CnC: Theory •  Below CnC: Runtime/targets •  On the side of CnC: Tools

Page 82: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

82

Above CnC:

•  Applications

•  Domain-specific variants (e.g., finance, graphics, database operations, medical imaging)

Page 83: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

83

Within CnC: Functionality

•  Hierarchy

•  Reductions

•  Continuous applications •  Improved garbage collection

(especially with continuous applications)

•  Support for memory optimizations (e.g., in-place algorithms)

Page 84: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

84

Hierarchical step collections

<spanTag: s>

(createSpan) (processSpan: s) [span: s] [input] [results: s]

Page 85: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

85

Future: Hierarchical step collections

<stringTag: j>

•  (createSpan) is prescribed by prescriber of parent •  j is not visible inside (only s is visible) •  Runtime manages j to distinguish among instances •  is a renaming

[input: j] [results: j, s]

<spanTag: s>

(createSpan) (processSpan: s) [span: s] [input] [results: s]

(highStep: j)

Page 86: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

86

Possible efforts: Within CnC: theory

•  Variety of languages –  theoretical aspects of continuous programs –  theoretical aspects of CnC with controlled non-determinism

•  Universal CnC program •  A CnC interpreter in CnC

Page 87: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

87

Name distinction vs tag distinction

<Tony: j>

[x: j]

[z: q]

(fooA: j)

(fooB: j)

[y: j]

<Tony: j>

[x: j]

[z: q]

(foo: AB, j)

[y: j]

•  Merge collections •  Name distinction becomes tag distinction •  Same grain •  Same potential parallelism •  Same information

Page 88: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

88

Name distinction vs tag distinction

<Tony: j>

[x: j]

[z: q]

(fooA: j)

(fooB: j)

[y: j]

<Tony: j>

[x: j]

[z: q]

(foo: AB, j)

[y: j]

•  Merge collections •  Name distinction becomes tag distinction •  Same grain •  Same potential parallelism •  Lose information that (fooB) does not get [y]

Page 89: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

89

Universal CnC specification

[items] (steps)

<tags>

•  End result of maximal merging of any program •  Can we input and execute any CnC program with this universal spec? •  What would we need to add?

Page 90: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

90

Below CnC: Runtime

•  Identification of dead items

• Additional targets

• Checkpoint / restart (existed at HP)

• Checkpoint / continue (new)

Page 91: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

91

Identification of dead items •  Not classic GC

–  All prescribed step instances that get the item may have been executed but …

–  A step instance not yet prescribed may eventually get item that item

•  Currently implementation: Support user supplied getCount function

•  Future: May support hierarchy. Item in scope of hierarchical node is dead

when hierarchical node terminates May support hybrid. getCount function on hierarchical nodes

•  Theoretical result: presented later

Page 92: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

92

Enabled Blue steps

Enabled Red steps

Dynamic GPU/vector operations

Red step collection Blue step collection

All enabled steps

Single bucket Bucket per collection

Page 93: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

93

ILP

<b> <i, j> <b, i, j >

Red step collection Blue step collection

Step fusion yields additional parallelism Red-blue step collection

Compiled independently for ILP For ILP, compiled together assuming independence between red and blue

Page 94: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

94

Enabled Blue steps

Enabled Red steps

Pick •  an enabled blue step •  an enabled red step or •  one of each

ILP

Page 95: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

95

Possible efforts: on the side of CnC: tools

•  CnC debugger

•  CnC performance tuner •  CnC visualizer

•  CnC diff

Page 96: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

96

The academic community •  Rice University

•  Vivek Sarkar •  Zoran Budimlic •  Vincent Cavé •  David Peixotto •  Sagnak Tasirlar (also Intel intern)

•  Georgia Tech •  Rich Vuduc •  Aparna Chandramowlishwaran (also Intel intern) •  Kishore Ramachandran •  Hasnain Mandviwala (intern + PhD thesis)

•  Colorado State University •  Michelle Strout •  Jon Roelofs

•  Novosibirsk State University •  Nikolay Kurtov (also Intel intern)

•  Washington University – St Louis •  Kunal Agrawal (in transition from MIT)

Page 97: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

97

The Intel community The HP community •  DPD

Shin Lee Steve Rose Leo Treggiari Ilya Cherny Frank Schlimbach Ganesh Rao Nikolay Kurtov

•  SPI Kath Knobe Geoff Lowney Mark Hampton Ryan Newton

•  Others Steve Lang John Pieper

•  Cambridge Research Lab Kath Knobe Carl Offner Alex Nelson

Page 98: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

98

Papers

•  Capsules: Expressing Composable Computations in a Parallel Programming Model. Hasnain A. Mandviwala, Umakishore Ramachandran, and Kathleen Knobe. LCPC’07

•  TStreams: A Model of Parallel Computation (Preliminary Report). Knobe, Kathleen; Offner, Carl D. HPL-2004-78R1

•  Weak Dynamic Single Assignment Form. Carl Offner, Kathleen Knobe, HPL-2003-169(R.1)August 1, 2005*

•  Compiling to TStreams, a New Model of Parallel Computation. Knobe, Kathleen; Offner, Carl HPL-2005-138

•  TStreams: How to Write a Parallel Program Knobe, Kathleen; Offner, Carl D. HPL-2004-193

•  Multi-core Implementations of the Concurrent Collections Programming Model. Zoran Budimlić, Aparna Chandramowlishwaran, Kathleen Knobe, Geoff Lowney, Vivek Sarkar, and Leo Treggiari. CPC’09.

•  Declarative aspects of memory management in the concurrent collections parallel programming model.

Zoran Budimlić, Aparna Chandramowlishwaran, Kathleen Knobe, Geoff Lowney, Vivek Sarkar, and Leo Treggiari. The 4th workshop on Declarative aspects of multicore programming. Savannah, GA, USA. 2009

•  Ease of use with Concurrent Collections (CnC). Kathleen Knobe. First USENIX Workshop on Hot Topics in Parallelism (HotPar ‘09)

Page 99: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

99

Sites •  Intel Windows version:

http://whatif.intel.com

http://software.intel.com/en-us/articles/intel-concurrent-collections-for-cc

•  Intel Linux version:

contact [email protected]

•  Rice web site:

http://habanero.rice.edu/cnc

Page 100: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

100

Tutorial Acknowledgments

•  Zoran Budimlić •  Michael Burke •  Aparna Chandramowlishwaran •  Shin Lee •  Geoff Lowney •  David Peixotto •  Leo Treggiari •  Rich Vuduc

Page 101: The Concurrent Collections (CnC) Parallel …vs3/PDF/CnC-tutorial.pdfThe Concurrent Collections (CnC) Parallel Programming Model Tutorial Kathleen Knobe – Intel Vivek Sarkar –

Copyright © 2006, Intel Corporation. All rights reserved. Prices and availability subject to change without notice. *Other brands and names are the property of their respective owners

*Intel and the Intel logo are registered trademarks of Intel Corporation. Other brands and names are the property of their respective owners

101