15
A Hands-on Introduction to the CnC Programming Model Nick Vrvilo, Two Sigma Investments [email protected] 9 th Annual Concurrent Collections Workshop Texas A&M University – College Station, TX October 13, 2017

Introduction to CnC-OCR · The CnC programming model •Programming model (not a language) •Graph coordination –Declare data itemsand computation steps –Similar computation/data

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Introduction to CnC-OCR · The CnC programming model •Programming model (not a language) •Graph coordination –Declare data itemsand computation steps –Similar computation/data

A Hands-on Introduction to the CnC Programming Model

Nick Vrvilo, Two Sigma [email protected]

9th Annual Concurrent Collections WorkshopTexas A&M University – College Station, TX

October 13, 2017

Page 2: Introduction to CnC-OCR · The CnC programming model •Programming model (not a language) •Graph coordination –Declare data itemsand computation steps –Similar computation/data

The CnC programming model

• Programming model (not a language)

• Graph coordination– Declare data items and computation steps– Similar computation/data instances

grouped into collections

• Data items use single assignment– A given item’s value cannot be updated

• Step functions written in host language

2

Page 3: Introduction to CnC-OCR · The CnC programming model •Programming model (not a language) •Graph coordination –Declare data itemsand computation steps –Similar computation/data

Simple CnC graph sketch

Step X

Data A

Data B

Step Yinitializer

“GET”

“PRESCRIBE”

“PUT”

finalizer

3

Page 4: Introduction to CnC-OCR · The CnC programming model •Programming model (not a language) •Graph coordination –Declare data itemsand computation steps –Similar computation/data

Step X⟨x⟩

Data A⟨x-1⟩

Step Y⟨x*2⟩

Data B⟨x, 1..10⟩

CnC input/output relations(“tag functions”)

4

Page 5: Introduction to CnC-OCR · The CnC programming model •Programming model (not a language) •Graph coordination –Declare data itemsand computation steps –Similar computation/data

Benefits of the CnC model

• Collection relationships are declarative

• Exposes implicit parallelism

• Program structure follows naturally from the “whiteboard” design process

5

Page 6: Introduction to CnC-OCR · The CnC programming model •Programming model (not a language) •Graph coordination –Declare data itemsand computation steps –Similar computation/data

Thanks to Kath Knobe for this LULESH sketch6

Page 7: Introduction to CnC-OCR · The CnC programming model •Programming model (not a language) •Graph coordination –Declare data itemsand computation steps –Similar computation/data

Final Graph

After analyzing the graph we came up with the following result

Thanks to Ellen Porter for this LULESH graph7

Page 8: Introduction to CnC-OCR · The CnC programming model •Programming model (not a language) •Graph coordination –Declare data itemsand computation steps –Similar computation/data

CnC-OCR workflow

1. Specify CnC graph• Currently in text form• Ideally provide a graphical tool

2. Run graph translator tool• Parses the textual graph specification• Provides step function skeleton (suggested code)• Generates makefile, scaffolding code

3. Implement step function bodies4. Compile and run the application

8

Page 9: Introduction to CnC-OCR · The CnC programming model •Programming model (not a language) •Graph coordination –Declare data itemsand computation steps –Similar computation/data

3-point 1D stencilHands-on example

9

Page 10: Introduction to CnC-OCR · The CnC programming model •Programming model (not a language) •Graph coordination –Declare data itemsand computation steps –Similar computation/data

Stencil description

• 3-point stencil over a vector of size N

• ai,t vector element at index i on timestep t

10

Page 11: Introduction to CnC-OCR · The CnC programming model •Programming model (not a language) •Graph coordination –Declare data itemsand computation steps –Similar computation/data

Vector at t=0

1 0 0 0 0 0 0 0 0 0 1

11

Page 12: Introduction to CnC-OCR · The CnC programming model •Programming model (not a language) •Graph coordination –Declare data itemsand computation steps –Similar computation/data

Tiling the vector

1 0 0 0 0 0 0 0 0 0 1

1 0 0 0 0 0 0 0 0 0 1

12

Page 13: Introduction to CnC-OCR · The CnC programming model •Programming model (not a language) •Graph coordination –Declare data itemsand computation steps –Similar computation/data

Calculating values for t=1

1 0 0 0 0 0 0 0 0 0 1

1 1

t = 0

t = 1

¼ 0 0 0 0 0 0 0 ¼

13

Page 14: Introduction to CnC-OCR · The CnC programming model •Programming model (not a language) •Graph coordination –Declare data itemsand computation steps –Similar computation/data

Time to code!

1. Install Intel CnC:https://icnc.github.io/

2. Install the Habanero CnC Framework:https://github.com/habanero-rice/cnc-framework

3. Get CnC Framework dependencies(  just run the translator tool: ucnc_t )

14

Page 15: Introduction to CnC-OCR · The CnC programming model •Programming model (not a language) •Graph coordination –Declare data itemsand computation steps –Similar computation/data

1 0 0 0 0 0 0 0 0 0 1

1 1

t = 0

t = 1

¼ 0 0 0 0 0 0 0 ¼

15