Concurrent Collections (CnC) A programming model for parallel programming 1Dennis Kafura – CS5204 – Operating Systems.

Slides:



Advertisements
Similar presentations
HABANERO CNC Sagnak Tasirlar 1. Acknowledgments 2  Rice  Vivek Sarkar, Zoran Budimlic, Michael Burke, Philippe Charles  Vincent Cave,
Advertisements

Character and String definitions, algorithms, library functions Characters and Strings.
CS7100 (Prasad)L16-7AG1 Attribute Grammars Attribute Grammar is a Framework for specifying semantics and enables Modular specification.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
Names and Bindings.
Prof. Necula CS 164 Lecture 141 Run-time Environments Lecture 8.
Chapter 10 Introduction to Arrays
CS16 Week 2 Part 2 Kyle Dewey. Overview Type coercion and casting More on assignment Pre/post increment/decrement scanf Constants Math library Errors.
Chapter Four Data Types Pratt 2 Data Objects A run-time grouping of one or more pieces of data in a virtual machine a container for data it can be –system.
COEN Expressions and Assignment
(1) ICS 313: Programming Language Theory Chapter 10: Implementing Subprograms.
Chapter 8 Runtime Support. How program structures are implemented in a computer memory? The evolution of programming language design has led to the creation.
CS 151 Digital Systems Design Lecture 37 Register Transfer Level
CS 536 Spring Run-time organization Lecture 19.
3/17/2008Prof. Hilfinger CS 164 Lecture 231 Run-time organization Lecture 23.
Tutorial 6 & 7 Symbol Table
Abstract Data Types (ADT)
CS-341 Dick Steflik Introduction. C++ General purpose programming language A superset of C (except for minor details) provides new flexible ways for defining.
HAS. Patterns The use of patterns is essentially the reuse of well established good ideas. A pattern is a named well understood good solution to a common.
Run-time Environment and Program Organization
1 Run time vs. Compile time The compiler must generate code to handle issues that arise at run time Representation of various data types Procedure linkage.
C++ for Engineers and Scientists Third Edition
Building An Interpreter After having done all of the analysis, it’s possible to run the program directly rather than compile it … and it may be worth it.
1 CMSC 132: Object-Oriented Programming II Java Constructs Department of Computer Science University of Maryland, College Park.
C++ fundamentals.
Chapter 5 new The Do…Loop Statement
Principles of Programming Chapter 1: Introduction  In this chapter you will learn about:  Overview of Computer Component  Overview of Programming 
SEC(R) 2008 Intel® Concurrent Collections for C++ - a model for parallel programming Nikolay Kurtov Software and Services.
1 Chapter 5: Names, Bindings and Scopes Lionel Williams Jr. and Victoria Yan CSci 210, Advanced Software Paradigms September 26, 2010.
Computer Architecture Computational Models Ola Flygt V ä xj ö University
High-Level Programming Languages: C++
COP 4620 / 5625 Programming Language Translation / Compiler Writing Fall 2003 Lecture 10, 10/30/2003 Prof. Roy Levow.
 200 Total Points ◦ 74 Points Writing Programs ◦ 60 Points Tracing Algorithms and determining results ◦ 36 Points Short Answer ◦ 30 Points Multiple Choice.
1 Names, Scopes and Bindings Aaron Bloomfield CS 415 Fall
Chapter 6 Programming Languages (2) Introduction to CS 1 st Semester, 2015 Sanghyun Park.
1 Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi.
Lecture 1 Introduction Figures from Lewis, “C# Software Solutions”, Addison Wesley Richard Gesick.
COP4020 Programming Languages Names, Scopes, and Bindings Prof. Xin Yuan.
1 Memory Management (b). 2 Paging  Logical address space of a process can be noncontiguous; process is allocated physical memory whenever the latter.
XML 2nd EDITION Tutorial 4 Working With Schemas. XP Schemas A schema is an XML document that defines the content and structure of one or more XML documents.
Unit 2 Architectural Styles and Case Studies | Website for Students | VTU NOTES | QUESTION PAPERS | NEWS | RESULTS 1.
CS 460/660 Compiler Construction. Class 01 2 Why Study Compilers? Compilers are important – –Responsible for many aspects of system performance Compilers.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
Copyright Curt Hill Variables What are they? Why do we need them?
Concurrency Control 1 Fall 2014 CS7020: Game Design and Development.
Concurrency in Java MD. ANISUR RAHMAN. slide 2 Concurrency  Multiprogramming  Single processor runs several programs at the same time  Each program.
Chapter 9 Introduction to Arrays Fundamentals of Java.
© 2006 Lawrenceville Press Slide 1 Chapter 4 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration.
Slide 1 Chapter 3 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration statement. For example: Dim.
LESSON 8: INTRODUCTION TO ARRAYS. Lesson 8: Introduction To Arrays Objectives: Write programs that handle collections of similar items. Declare array.
Code Generation Instruction Selection Higher level instruction -> Low level instruction Register Allocation Which register to assign to hold which items?
Processes and threads.
Lecture 1 Introduction Richard Gesick.
Type Checking, and Scopes
The Concurrent Collections (CnC)
System Programming and administration
CS 326 Programming Languages, Concepts and Implementation
Run-time organization
Introduction to Scripting
Java Review: Reference Types
CS 2308 Final Exam Review.
Names, Binding, and Scope
Distributed System Gang Wu Spring,2018.
Binding Times Binding is an association between two things Examples:
Languages and Compilers (SProg og Oversættere)
Course Overview PART I: overview material PART II: inside a compiler
Outline Chapter 2 (cont) Chapter 3: Processes Virtual machines
Prof. Onur Mutlu Carnegie Mellon University
Introduction to C CS 3410.
Presentation transcript:

Concurrent Collections (CnC) A programming model for parallel programming 1Dennis Kafura – CS5204 – Operating Systems

Concurrent Collections CnC Dennis Kafura – CS5204 – Operating Systems2 Kathleen Knobe Intel

Concurrent Collections Overview Ideas  Separate if an operation is executed from when that operation is executed Focus on ordering constraints dictated by semantics of application Programming languages usually bind these together  Overburdens development effort  Limits implementation alternatives  Dynamic single assignment Use write-once values rather than variables (locations) Avoids issues of synchronization, overwriting, etc. Dennis Kafura – CS5204 – Operating Systems3

Concurrent Collections Overview Representations  Diagram (“whiteboard”) version and text formats  Relationships between high level operations (steps) Data dependencies (producer-consumer relationship) Control dependencies (controller-controllee relationship)  High level operations (steps) Purely functional Implemented in conventional programming language Dennis Kafura – CS5204 – Operating Systems4 Note: figure from presentation by Kathleen Knobe (Intel) and Vivek Sarkar (Rice)

Concurrent Collections Overview Advantages  Allows roles and expertise of domain expert and tuning expert to be differentiated and combined by allowing each to focus on the aspects of the computation related to their expertise. Domain expert need not know about parallelism Tuning expert need not know about domain Dennis Kafura – CS5204 – Operating Systems5 Note: figure from presentation by Kathleen Knobe (Intel) and Vivek Sarkar (Rice)

Concurrent Collections Overview Advantages (cont.)  Avoids specifying/reasoning/deducing which operations can execute in parallel This is difficult to do Depends on architecture  Allows run-time support to be tailored for different architectures  Creates portability across different architectures Dennis Kafura – CS5204 – Operating Systems6

Concurrent Collections Basic Structures ElementCnC nameGraphical formTextual form computationstep(foo) dataitem[x] controltag environmentenv Dennis Kafura – CS5204 – Operating Systems7 foo T x

Concurrent Collections Simple Example Dennis Kafura – CS5204 – Operating Systems8 “aaaffqqqmmmmmmm” “aaa” “ff” “qqq” “mmmmmmm” “aaa” “qqq” “mmmmmmm” Produce odd length sequences of consecutive identical characters span string

Concurrent Collections Relations Dennis Kafura – CS5204 – Operating Systems9 span string producer consumer prescriptive

Concurrent Collections Item Collections Dennis Kafura – CS5204 – Operating Systems 10 [“aaaffqqqmmmmmmm” : 1] span string Multiple item instances correspond to different values of the item kind Each instance is distinguished by a user-defined instance tag [“aaa” :1,1] [“qqq” : 1,3] [“mmmmmmm” : 1,4] input [“aaa” :1,1] [“ff” : 1,2] [“qqq” : 1,3] [“mmmmmmm” : 1,4] span results

Concurrent Collections Step Collections Dennis Kafura – CS5204 – Operating Systems 11 span string Multiple steps instances correspond to different instantiations of the code implementing the step Each instance is distinguished by a user-defined instance tag (createSpan : 1) createSpan (processSpan :1,1) (processSpan : 1,2) (processSpan : 1,3) (processSpan : 1,4) processSpan

Concurrent Collections Tag Collections Dennis Kafura – CS5204 – Operating Systems 12 span string Tag collections are sets of tags of the same type/structure as the step with which they are associated spanTags stringTags

Concurrent Collections Execution Semantics Dennis Kafura – CS5204 – Operating Systems13 [“qqq” : 1,3] span (processSpan : 1,3) processSpan spanTags A step instance with a given tag will execute when a matching tag instance is present, and the step instances matching inputs are available

Concurrent Collections Semantics When (S : t1) executes, if it produces [I, t2], then [I, t2] becomes available. When (S : t1) executes, if it produces, then becomes available. If prescribes (S), when is available then (S : t) becomes prescribed. If forall {I, t1] such that (S: t2) gets [I, t1] [I,t1] is available // if all inputs of (S: t2) are available then (S: t2) is inputs-available. If (S: t) is both inputs-available and prescribed then is its enabled. Any enabled step is ready to execute. Dennis Kafura – CS5204 – Operating Systems14

Concurrent Collections Semantics Execution frontier: the set of instances that have any attributes and are not dead. Program termination: no step is currently executing and no unexecuted step is currently enabled. Valid program termination: a program terminates and all prescribed steps have executed. Instances that are dead may be garbage collected. Note: parallel execution is possible but not mandated; thus testing/debugging on a sequential machine is possible. Dennis Kafura – CS5204 – Operating Systems15

Concurrent Collections Sources of Parallelism Dennis Kafura – CS5204 – Operating Systems 16 [“aaaffqqqmmmmmmm” : 1] [“bbbxxxxxxffxxxxxyy” : 2] span string (processSpan :1,1) input [“aaa” :1,1] [“ff” : 1,2] [“qqq” : 1,3] [“ff” : 2,3] spanexecuting [“bbb” : 2,1] [“mmmmmmm” : 1,4] [“xxxxxx” : 2, 2] (processSpan :1,3) (processSpan :2,2) (processSpan : 2,3) (createSpan : 2)

Concurrent Collections Textual Representation Dennis Kafura – CS5204 – Operating Systems17 ; [input: int stringID]; [span: int stringID, int spanID]; [results: int stringID, int spanID]; env -> [input], ; [results], -> env; span string

Concurrent Collections Textual Representation Dennis Kafura – CS5204 – Operating Systems18 :: (createSpan); :: (processSpan); [input: stringID] -> (createSpan: stringID); (createSpan: stringID) -> ; (createSpan: stringID) -> [span: stringID, spanID]; [span: stringID, spanID] -> (processSpan: stringID, spanID); (processSpan: stringID, spanID) -> [results: stringID, spanID]; span string

Concurrent Collections Mechanics Dennis Kafura – CS5204 – Operating Systems19 Note: graphics from Kathleen Knobe (Intel), Vivek Sarkar (Rice), PLDI Tuturial, 2009

Concurrent Collections A coded step Dennis Kafura – CS5204 – Operating Systems20 int createSpan::execute(const int & t, partStr_context & c) const { string in; c.input.get(t, in); if(! in.empty()) { char ch – in[0]; int len = 0; unsigned int i=0; unsigned int j = 0; while (i < in.length()) { if (in[j] == ch) { i++; len++; } else { c.span.put(t, j, in.substr(j, len)); c.spanTags.put (t,j); ch = in[i]; len = 0; j = i; } c.span.put(t, j, in.substr(j.len); c.spanTags,put(t, j); } return CnC::CNC_Success; }

Concurrent Collections Another Example Dennis Kafura – CS5204 – Operating Systems21

Concurrent Collections Patterns – steps in different collections Dennis Kafura – CS5204 – Operating Systems22

Concurrent Collections Patterns – steps in same collection Dennis Kafura – CS5204 – Operating Systems23

Concurrent Collections Performance Dennis Kafura – CS5204 – Operating Systems24 Acknowledgements: Aparna Chandramolishwaran, Rich Vuduc (Georgia Tech)

Concurrent Collections Performance Dennis Kafura – CS5204 – Operating Systems25 TBB implementation, 8-way Intel dual Xeon Harpertown SMP system.

Concurrent Collections Performance Dennis Kafura – CS5204 – Operating Systems26 Habenero-Java implementation, 8-way Intel dual Xeon Harpertown SMP system.

Concurrent Collections Performance Dennis Kafura – CS5204 – Operating Systems27 Acknowledgements: Aparna Chandramolishwaran, Rich Vuduc (Georgia Tech)

Concurrent Collections Performance Dennis Kafura – CS5204 – Operating Systems28 Input stream compression using “deduplication”

Concurrent Collections Memory management Problem  the lifetime of a produced (data) item is not clear  the (data) item may be used by multiple steps  some step using a (data) item may not exist yet  Serious problem for long-running computations Solution  Declarative annotations (slicing annotations) added to step implementations  Indicates which (data) items will be read by the step  Converted into reference counting procedures Dennis Kafura – CS5204 – Operating Systems29

Concurrent Collections Memory states 5 memory states Note: no transition from FREE to ITEM Assumes step implementation manages local stack and local heap correctly Dennis Kafura – CS5204 – Operating Systems30

Concurrent Collections Annotations Dennis Kafura – CS5204 – Operating Systems31 General form: (S: I) is in readers( [C: T]), constraints(I,T)

Concurrent Collections Conditions for removing an item Dennis Kafura – CS5204 – Operating Systems32

Concurrent Collections Performance Memory usage did not vary with number of cores Optimal (running time) tile size was 125 (for above case) Memory savings a factor of 7 In other cases, memory savings a factor of 14 Dennis Kafura – CS5204 – Operating Systems33