Dynamic Determinism Checking for Structured Parallelism Edwin Westbrook 1, Raghavan Raman 2, Jisheng Zhao 3, Zoran Budimlić 3, Vivek Sarkar 3 1 Kestrel.

Slides:



Advertisements
Similar presentations
1 Lecture 5 Towards a Verifying Compiler: Multithreading Wolfram Schulte Microsoft Research Formal Methods 2006 Race Conditions, Locks, Deadlocks, Invariants,
Advertisements

wwwcsif.cs.ucdavis.edu/~jacksoni
Operating Systems Semaphores II
Chapter 14 Graph class design Bjarne Stroustrup
Software Transactional Objects Guy Eddon Maurice Herlihy TRAMP 2007.
Introduction to C Programming
Wait-Free Linked-Lists Shahar Timnat, Anastasia Braginsky, Alex Kogan, Erez Petrank Technion, Israel Presented by Shahar Timnat 469-+
Lists Chapter 4 Carrano, Data Structures and Abstractions with Java, Second Edition, (c) 2007 Pearson Education, Inc. All rights reserved X.
Operating Systems: Monitors 1 Monitors (C.A.R. Hoare) higher level construct than semaphores a package of grouped procedures, variables and data i.e. object.
IBM T. J. Watson Research Center Conditions for Strong Synchronization Maged Michael IBM T J Watson Research Center Joint work with: Martin Vechev, Hagit.
IBM Research: Software Technology © 2006 IBM Corporation 1 Programming Language X10 Christoph von Praun IBM Research HPC WPL Sandia National Labs December.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 6 Disclaimer. These notes are derived from notes originally.
Introduction to Concurrency
Introduction to Recursion and Recursive Algorithms
Yoshi
HABANERO CNC Sagnak Tasirlar 1. Acknowledgments 2  Rice  Vivek Sarkar, Zoran Budimlic, Michael Burke, Philippe Charles  Vincent Cave,
Java Review Interface, Casting, Generics, Iterator.
Scalable and Precise Dynamic Datarace Detection for Structured Parallelism Raghavan RamanJisheng ZhaoVivek Sarkar Rice University June 13, 2012 Martin.
Chapter 6: Process Synchronization
5.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 5: CPU Scheduling.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
Process Synchronization. Module 6: Process Synchronization Background The Critical-Section Problem Peterson’s Solution Synchronization Hardware Semaphores.
Exception Handling – illustrated by Java mMIC-SFT November 2003 Anders P. Ravn Aalborg University.
UML Activity Diagrams In UML an activity diagram is used to display the sequence of actions They show the workflow from start to finish Detail the many.
Lists Chapter 4. 2 Chapter Contents Specifications for the ADT List Redefining the Specifications Using the ADT List Using a List Is Like Using a Vending.
Testing Concurrent Programs COMP Production Programming Mathias Ricken Rice University Spring 2009.
Language Evaluation Criteria
System/Software Testing
And other languages…. must remember to check return value OR, must pass label/exception handler to every function Caller Function return status Caller.
Bags Chapter 1 Copyright ©2012 by Pearson Education, Inc. All rights reserved.
Concurrency, Mutual Exclusion and Synchronization.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
ROBERT BOCCHINO, ET AL. UNIVERSAL PARALLEL COMPUTING RESEARCH CENTER UNIVERSITY OF ILLINOIS A Type and Effect System for Deterministic Parallel Java *Based.
Exceptions Handling Exceptionally Sticky Problems.
CS 206 Introduction to Computer Science II 09 / 10 / 2009 Instructor: Michael Eckmann.
Semaphores, Locks and Monitors By Samah Ibrahim And Dena Missak.
COMP 111 Threads and concurrency Sept 28, Tufts University Computer Science2 Who is this guy? I am not Prof. Couch Obvious? Sam Guyer New assistant.
Internet Software Development Controlling Threads Paul J Krause.
Lists Chapter 4. 2 Chapter Contents Specifications for the ADT List Redefining the Specifications Using the ADT List Java Class Library: The Interface.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 7: Process Synchronization Background The Critical-Section Problem Synchronization.
Reasoning about programs March CSE 403, Winter 2011, Brun.
(c) University of Washington15-1 CSC 143 Java List Implementation via Arrays Reading: 13.
Lists Chapter 4 Slides by Steve Armstrong LeTourneau University Longview, TX  2007,  Prentice Hall.
Advanced Concurrency Topics Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
Lists Chapter 4. 2 Chapter Contents Specifications for the ADT List Redefining the Specifications Using the ADT List Using a List Is Like Using a Vending.
Discussion Week 2 TA: Kyle Dewey. Overview Concurrency Process level Thread level MIPS - switch.s Project #1.
Chapter 3 Collections. Objectives  Define the concepts and terminology related to collections  Explore the basic structures of the Java Collections.
Final Review. From ArrayLists to Arrays The ArrayList : used to organize a list of objects –It is a class in the Java API –the ArrayList class uses an.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Concurrency & Dynamic Programming.
COSC 3407: Operating Systems Lecture 9: Readers-Writers and Language Support for Synchronization.
Error Handling Tonga Institute of Higher Education.
Written by: Dr. JJ Shepherd
Collections Dwight Deugo Nesa Matic
(c) University of Washington20c-1 CSC 143 Binary Search Trees.
Exception and Exception Handling. Exception An abnormal event that is likely to happen during program is execution Computer could run out of memory Calling.
Functional Processing of Collections (Advanced) 6.0.
1 Stacks Abstract Data Types (ADTs) Stacks Application to the analysis of a time series Java implementation of a stack Interfaces and exceptions.
Java Exceptions a quick review….
Pointers and Linked Lists
Pointers and Linked Lists
Handling Exceptionally Sticky Problems
Java Programming Language
Synchronization Lecture 23 – Fall 2017.
CSC 143 Binary Search Trees.
Introduction to Programming
Handling Exceptionally Sticky Problems
Copyright ©2012 by Pearson Education, Inc. All rights reserved
Software Engineering and Architecture
CSE 542: Operating Systems
Presentation transcript:

Dynamic Determinism Checking for Structured Parallelism Edwin Westbrook 1, Raghavan Raman 2, Jisheng Zhao 3, Zoran Budimlić 3, Vivek Sarkar 3 1 Kestrel Institute 2 Oracle Labs 3 Rice University

Deterministic Parallelism for the 99% Parallelism is crucial for performance Hard to understand for most programmers Deterministic parallelism is much easier In many cases, non-determinism is a bug How to catch / prevent non-determinism bugs?

Two Sorts of Code 1.High-performance parallel libraries – Uses complex and subtle parallel constructs – Written by concurrency experts: the 1% 2.Deterministic application code – Uses parallel libraries in a deterministic way – Parallelism behavior is straightforward – Written by everybody else: the 99% We focus on application code

Determinism via Commutativity 1.Identify pairs of operations which commute – Operations = parallel library primitives (the 1%) – Verified independently of this work 2.Ensure operations in parallel tasks commute – I.e., verify the application code (the 99%)

Our Approach: HJd HJd = Habanero Java with determinism – Builds on our prior race-freedom work [RV11,ECOOP12] Determinism is checked dynamically – For application code, not parallel libraries Determinism failures throw exceptions – Because non-determinism is a bug! Checking itself uses a deterministic structure Leads to low overhead: 1.26x slowdown!

Example: Counting Factors in Parallel class CountFactors { int countFactors (int n) { AtomicInteger cnt = new AtomicInteger(); finish { for (int i = 2; i < n; ++i) async { if (n % i == 0) cnt.increment(); }} return cnt.get (); }} Fork task Join child tasks Increment cnt in parallel Get result after finish

Specifying Commutativity for Libraries Methods annotated with commutativity sets – Each pair of methods in set commute 1, …,S n } – States method is in sets S 1 through S n – Commutes with all other methods in these sets

Commutativity Sets for AtomicInteger final class AtomicInteger int get () {... void increment() {... void decrement() {... int initValue() {... } int incrementAndGet () {... } get commutes with itself inc/dec commute with themselves and each other Commutes with anything Commutes with nothing (not even itself)

Irreflexive Commutativity Some methods do not commute with themselves, but commute with other methods Specified

Example #2: Blocking Atomic Queues final class void add (Object o) Object remove () {... } } Add and remove commute: queue order unchanged Self-commuting add (or remove) changes the queue!

Commutativity means Commutativity Queue add might self-commute for some uses – E.g. worklist-based algorithms: each queue item is consumed in the same way Still cannot mark add as self-commuting Instead, change library to capture use case

Example #3: Atomic Worklists final class AtomicWorklist { interface Handler () { void handle (Object o); } void setHandler (Handler h) {... void add (Object o) {... } } Now add self-commutes: all elems get same handler

Dynamically Verifying Determinism Each parallel library call a dynamic check – Ensures no non-commuting methods could possibly run in parallel HJd exposes these checks to the user – Construct called permission region [RV 11] – Many calls can be grouped into one check – See our paper for more details

The Key to Dynamic Checks: DPST DPST = Dynamic Program Structure Tree Deterministic representation of parallelism May-happen-in-parallel check with no synch – Low overhead!

DPST by Example finish { async { S1; } S2; } S3; } F F F F S3 A A S1 S2

May-Happen-In-Parallel with DPST 1.Find least common ancestor (LCA) of 2 nodes 2.Check if leftmost child of LCA on LCA node path is an async 3.If so, return true, otherwise return false

MHIP with DPST finish { async { S1; } S2; } S3; } F F F F S3 A A S1 S2 Not in parallel

MHIP with DPST finish { async { S1; } S2; } S3; } F F F F S3 A A S1 S2 Maybe in parallel

Results: Slowdown 1.26x

Conclusions: Determinism for the 99% Deterministic parallelism is easier Non-determinism is often a bug – For application code, the 99% HJd reports non-determinism bugs with low overhead: 1.26x

Backup Slides

Related Work on HJ Race freedom determinism for HJ (PPPJ 11) Finish accumulators (WoDet 13) Race-freedom for HJ (RV 11, ECOOP 12)

DPST for Permission Regions finish { permit m 1 (x) { async { S1; }} async { permit m 2 (y) { S2; } } permit m 3 (x) { S3; }} F F P1 P3 A1 S1 P2 A2 S2 S3