Parallel Processing (CS526) Spring 2012(Week 4).  Parallelism from two perspectives: ◦ Platform  Parallel Hardware Architecture  Parallel Communication.

Slides:



Advertisements
Similar presentations
Prepared 7/28/2011 by T. O’Neil for 3460:677, Fall 2011, The University of Akron.
Advertisements

SE-292 High Performance Computing
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.
Super computers Parallel Processing By: Lecturer \ Aisha Dawood.
Starting Parallel Algorithm Design David Monismith Based on notes from Introduction to Parallel Programming 2 nd Edition by Grama, Gupta, Karypis, and.
Vector Processing. Vector Processors Combine vector operands (inputs) element by element to produce an output vector. Typical array-oriented operations.
Parallel Algorithm Design
Lecture 7: Task Partitioning and Mapping to Processes Shantanu Dutt ECE Dept., UIC.
Development of Parallel Simulator for Wireless WCDMA Network Hong Zhang Communication lab of HUT.
Parallel Processing (CS453). How does one decompose a task into various subtasks? While there is no single recipe that works for all problems, we present.
Reference: Message Passing Fundamentals.
Principles of Parallel Algorithm Design
Principles of Parallel Algorithm Design Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar To accompany the text “Introduction to Parallel Computing”,
Tuesday, September 12, 2006 Nothing is impossible for people who don't have to do it themselves. - Weiler.
Multiprocessors CSE 471 Aut 011 Multiprocessors - Flynn’s Taxonomy (1966) Single Instruction stream, Single Data stream (SISD) –Conventional uniprocessor.
Topic Overview One-to-All Broadcast and All-to-One Reduction
Principles of Parallel Algorithm Design
Implications for Programming Models Todd C. Mowry CS 495 September 12, 2002.
1 Computer Science, University of Warwick Architecture Classifications A taxonomy of parallel architectures: in 1972, Flynn categorised HPC architectures.
Mapping Techniques for Load Balancing
Parallel Processing (CS526) Spring 2012(Week 5).  There are no rules, only intuition, experience and imagination!  We consider design techniques, particularly.
Lecture 1 – Parallel Programming Primer CPE 458 – Parallel Programming, Spring 2009 Except as otherwise noted, the content of this presentation is licensed.
Parallel Architectures
Juan Mendivelso.  Serial Algorithms: Suitable for running on an uniprocessor computer in which only one instruction executes at a time.  Parallel Algorithms:
1 Lecture 2 Parallel Programming Platforms Parallel Computing Spring 2015.
Parallel Programming Models Jihad El-Sana These slides are based on the book: Introduction to Parallel Computing, Blaise Barney, Lawrence Livermore National.
CS453 Lecture 3.  A sequential algorithm is evaluated by its runtime (in general, asymptotic runtime as a function of input size).  The asymptotic runtime.
Chapter 6 Multiprocessor System. Introduction  Each processor in a multiprocessor system can be executing a different instruction at any time.  The.
INTRODUCTION TO PARALLEL ALGORITHMS. Objective  Introduction to Parallel Algorithms Tasks and Decomposition Processes and Mapping Processes Versus Processors.
Principles of Parallel Algorithm Design Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar To accompany the text “Introduction to Parallel Computing”,
Parallel Computing.
CS- 492 : Distributed system & Parallel Processing Lecture 7: Sun: 15/5/1435 Foundations of designing parallel algorithms and shared memory models Lecturer/
Share Memory Systems and Message Passing Systems
Static Process Scheduling
Outline Why this subject? What is High Performance Computing?
CDP Tutorial 3 Basics of Parallel Algorithm Design uses some of the slides for chapters 3 and 5 accompanying “Introduction to Parallel Computing”, Addison.
Pipelined and Parallel Computing Partition for 1 Hongtao Du AICIP Research Dec 1, 2005 Part 2.
Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar
CSCI-6964: High Performance Parallel & Distributed Computing (HPDC) AE 216, Mon/Thurs 2-3:20 p.m. Principles of Parallel Algorithm Design (reading Chp.
Paper_topic: Parallel Matrix Multiplication using Vertical Data.
3/12/2013Computer Engg, IIT(BHU)1 INTRODUCTION-1.
Uses some of the slides for chapters 3 and 5 accompanying “Introduction to Parallel Computing”, Addison Wesley, 2003.
Parallel Computing Presented by Justin Reschke
Super computers Parallel Processing By: Lecturer \ Aisha Dawood.
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
COMP8330/7330/7336 Advanced Parallel and Distributed Computing Decomposition and Parallel Tasks (cont.) Dr. Xiao Qin Auburn University
CPE 779 Parallel Computing - Spring Creating and Using Threads Based on Slides by Katherine Yelick
Group Members Hamza Zahid (131391) Fahad Nadeem khan Abdual Hannan AIR UNIVERSITY MULTAN CAMPUS.
These slides are based on the book:
Auburn University
Auburn University
Auburn University
Auburn University COMP7330/7336 Advanced Parallel and Distributed Computing Exploratory Decomposition Dr. Xiao Qin Auburn.
Lecture 1 – Parallel Programming Primer
CS5102 High Performance Computer Systems Thread-Level Parallelism
Distributed Processors
Parallel Tasks Decomposition
Auburn University COMP7330/7336 Advanced Parallel and Distributed Computing Mapping Techniques Dr. Xiao Qin Auburn University.
Auburn University COMP7330/7336 Advanced Parallel and Distributed Computing Data Partition Dr. Xiao Qin Auburn University.
Auburn University COMP8330/7330/7336 Advanced Parallel and Distributed Computing Communication Costs (cont.) Dr. Xiao.
Chapter 17 Parallel Processing
Principles of Parallel Algorithm Design
Principles of Parallel Algorithm Design
Parallelismo.
Principles of Parallel Algorithm Design
Principles of Parallel Algorithm Design
Principles of Parallel Algorithm Design
Principles of Parallel Algorithm Design
Principles of Parallel Algorithm Design
Presentation transcript:

Parallel Processing (CS526) Spring 2012(Week 4)

 Parallelism from two perspectives: ◦ Platform  Parallel Hardware Architecture  Parallel Communication ◦ Software  How to decompose the workload Ananth Grama, Purdue University, W. Lafayette

 An explicitly parallel program must specify concurrency and interaction between concurrent subtasks.  The former is sometimes also referred to as the control structure and the latter as the communication model. Ananth Grama, Purdue University, W. Lafayette

 Parallelism can be expressed at various levels of granularity - from instruction level to processes.  Between these extremes exist a range of models, along with corresponding architectural support. Ananth Grama, Purdue University, W. Lafayette

 Processing units in parallel computers either operate under the centralized control of a single control unit or work independently.  If there is a single control unit that dispatches the same instruction to various processors (that work on different data), the model is referred to as single instruction stream, multiple data stream (SIMD).  If each processor has its own control control unit, each processor can execute different instructions on different data items. This model is called multiple instruction stream, multiple data stream (MIMD). Ananth Grama, Purdue University, W. Lafayette

A typical SIMD architecture (a) and a typical MIMD architecture (b). Ananth Grama, Purdue University, W. Lafayette

 Some of the earliest parallel computers such as the Illiac IV, MPP, DAP, CM-2, and MasPar MP-1 belonged to this class of machines.  Variants of this concept have found use in co- processing units such as the MMX units in Intel processors and DSP chips such as the Sharc.  SIMD relies on the regular structure of computations (such as those in image processing).  It is often necessary to selectively turn off operations on certain data items. For this reason, most SIMD programming paradigms allow for an ``activity mask'', which determines if a processor should participate in a computation or not. Ananth Grama, Purdue University, W. Lafayette

Executing a conditional statement on an SIMD computer with four processors: (a) the conditional statement; (b) the execution of the statement in two steps. Ananth Grama, Purdue University, W. Lafayette

 In contrast to SIMD processors, MIMD processors can execute different programs on different processors.  A variant of this, called single program multiple data streams (SPMD) executes the same program on different processors.  It is easy to see that SPMD and MIMD are closely related in terms of programming flexibility and underlying architectural support.  Examples of such platforms include current generation Sun Ultra Servers, SGI Origin Servers, multiprocessor/core PCs, workstation clusters, and the IBM SP. Ananth Grama, Purdue University, W. Lafayette

 SIMD computers require less hardware than MIMD computers (single control unit).  However, since SIMD processors are specially designed, they tend to be expensive and have long design cycles.  Not all applications are naturally suited to SIMD processors.  In contrast, platforms supporting the SPMD paradigm can be built from inexpensive off- the-shelf components with relatively little effort in a short amount of time. Ananth Grama, Purdue University, W. Lafayette

 There are two primary forms of data exchange between parallel tasks - accessing a shared data space and exchanging messages.  Platforms that provide a shared data space are called shared-address-space machines or multiprocessors.  Platforms that support messaging are also called message passing platforms or multicomputers. Ananth Grama, Purdue University, W. Lafayette

 Part (or all) of the memory is accessible to all processors.  Processors interact by modifying data objects stored in this shared-address-space.  If the time taken by a processor to access any memory word in the system global or local is identical, the platform is classified as a uniform memory access (UMA), else, a non- uniform memory access (NUMA) machine. Ananth Grama, Purdue University, W. Lafayette

Typical shared-address-space architectures: (a) Uniform- memory access shared-address-space computer; (b) Uniform-memory-access shared-address-space computer with caches and memories; (c) Non-uniform-memory- access shared-address-space computer with local memory only. Ananth Grama, Purdue University, W. Lafayette

 The distinction between NUMA and UMA platforms is important from the point of view of algorithm design. NUMA machines require locality from underlying algorithms for performance.  Programming these platforms is easier since reads and writes are implicitly visible to other processors.  However, read-write data to shared data must be coordinated.  Caches in such machines require coordinated access to multiple copies. This leads to the cache coherence problem.  A weaker model of these machines provides an address map, but not coordinated access. These models are called non cache coherent shared address space machines. Ananth Grama, Purdue University, W. Lafayette

 It is important to note the difference between the terms shared address space and shared memory.  We refer to the former as a programming abstraction and to the latter as a physical machine attribute.  It is possible to provide a shared address space using a physically distributed memory. Ananth Grama, Purdue University, W. Lafayette

 These platforms comprise of a set of processors and their own (exclusive) memory.  Instances of such a view come naturally from clustered workstations and non-shared- address-space multicomputers.  These platforms are programmed using (variants of) send and receive primitives.  Libraries such as MPI and PVM provide such primitives. Ananth Grama, Purdue University, W. Lafayette

 Message passing requires little hardware support, other than a network.  Shared address space platforms can easily emulate message passing. The reverse is more difficult to do (in an efficient manner). Ananth Grama, Purdue University, W. Lafayette

 The first step in developing a parallel algorithm is to decompose the problem into tasks that can be executed concurrently  A given problem may be docomposed into tasks in many different ways.  Tasks may be of same, different, or even interminate sizes.  A decomposition can be illustrated in the form of a directed graph with nodes corresponding to tasks and edges indicating that the result of one task is required for processing the next. Such a graph is called a task dependency graph. Ananth Grama, Purdue University, W. Lafayette

Computation of each element of output vector y is independent of other elements. Based on this, a dense matrix-vector product can be decomposed into n tasks. The figure highlights the portion of the matrix and vector accessed by Task 1. Observations: While tasks share data (namely, the vector b ), they do not have any control dependencies - i.e., no task needs to wait for the (partial) completion of any other. All tasks are of the same size in terms of number of operations. Ananth Grama, Purdue University, W. Lafayette

Consider the execution of the query: MODEL = ``CIVIC'' AND YEAR = 2001 AND (COLOR = ``GREEN'' OR COLOR = ``WHITE) on the following database: ID#ModelYearColorDealerPrice 4523Civic2002BlueMN$18, Corolla1999WhiteIL$15, Camry2001GreenNY$21, Prius2001GreenCA$18, Civic2001WhiteOR$17, Altima2001GreenFL$19, Maxima2001BlueNY$22, Accord2000GreenVT$18, Civic2001RedCA$17, Civic2002RedWA$18,000 Ananth Grama, Purdue University, W. Lafayette

The execution of the query can be divided into subtasks in various ways. Each task can be thought of as generating an intermediate table of entries that satisfy a particular clause. Decomposing the given query into a number of tasks. Edges in this graph denote that the output of one task is needed to accomplish the next. Ananth Grama, Purdue University, W. Lafayette

Note that the same problem can be decomposed into subtasks in other ways as well. An alternate decomposition of the given problem into subtasks, along with their data dependencies. Different task decompositions may lead to significant differences with respect to their eventual parallel performance. Ananth Grama, Purdue University, W. Lafayette

 The number of tasks into which a problem is decomposed determines its granularity.  Decomposition into a large number of tasks results in fine-grained decomposition and that into a small number of tasks results in a coarse grained decomposition. A coarse grained counterpart to the dense matrix-vector product example. Each task in this example corresponds to the computation of three elements of the result vector. Ananth Grama, Purdue University, W. Lafayette

 The number of tasks that can be executed in parallel is the degree of concurrency of a decomposition.  Since the number of tasks that can be executed in parallel may change over program execution, the maximum degree of concurrency is the maximum number of such tasks at any point during execution. What is the maximum degree of concurrency of the database query examples?  The average degree of concurrency is the average number of tasks that can be processed in parallel over the execution of the program. Assuming that each tasks in the database example takes identical processing time, what is the average degree of concurrency in each decomposition?  The degree of concurrency increases as the decomposition becomes finer in granularity and vice versa. Ananth Grama, Purdue University, W. Lafayette

 A directed path in the task dependency graph represents a sequence of tasks that must be processed one after the other.  The longest such path determines the shortest time in which the program can be executed in parallel.  The length of the longest path in a task dependency graph is called the critical path length. Ananth Grama, Purdue University, W. Lafayette

Consider the task dependency graphs of the two database query decompositions: What are the critical path lengths for the two task dependency graphs? If each task takes 10 time units, what is the shortest parallel execution time for each decomposition? How many processors are needed in each case to achieve this minimum parallel execution time? What is the maximum degree of concurrency? Ananth Grama, Purdue University, W. Lafayette

 It would appear that the parallel time can be made arbitrarily small by making the decomposition finer in granularity.  There is an inherent bound on how fine the granularity of a computation can be. For example, in the case of multiplying a dense matrix with a vector, there can be no more than (n 2 ) concurrent tasks.  Concurrent tasks may also have to exchange data with other tasks. This results in communication overhead. The tradeoff between the granularity of a decomposition and associated overheads often determines performance bounds. Ananth Grama, Purdue University, W. Lafayette

 Subtasks generally exchange data with others in a decomposition. For example, even in the trivial decomposition of the dense matrix-vector product, if the vector is not replicated across all tasks, they will have to communicate elements of the vector.  The graph of tasks (nodes) and their interactions/data exchange (edges) is referred to as a task interaction graph.  Note that task interaction graphs represent data dependencies, whereas task dependency graphs represent control dependencies. Ananth Grama, Purdue University, W. Lafayette

 In general, the number of tasks in a decomposition exceeds the number of processing elements available.  For this reason, a parallel algorithm must also provide a mapping of tasks to processes. Note: We refer to the mapping as being from tasks to processes, as opposed to processors. This is because typical programming APIs, as we shall see, do not allow easy binding of tasks to physical processors. Rather, we aggregate tasks into processes and rely on the system to map these processes to physical processors. We use processes, not in the UNIX sense of a process, rather, simply as a collection of tasks and associated data. Ananth Grama, Purdue University, W. Lafayette

 Appropriate mapping of tasks to processes is critical to the parallel performance of an algorithm.  Mappings are determined by both the task dependency and task interaction graphs.  Task dependency graphs can be used to ensure that work is equally spread across all processes at any point (minimum idling and optimal load balance).  Task interaction graphs can be used to make sure that processes need minimum interaction with other processes (minimum communication). Ananth Grama, Purdue University, W. Lafayette

An appropriate mapping must minimize parallel execution time by:  Mapping independent tasks to different processes.  Assigning tasks on critical path to processes as soon as they become available.  Minimizing interaction between processes by mapping tasks with dense interactions to the same process. Note: These criteria often conflict with each other. For example, a decomposition into one task (or no decomposition at all) minimizes interaction but does not result in a speedup at all! Ananth Grama, Purdue University, W. Lafayette

Mapping tasks in the database query decomposition to processes. These mappings were arrived at by viewing the dependency graph in terms of levels (no two nodes in a level have dependencies). Tasks within a single level are then assigned to different processes. Ananth Grama, Purdue University, W. Lafayette

So how does one decompose a task into various subtasks? While there is no single recipe that works for all problems, we present a set of commonly used techniques that apply to broad classes of problems. These include: recursive decomposition data decomposition exploratory decomposition speculative decomposition Ananth Grama, Purdue University, W. Lafayette

 Generally suited to problems that are solved using the divide-and-conquer strategy.  A given problem is first decomposed into a set of sub-problems.  These sub-problems are recursively decomposed further until a desired granularity is reached. Ananth Grama, Purdue University, W. Lafayette

A classic example of a divide-and-conquer algorithm on which we can apply recursive decomposition is Quicksort. In this example, once the list has been partitioned around the pivot, each sublist can be processed concurrently (i.e., each sublist represents an independent subtask). This can be repeated recursively. Ananth Grama, Purdue University, W. Lafayette

The problem of finding the minimum number in a given list (or indeed any other associative operation such as sum, AND, etc.) can be fashioned as a divide-and-conquer algorithm. The following algorithm illustrates this. We first start with a simple serial loop for computing the minimum entry in a given list: 1. procedure SERIAL_MIN (A, n) 2. begin 3. min = A[0]; 4. for i := 1 to n − 1 do 5. if (A[i] < min) min := A[i]; 6. endfor; 7. return min; 8. end SERIAL_MIN Ananth Grama, Purdue University, W. Lafayette

We can rewrite the loop as follows: 1. procedure RECURSIVE_MIN (A, n) 2. begin 3. if ( n = 1 ) then 4. min := A [0] ; 5. else 6. lmin := RECURSIVE_MIN ( A, n/2 ); 7. rmin := RECURSIVE_MIN ( &(A[n/2]), n - n/2 ); 8. if (lmin < rmin) then 9. min := lmin; 10. else 11. min := rmin; 12. endelse; 13. endelse; 14. return min; 15. end RECURSIVE_MIN Ananth Grama, Purdue University, W. Lafayette

The code in the previous foil can be decomposed naturally using a recursive decomposition strategy. We illustrate this with the following example of finding the minimum number in the set {4, 9, 1, 7, 8, 11, 2, 12}. The task dependency graph associated with this computation is as follows: Ananth Grama, Purdue University, W. Lafayette

 Identify the data on which computations are performed.  Partition this data across various tasks.  This partitioning induces a decomposition of the problem.  Data can be partitioned in various ways - this critically impacts performance of a parallel algorithm. Ananth Grama, Purdue University, W. Lafayette

 Often, each element of the output can be computed independently of others (but simply as a function of the input).  A partition of the output across tasks decomposes the problem naturally. Ananth Grama, Purdue University, W. Lafayette

Consider the problem of multiplying two n x n matrices A and B to yield matrix C. The output matrix C can be partitioned into four tasks as follows: Task 1: Task 2: Task 3: Task 4: Ananth Grama, Purdue University, W. Lafayette

A partitioning of output data does not result in a unique decomposition into tasks. For example, for the same problem as in previus foil, with identical output data distribution, we can derive the following two (other) decompositions: Decomposition IDecomposition II Task 1: C 1,1 = A 1,1 B 1,1 Task 2: C 1,1 = C 1,1 + A 1,2 B 2,1 Task 3: C 1,2 = A 1,1 B 1,2 Task 4: C 1,2 = C 1,2 + A 1,2 B 2,2 Task 5: C 2,1 = A 2,1 B 1,1 Task 6: C 2,1 = C 2,1 + A 2,2 B 2,1 Task 7: C 2,2 = A 2,1 B 1,2 Task 8: C 2,2 = C 2,2 + A 2,2 B 2,2 Task 1: C 1,1 = A 1,1 B 1,1 Task 2: C 1,1 = C 1,1 + A 1,2 B 2,1 Task 3: C 1,2 = A 1,2 B 2,2 Task 4: C 1,2 = C 1,2 + A 1,1 B 1,2 Task 5: C 2,1 = A 2,2 B 2,1 Task 6: C 2,1 = C 2,1 + A 2,1 B 1,1 Task 7: C 2,2 = A 2,1 B 1,2 Task 8: C 2,2 = C 2,2 + A 2,2 B 2,2 Ananth Grama, Purdue University, W. Lafayette

 Computation can often be viewed as a sequence of transformation from the input to the output data.  In these cases, it is often beneficial to use one of the intermediate stages as a basis for decomposition. Ananth Grama, Purdue University, W. Lafayette

 In some applications, dependencies between tasks are not known a-priori.  For such applications, it is impossible to identify independent tasks.  There are generally two approaches to dealing with such applications: conservative approaches, which identify independent tasks only when they are guaranteed to not have dependencies, and, optimistic approaches, which schedule tasks even when they may potentially be erroneous.  Conservative approaches may yield little concurrency and optimistic approaches may require roll-back mechanism in the case of an error. Ananth Grama, Purdue University, W. Lafayette

A classic example of speculative decomposition is in discrete event simulation.  The central data structure in a discrete event simulation is a time-ordered event list.  Events are extracted precisely in time order, processed, and if required, resulting events are inserted back into the event list.  Consider your day today as a discrete event system - you get up, get ready, drive to work, work, eat lunch, work some more, drive back, eat dinner, and sleep.  Each of these events may be processed independently, however, in driving to work, you might meet with an unfortunate accident and not get to work at all.  Therefore, an optimistic scheduling of other events will have to be rolled back. Ananth Grama, Purdue University, W. Lafayette

Another example is the simulation of a network of nodes (for instance, an assembly line or a computer network through which packets pass). The task is to simulate the behavior of this network for various inputs and node delay parameters (note that networks may become unstable for certain values of service rates, queue sizes, etc.). Ananth Grama, Purdue University, W. Lafayette

Often, a mix of decomposition techniques is necessary for decomposing a problem. Consider the following examples: In quicksort, recursive decomposition alone limits concurrency (Why?). A mix of data and recursive decompositions is more desirable. In discrete event simulation, there might be concurrency in task processing. A mix of speculative decomposition and data decomposition may work well. Even for simple problems like finding a minimum of a list of numbers, a mix of data and recursive decomposition works well. Ananth Grama, Purdue University, W. Lafayette