CS 484 Designing Parallel Algorithms Designing a parallel algorithm is not easy. There is no recipe or magical ingredient Except creativity We can benefit.

Slides:



Advertisements
Similar presentations
Practical techniques & Examples
Advertisements

Parallel Programming Patterns Eun-Gyu Kim June 10, 2004.
Resource Management §A resource can be a logical, such as a shared file, or physical, such as a CPU (a node of the distributed system). One of the functions.
CS 484. Discrete Optimization Problems A discrete optimization problem can be expressed as (S, f) S is the set of all feasible solutions f is the cost.
Lecture 7-2 : Distributed Algorithms for Sorting Courtesy : Michael J. Quinn, Parallel Programming in C with MPI and OpenMP (chapter 14)
2 Less fish … More fish! Parallelism means doing multiple things at the same time: you can get more work done in the same time.
CISC 879 : Software Support for Multicore Architectures John Cavazos Dept of Computer & Information Sciences University of Delaware
Development of Parallel Simulator for Wireless WCDMA Network Hong Zhang Communication lab of HUT.
CISC October Goals for today: Foster’s parallel algorithm design –Partitioning –Task dependency graph Granularity Concurrency Collective communication.
Reference: Message Passing Fundamentals.
ECE669 L4: Parallel Applications February 10, 2004 ECE 669 Parallel Computer Architecture Lecture 4 Parallel Applications.
1 Friday, September 29, 2006 If all you have is a hammer, then everything looks like a nail. -Anonymous.
Message Passing Fundamentals Self Test. 1.A shared memory computer has access to: a)the memory of other nodes via a proprietary high- speed communications.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
Parallel Programming Models and Paradigms
CISC 879 : Software Support for Multicore Architectures John Cavazos Dept of Computer & Information Sciences University of Delaware
PGA – Parallel Genetic Algorithm Hsuan Lee. Reference  E Cantú-Paz, A Survey on Parallel Genetic Algorithm, Calculateurs Paralleles, Reseaux et Systems.
CS 584. Discrete Optimization Problems A discrete optimization problem can be expressed as (S, f) S is the set of all feasible solutions f is the cost.
Strategies for Implementing Dynamic Load Sharing.
Chapter 13 Finite Difference Methods: Outline Solving ordinary and partial differential equations Finite difference methods (FDM) vs Finite Element Methods.
Parallel Programming: Case Studies Todd C. Mowry CS 495 September 12, 2002.
CS213 Parallel Processing Architecture Lecture 5: MIMD Program Design
Customized Dynamic Load Balancing for a Network of Workstations Taken from work done by: Mohammed Javeed Zaki, Wei Li, Srinivasan Parthasarathy Computer.
Virtues of Good (Parallel) Software
1 Parallel Computing 5 Parallel Application Design Ondřej Jakl Institute of Geonics, Academy of Sci. of the CR.
Introduction to Parallel Programming MapReduce Except where otherwise noted all portions of this work are Copyright (c) 2007 Google and are licensed under.
Rechen- und Kommunikationszentrum (RZ) Parallelization at a Glance Christian Terboven / Aachen, Germany Stand: Version 2.3.
Reference: / Parallel Programming Paradigm Yeni Herdiyeni Dept of Computer Science, IPB.
ICOM 5995: Performance Instrumentation and Visualization for High Performance Computer Systems Lecture 7 October 16, 2002 Nayda G. Santiago.
Parallel Programming Models Jihad El-Sana These slides are based on the book: Introduction to Parallel Computing, Blaise Barney, Lawrence Livermore National.
Designing and Evaluating Parallel Programs Anda Iamnitchi Federated Distributed Systems Fall 2006 Textbook (on line): Designing and Building Parallel Programs.
Chapter 3 Parallel Algorithm Design. Outline Task/channel model Task/channel model Algorithm design methodology Algorithm design methodology Case studies.
Meta Scheduling Sathish Vadhiyar Sources/Credits/Taken from: Papers listed in “References” slide.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
Improving Capacity and Flexibility of Wireless Mesh Networks by Interface Switching Yunxia Feng, Minglu Li and Min-You Wu Presented by: Yunxia Feng Dept.
Parallel Simulation of Continuous Systems: A Brief Introduction
CS 584. Load Balancing Goal: All processors working all the time Efficiency of 1 Distribute the load (work) to meet the goal Two types of load balancing.
Dynamic Load Balancing in Charm++ Abhinav S Bhatele Parallel Programming Lab, UIUC.
Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M
Lecture 4 TTH 03:30AM-04:45PM Dr. Jianjun Hu CSCE569 Parallel Computing University of South Carolina Department of.
CS 484 Load Balancing. Goal: All processors working all the time Efficiency of 1 Distribute the load (work) to meet the goal Two types of load balancing.
Finding concurrency Jakub Yaghob. Finding concurrency design space Starting point for design of a parallel solution Analysis The patterns will help identify.
CS 584. Discrete Optimization Problems A discrete optimization problem can be expressed as (S, f) S is the set of all feasible solutions f is the cost.
Scalable and Topology-Aware Load Balancers in Charm++ Amit Sharma Parallel Programming Lab, UIUC.
3/12/2013Computer Engg, IIT(BHU)1 INTRODUCTION-1.
A Pattern Language for Parallel Programming Beverly Sanders University of Florida.
Lecture 3: Designing Parallel Programs. Methodological Design Designing and Building Parallel Programs by Ian Foster www-unix.mcs.anl.gov/dbpp.
Hierarchical Load Balancing for Large Scale Supercomputers Gengbin Zheng Charm++ Workshop 2010 Parallel Programming Lab, UIUC 1Charm++ Workshop 2010.
Load Balancing : The Goal Given a collection of tasks comprising a computation and a set of computers on which these tasks may be executed, find the mapping.
Concurrency and Performance Based on slides by Henri Casanova.
Dynamic Load Balancing Tree and Structured Computations.
COMP7330/7336 Advanced Parallel and Distributed Computing Task Partitioning Dr. Xiao Qin Auburn University
COMP7330/7336 Advanced Parallel and Distributed Computing Task Partitioning Dynamic Mapping Dr. Xiao Qin Auburn University
Divide and Conquer Algorithms Sathish Vadhiyar. Introduction  One of the important parallel algorithm models  The idea is to decompose the problem into.
Department of Computer Science, Johns Hopkins University Lecture 7 Finding Concurrency EN /420 Instructor: Randal Burns 26 February 2014.
Parallel Programming By J. H. Wang May 2, 2017.
Parallel Programming Patterns
Auburn University COMP7330/7336 Advanced Parallel and Distributed Computing Mapping Techniques Dr. Xiao Qin Auburn University.
CS 584 Lecture 3 How is the assignment going?.
Parallel Algorithm Design
Parallel Programming in C with MPI and OpenMP
EE 193: Parallel Computing
CS 584.
CS 584 Lecture7 Assignment -- Due Now! Paper Review is due next week.
Parallel Algorithm Models
Adaptivity and Dynamic Load Balancing
Parallel Programming in C with MPI and OpenMP
CS 584 Lecture 5 Assignment. Due NOW!!.
Mattan Erez The University of Texas at Austin
L. Glimcher, R. Jin, G. Agrawal Presented by: Leo Glimcher
Presentation transcript:

CS 484

Designing Parallel Algorithms Designing a parallel algorithm is not easy. There is no recipe or magical ingredient Except creativity We can benefit from a methodical approach. Framework for algorithm design Most problems have several parallel solutions which may be totally different from the best sequential algorithm.

PCAM Algorithm Design 4 Stages to designing a parallel algorithm Partitioning Communication Agglomeration Mapping P & C focus on concurrency and scalability. A & M focus on locality and performance.

PCAM Algorithm Design Partitioning Computation and data are decomposed. Communication Coordinate task execution Agglomeration Combining of tasks for performance Mapping Assignment of tasks to processors

Partitioning Ignore the number of processors and the target architecture. Expose opportunities for parallelism. Divide up both the computation and data Can take two approaches domain decomposition functional decomposition

Domain Decomposition Start algorithm design by analyzing the data Divide the data into small pieces Approximately equal in size Then partition the computation by associating it with the data. Communication issues may arise as one task needs the data from another task.

Domain Decomposition Evaluate the definite integral.   x 0 1

Split up the domain 0 1

0 1

Now each task simply evaluates the integral in their range. All that is left is to sum up each task's answer for the total.

Domain Decomposition Consider dividing up a 3-D grid What issues arise? Other issues? What if your problem has more than one data structure? Different problem phases? Replication?

Functional Decomposition Focus on the computation Divide the computation into disjoint tasks Avoid data dependency among tasks After dividing the computation, examine the data requirements of each task.

Functional Decomposition Not as natural as domain decomposition Consider search problems Often functional decomposition is very useful at a higher level. Climate modeling  Ocean simulation  Hydrology  Atmosphere, etc.

Partitioning Checklist Define a LOT of tasks? Avoid redundant computation and storage? Are tasks approximately equal? Does the number of tasks scale with the problem size? Have you identified several alternative partitioning schemes?

Communication The information flow between tasks is specified in this stage of the design Remember: Tasks execute concurrently. Data dependencies may limit concurrency.

Communication Define Channel Link the producers with the consumers. Consider the costs  Intellectual  Physical Distribute the communication. Specify the messages that are sent.

Communication Patterns Local vs. Global Structured vs. Unstructured Static vs. Dynamic Synchronous vs. Asynchronous

Local Communication Communication within a neighborhood. Algorithm choice determines communication.

Global Communication Not localized. Examples All-to-All Master-Worker

Avoiding Global Communication Distribute the communication and computation

Divide and Conquer Partition the problem into two or more subproblems Partition each subproblem, etc Results in structured nearest neighbor communication pattern.

Structured Communication Each task’s communication resembles each other task’s communication Is there a pattern?

Unstructured Communication No regular pattern that can be exploited. Examples Unstructured Grid Resolution changes Complicates the next stages of design

Synchronous Communication Both consumers and producers are aware when communication is required Explicit and simple t = 1t = 2t = 3

Asynchronous Communication Timing of send/receive is unknown. No pattern Consider: very large data structure Distribute among computational tasks (polling) Define a set of read/write tasks Shared Memory

Problems to Avoid A centralized algorithm Distribute the computation Distribute the communication A sequential algorithm Seek for concurrency Divide and conquer  Small, equal sized subproblems

Communication Design Checklist Is communication balanced? All tasks about the same Is communication limited to neighborhoods? Restructure global to local if possible. Can communications proceed concurrently? Can the algorithm proceed concurrently? Find the algorithm with most concurrency.  Be careful!!!

Agglomeration Partition and Communication steps were abstract Agglomeration moves to concrete. Combine tasks to execute efficiently on some parallel computer. Consider replication.

Agglomeration Goals Reduce communication costs by increasing computation decreasing/increasing granularity Retain flexibility for mapping and scaling. Reduce software engineering costs.

Changing Granularity A large number of tasks does not necessarily produce an efficient algorithm. We must consider the communication costs. Reduce communication by having fewer tasks sending less messages (batching)

Surface to Volume Effects Communication is proportional to the surface of the subdomain. Computation is proportional to the volume of the subdomain. Increasing computation will often decrease communication.

How many messages total? How much data is sent?

How many messages total? How much data is sent?

Replicating Computation Trade-off replicated computation for reduced communication. Replication will often reduce execution time as well.

Summation of N Integers s = sum b = broadcast How many steps?

Using Replication (Butterfly)

Using Replication Butterfly to Hypercube

Avoid Communication Look for tasks that cannot execute concurrently because of communication requirements. Replication can help accomplish two tasks at the same time, like: Summation Broadcast

Preserve Flexibility Create more tasks than processors. Overlap communication and computation. Don't incorporate unnecessary limits on the number of tasks.

Agglomeration Checklist Reduce communication costs by increasing locality. Do benefits of replication outweigh costs? Does replication compromise scalability? Does the number of tasks still scale with problem size? Is there still sufficient concurrency?

Mapping Specify where each task is to operate. Mapping may need to change depending on the target architecture. Mapping is NP-complete.

Mapping Goal: Reduce Execution Time Concurrent tasks ---> Different processors High communication ---> Same processor Mapping is a game of trade-offs.

Mapping Many domain-decomposition problems make mapping easy. Grids Arrays etc.

Mapping Unstructured or complex domain decomposition based algorithms are difficult to map.

Other Mapping Problems Variable amounts of work per task Unstructured communication Heterogeneous processors different speeds different architectures Solution: LOAD BALANCING

Load Balancing Static Determined a priori Based on work, processor speed, etc. Probabilistic Random Dynamic Restructure load during execution Task Scheduling (functional decomp.)

Static Load Balancing Based on a priori knowledge. Goal: Equal WORK on all processors Algorithms: Basic Recursive Bisection

Basic Divide up the work based on Work required Processor speed             i i i p p Rr

Recursive Bisection Divide work in half recursively. Based on physical coordinates.

Dynamic Algorithms Adjust load when an imbalance is detected. Local or Global

Task Scheduling Many tasks with weak locality requirements. Manager-Worker model.

Task Scheduling Manager-Worker Hierarchical Manager-Worker Uses submanagers Decentralized No central manager Task pool on each processor Less bottleneck

Mapping Checklist Is the load balanced? Are there communication bottlenecks? Is it necessary to adjust the load dynamically? Can you adjust the load if necessary? Have you evaluated the costs?

PCAM Algorithm Design Partition Domain or Functional Decomposition Communication Link producers and consumers Agglomeration Combine tasks for efficiency Mapping Divide up the tasks for balanced execution

Example: Atmosphere Model Simulate atmospheric processes Wind Clouds, etc. Solves a set of partial differential equations describing the fluid behavior

Representation of Atmosphere

Data Dependencies

Partition & Communication

Agglomeration

Mapping