Parallel Programming Patterns Ralph Johnson. Why patterns? Patterns for Parallel Programming The road ahead.

Slides:



Advertisements
Similar presentations
Parallel Programming Patterns Eun-Gyu Kim June 10, 2004.
Advertisements

Concurrency Important and difficult (Ada slides copied from Ed Schonberg)
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
Master/Slave Architecture Pattern Source: Pattern-Oriented Software Architecture, Vol. 1, Buschmann, et al.
WORK STEALING SCHEDULER 6/16/2010 Work Stealing Scheduler 1.
CISC 879 : Software Support for Multicore Architectures John Cavazos Dept of Computer & Information Sciences University of Delaware
1 A Common Application Platform (CAP) for SURAgrid -Mahantesh Halappanavar, John-Paul Robinson, Enis Afgane, Mary Fran Yafchalk and Purushotham Bangalore.
ECE669 L4: Parallel Applications February 10, 2004 ECE 669 Parallel Computer Architecture Lecture 4 Parallel Applications.
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
CISC 879 : Software Support for Multicore Architectures John Cavazos Dept of Computer & Information Sciences University of Delaware
Parallel Programming Models and Paradigms
Ralph Johnson - University of Illinois1 Patterns: What They Are, and How to Write Them Ralph Johnson University of Illinois at Urbana-Champaign
CISC 879 : Software Support for Multicore Architectures John Cavazos Dept of Computer & Information Sciences University of Delaware
High Performance Computing 1 Parallelization Strategies and Load Balancing Some material borrowed from lectures of J. Demmel, UC Berkeley.
1 / 26 CS 425/625 Software Engineering Architectural Design Based on Chapter 11 of the textbook [SE-8] Ian Sommerville, Software Engineering, 8t h Ed.,
Basic Definitions Data Structures: Data Structures: A data structure is a systematic way of organizing and accessing data. Or, It’s the logical relationship.
A Brief Look At MPI’s Point To Point Communication Brian T. Smith Professor, Department of Computer Science Director, Albuquerque High Performance Computing.
OPL: Our Pattern Language. Background Design Patterns: Elements of Reusable Object-Oriented Software o Introduced patterns o Very influential book Pattern.
Kathy Yelick, 1 Advanced Software for Biological Simulations Elastic structures in an incompressible fluid. Blood flow, clotting, inner ear, embryo growth,
A Pattern Language for Parallel Programming Beverly Sanders University of Florida.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Csinparallel.org Patterns and Exemplars: Compelling Strategies for Teaching Parallel and Distributed Computing to CS Undergraduates Libby Shoop Joel Adams.
Parallel Programming in.NET Kevin Luty.  History of Parallelism  Benefits of Parallel Programming and Designs  What to Consider  Defining Types of.
Domain decomposition in parallel computing Ashok Srinivasan Florida State University COT 5410 – Spring 2004.
Design Patterns Discussion of pages: xi-11 Sections: Preface, Forward, Chapter
Lecture 4: Parallel Programming Models. Parallel Programming Models Parallel Programming Models: Data parallelism / Task parallelism Explicit parallelism.
CPSC 372 John D. McGregor Module 3 Session 2 Architecture Analysis/Design.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
ICOM 5995: Performance Instrumentation and Visualization for High Performance Computer Systems Lecture 7 October 16, 2002 Nayda G. Santiago.
CCA Common Component Architecture Manoj Krishnan Pacific Northwest National Laboratory MCMD Programming and Implementation Issues.
© 2009 Mathew J. Sottile, Timothy G. Mattson, and Craig E Rasmussen 1 Concurrency in Programming Languages Matthew J. Sottile Timothy G. Mattson Craig.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
Chapter 3 Parallel Programming Models. Abstraction Machine Level – Looks at hardware, OS, buffers Architectural models – Looks at interconnection network,
SCIRun and SPA integration status Steven G. Parker Ayla Khan Oscar Barney.
Definitions Speed-up Efficiency Cost Diameter Dilation Deadlock Embedding Scalability Big Oh notation Latency Hiding Termination problem Bernstein’s conditions.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns IX Interpreter, Mediator, Template Method recap.
DEV 315 –Name –Problem –Context –Forces –Solution –Invariant –Examples –Known Uses –Related patterns : Characteristics :
Patterns for Parallel Programming Markos Chandras Salil Ponde Wenjiang Xu COMP60611: Fundamentals of Parallel and Distributed Systems (2010) School of.
CS 484 Designing Parallel Algorithms Designing a parallel algorithm is not easy. There is no recipe or magical ingredient Except creativity We can benefit.
Ade Miller Senior Development Manager Microsoft patterns & practices.
1 / 26 CS 425/625 Software Engineering Architectural Design Based on Chapter 10 of the textbook [Somm00] Ian Sommerville, Software Engineering, 6 th Ed.,
CS- 492 : Distributed system & Parallel Processing Lecture 7: Sun: 15/5/1435 Foundations of designing parallel algorithms and shared memory models Lecturer/
Progress on Component-Based Subsurface Simulation I: Smooth Particle Hydrodynamics Bruce Palmer Pacific Northwest National Laboratory Richland, WA.
Patterns Composite Pattern. Patterns All designers use patterns. Patterns in solutions come from patterns in problems. "A pattern is a solution to a problem.
13-1 Chapter 13 Concurrency Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads C# Threads.
CDP Tutorial 3 Basics of Parallel Algorithm Design uses some of the slides for chapters 3 and 5 accompanying “Introduction to Parallel Computing”, Addison.
A Pattern Language for Parallel Programming Beverly Sanders University of Florida.
C OMPUTATIONAL R ESEARCH D IVISION 1 Defining Software Requirements for Scientific Computing Phillip Colella Applied Numerical Algorithms Group Lawrence.
ECE 526 – Network Processing Systems Design Programming Model Chapter 21: D. E. Comer.
From Use Cases to Implementation 1. Structural and Behavioral Aspects of Collaborations  Two aspects of Collaborations Structural – specifies the static.
Uses some of the slides for chapters 3 and 5 accompanying “Introduction to Parallel Computing”, Addison Wesley, 2003.
Parallel Computing Presented by Justin Reschke
Architectural Mismatch: Why reuse is so hard? Garlan, Allen, Ockerbloom; 1994.
From Use Cases to Implementation 1. Mapping Requirements Directly to Design and Code  For many, if not most, of our requirements it is relatively easy.
Parallel Programming Models EECC 756 David D. McGann 18 May, 1999.
Application of Design Patterns to Geometric Decompositions V. Balaji, Thomas L. Clune, Robert W. Numrich and Brice T. Womack.
Auburn University
Parallel Patterns.
Introduction to Design Patterns
Parallel Programming By J. H. Wang May 2, 2017.
Parallel Programming Patterns
Parallel Algorithm Design
Mattan Erez The University of Texas at Austin
Mattan Erez The University of Texas at Austin
Mattan Erez The University of Texas at Austin
Jim Fawcett CSE776 – Design Patterns Summer 2003
Parallel Programming in C with MPI and OpenMP
Quiz: Computational Thinking
Mattan Erez The University of Texas at Austin
From Use Cases to Implementation
Presentation transcript:

Parallel Programming Patterns Ralph Johnson

Why patterns? Patterns for Parallel Programming The road ahead

Patterns (Software) Things that repeat. Plans/schemas/motifs “Best Practices” Design vocabulary Literature - pedagogical

Patterns Are not magic Can be misused Not a replacement for experience

Composite Idea: make abstract "component" class. Alternative 1: every component has a (possibly empty) set of components. Component Children ParagraphChapter... Problem: many components have no components

Composite Pattern Component container children CompositeLeaf Composite and Component have the exact same interface. interface for enumerating children Component implements children() by returning empty set interface for adding/removing children?

Lessons learned Patterns are a means to an end Principles are more important than patterns People like to copy code Making mistakes is part of learning

Patterns for Parallel Programming By Timothy Mattson, Beverly Sanders and Berna Massingill Technology independent – Works for MPI, OpenMP, and Java threads Domain independent A pattern language

Categories of patterns Finding concurrency Algorithm structure Supporting structures Implementation mechanisms (not patterns)

Algorithm structure Organize by tasks – Linear - task parallelism - reduce dependencies – Recursive - divide and conquer - manage granularity Organize by data decomposition – Linear - geometric decomposition - exchange – Recursive - recursive data - more work, faster Organize by flow of data – Regular - pipeline – Irregular - event-based coordination

Supporting Structures SPMD Master/worker Loop parallelism Fork/join Shared data Shared queue Distributed array

My critique In addition to these high-level patterns – Need more technology-dependent patterns – Need domain-dependent patterns – Need smaller-scale patterns High-level patterns are harder to learn – More examples – Divide into smaller patterns (pattern language)

Other patterns Patterns at PLoP by Jorge Ortega-Arjona – “Architectural” - similar in abstraction to PPP – Communication primitives Systems that generate software from patterns – Steven Siu at Waterloo – Macdonald and Szafron at U. of Alberta

Domain Dependent Phil Colella’s 7 dwarfs – Dense and sparse matrices – Structured and unstructured meshes – Particle systems – FFT – Monte Carlo methods Berkeley’s 13 dwarfs/motifs – Graph traversal, branch and bound, dynamic programming, combinatorial logic, FSMs, graphical models

Particle systems Particle-particle Discrete forces Neighborhood of particles Task per interaction Particle-mesh

Exchange in MPI Do i=1,n_neighbors Call MPI_Send(edge, len, MPI_REAL, nbr(i), tag, comm, ierr) Enddo Do i=1,n_neighbors Call MPI_Recv(edge,len,MPI_REAL,nbr(i),tag, comm,status,ierr) Enddo

Provide buffers, receive in any order Do i=1,n_neighbors Call MPI_Irecv(edge,len,MPI_REAL,nbr(i),tag, comm,request(i),ierr) Enddo Do i=1,n_neighbors Call MPI_Send(edge, len, MPI_REAL, nbr(i), tag, comm, ierr) Enddo Call MPI_Waitall(n_neighbors, request, statuses, ierr)

Defer synchronization Do i=1,n_neighbors Call MPI_Irecv(edge,len,MPI_REAL,nbr(i),tag, comm,request(i),ierr) Enddo Do i=1,n_neighbors Call MPI_Isend(edge, len, MPI_REAL, nbr(i), tag, comm, request(n_neighbors+i), ierr) Enddo Call MPI_Waitall(2*n_neighbors, request, statuses, ierr)

Parallel Programming Patterns Many levels - all are needed High level patterns are hard to learn – Give many examples – Divide into smaller pieces Low level patterns might be easier to learn, but no less important

Real patterns are discovered, not invented Quality of pattern observed by using it So, let’s – discover them, – write them, – see what happens when people try to use them, – and then fix them.