Pipeline Pattern ITCS 4/5145 Parallel Computing, UNC-Charlotte, B. Wilkinson slides5.ppt August 17, 2014.

Slides:



Advertisements
Similar presentations
Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M
Advertisements

Lecture 19: Parallel Algorithms
Linear Algebra Applications in Matlab ME 303. Special Characters and Matlab Functions.
A simple example finding the maximum of a set S of n numbers.
1 5.1 Pipelined Computations. 2 Problem divided into a series of tasks that have to be completed one after the other (the basis of sequential programming).
1 5.1 Pipelined Computations. 2 Problem divided into a series of tasks that have to be completed one after the other (the basis of sequential programming).
Potential for parallel computers/parallel programming
Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M
CS0007: Introduction to Computer Programming Array Algorithms.
1 Parallel Algorithms II Topics: matrix and graph algorithms.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
Pipelined Computations Divide a problem into a series of tasks A processor completes a task sequentially and pipes the results to the next processor Pipelining.
COMPE575 Parallel & Cluster Computing 5.1 Pipelined Computations Chapter 5.
1 Lecture 24: Parallel Algorithms I Topics: sort and matrix algorithms.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Parallel Programming in C with MPI and OpenMP Michael J. Quinn.
Assignment Solving System of Linear Equations Using MPI Phạm Trần Vũ.
Programming With Java ICS201 University Of Hail1 Chapter 12 UML and Patterns.
 DATA STRUCTURE DATA STRUCTURE  DATA STRUCTURE OPERATIONS DATA STRUCTURE OPERATIONS  BIG-O NOTATION BIG-O NOTATION  TYPES OF DATA STRUCTURE TYPES.
CSCI-455/552 Introduction to High Performance Computing Lecture 13.
Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M
Data Structure Introduction.
Chun-Yuan Lin OpenMP-Programming training-5. “Type 2” Pipeline Space-Time Diagram.
Decomposition Data Decomposition – Dividing the data into subgroups and assigning each piece to different processors – Example: Embarrassingly parallel.
Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M
Prof. Amr Goneid, AUC1 Analysis & Design of Algorithms (CSCE 321) Prof. Amr Goneid Department of Computer Science, AUC Part 1. Complexity Bounds.
All-to-All Pattern A pattern where all (slave) processes can communicate with each other Somewhat the worst case scenario! 1 ITCS 4/5145 Parallel Computing,
Data Parallel Computations and Pattern ITCS 4/5145 Parallel computing, UNC-Charlotte, B. Wilkinson, slides6c.ppt Nov 4, c.1.
Introduction toData structures and Algorithms
Numerical Algorithms Chapter 11.
Potential for parallel computers/parallel programming
Parallel Computing and Parallel Computers
Linear Equations.
Auburn University COMP7330/7336 Advanced Parallel and Distributed Computing Data Partition Dr. Xiao Qin Auburn University.
Introduction to parallel algorithms
Pipelined Computations
Data Structures Recursion CIS265/506: Chapter 06 - Recursion.
CS4230 Parallel Programming Lecture 12: More Task Parallelism Mary Hall October 4, /04/2012 CS4230.
Lecture 16: Parallel Algorithms I
Lecture 22: Parallel Algorithms
Pipelining and Vector Processing
Array Processor.
Metode Eliminasi Pertemuan – 4, 5, 6 Mata Kuliah : Analisis Numerik
Decomposition Data Decomposition Functional Decomposition
Numerical Algorithms • Parallelizing matrix multiplication
CSCE569 Parallel Computing
Pipelined Computations
Introduction to parallel algorithms
Overview Parallel Processing Pipelining
Introduction to High Performance Computing Lecture 12
Pipeline Pattern ITCS 4/5145 Parallel Computing, UNC-Charlotte, B. Wilkinson, 2012 slides5.ppt Oct 24, 2013.
Pipelined Pattern This pattern is implemented in Seeds, see
Chapter 6: Transform and Conquer
All-to-All Pattern A pattern where all (slave) processes can communicate with each other Somewhat the worst case scenario! ITCS 4/5145 Parallel Computing,
All-to-All Pattern A pattern where all (slave) processes can communicate with each other Somewhat the worst case scenario! ITCS 4/5145 Parallel Computing,
Divide and Conquer Algorithms Part I
Pipeline Pattern ITCS 4/5145 Parallel Computing, UNC-Charlotte, B. Wilkinson, 2012 slides5.ppt March 20, 2014.
All-to-All Pattern A pattern where all (slave) processes can communicate with each other Somewhat the worst case scenario! ITCS 4/5145 Parallel Computing,
Parallel Computing and Parallel Computers
Potential for parallel computers/parallel programming
Potential for parallel computers/parallel programming
Matrix Addition and Multiplication
Potential for parallel computers/parallel programming
Quiz Questions Parallel Programming Parallel Computing Potential
Potential for parallel computers/parallel programming
Data Parallel Pattern 6c.1
Data Parallel Computations and Pattern
Introduction to parallel algorithms
Data Parallel Computations and Pattern
Presentation transcript:

Pipeline Pattern ITCS 4/5145 Parallel Computing, UNC-Charlotte, B. Wilkinson slides5.ppt August 17, 2014.

Pipeline pattern Computation divided into a series of tasks that have to be performed one after the other, with the result of one task passed on to the next task. Basis of sequential programming. Task 1 Task 3 Task 2 Result Pipeline pattern is rather specialized and applicable is certain problems and algorithms for good efficiency and speed up.

Effective Pipeline pattern To use as a effective parallel pattern, each task executed by a separate process/processor and somehow processes/ processors have to operate at the same time to get increased speed Task 1 Task 3 Task 2 Slave processes Result Master One way is the approach seen in a automobile assembly line, where a series cars are constructed, in this case a series of identical computations but with different data.

Seeds Pipeline Pattern See “Pipeline Template Tutorial.” by Jeremy Villalobos. http://coit-grid01.uncc.edu/seeds/docs/pipeline_tutorial.pdf Interface: public abstract class PipeLine extends BasicLayerInterface { public abstract Data Compute(int stage, Data input); public abstract Data DiffuseData(int segment); public abstract void GatherData(int segment, Data dat); public abstract int getDataCount(); public abstract int getStageCount(); }

Pipeline applications Broadly speaking, we can divide pipeline applications into two types: 1. More than one instance of complete problem is executed. Partial results passes from one pipeline stage to the next – example is an automobile assembly line building cars. 2. A single problem instance is executed that has a series of data items to be processed sequentially, each requiring multiple operations. Numbers pass from one stage to the next Although a pipeline application may exhibit features of both types. Sometimes a single problem instance requires a series of data items to be processed

Pipeline Space-Time Diagram 1. More than one instance of the complete problem is to be executed Pipeline Space-Time Diagram p stages m instances of problem Execution time = p + m – 1 steps

Speedup factor   So if we provide a constant stream of instances of the problem, get maximum speedup.  

Pipeline Space-Time Diagram 2. Single problem with a series of data items to be processed Pipeline Space-Time Diagram n data items Execution time = p + n – 1 steps

Speedup factor   So if we provide a constant stream of data items, get maximum speedup. Processors can use this form of pipeline for streams of data (video etc.)

Single problem with a series of data items to be processed Examples

Sorting numbers with a pipeline pattern Parallel version of Insertion sort Numbers to sort Insertion sort: Each number is inserted into the position such that all numbers before it are smaller, by comparing with all the numbers before it. 1 4, 3, 1, 2, 5 2 4, 3, 1, 2 5 5 3 4, 3, 1 2 2 4 4, 3 1 5 Time steps 3 5 5 1 2 4 4 3 6 1 2 5 4 5 7 1 2 3 4 8 1 2 3 5 5 9 1 2 3 4 10 1 2 3 4 5

Pipeline for sorting using insertion sort Receive x from Pi-1 if (stored_number < x) { send stored_number to Pi x = stored_number; } else send x to Pi The basic algorithm for process Pi is: Larger numbers P0 P0 P0 Series of number to sort xn-1, … x1, x0 Compare Compare Compare xmin Next smallest number Smallest number

Prime Number Generation: Sieve of Eratosthenes Series of all integers generated from 2. First number, 2, is prime and kept. All multiples of this number deleted as they cannot be prime. Process repeated with each remaining number. The algorithm removes non-primes, leaving only primes.

Other situations that a pipeline can be used effectively If information to start next process can be passed forward before all its internal operations have been completed.

a’s and b’s are constants and x’s are unknowns to be found. Example: Solving Upper-triangular System of Linear Equations using Back Substitution (created after Gaussian Elimination step for a general system of linear equations) a’s and b’s are constants and x’s are unknowns to be found.

Back Substitution First, unknown x0 is found from last equation; i.e., Value obtained for x0 substituted into next equation to obtain x1; i.e., Values obtained for x1 and x0 substituted into next equation to obtain x2: and so on until all the unknowns are found.

Pipeline Solution First pipeline stage computes x0 and passes x0 onto the second stage, which computes x1 from x0 and passes both x0 and x1 onto the next stage, which computes x2 from x0 and x1, and so on.

Pipeline processing using back substitution

More complex pipelines Two dimensional Multifunction, multiple paths, feedback and feedforward paths, multiple outputs -- these types of pipelines are found in logic design courses

Matrix-Vector Multiplication c = A x b A is a matrix, b and c are vectors. Matrix-vector multiplication follows directly from definition of matrix-matrix multiplication by making B an n x1 matrix (vector). Result an n x 1 matrix (vector). 20

Matrix-Vector Multiplication . . . . . . delay a a a a B[3] B[2] B[1] B[0] sin sout sin sout sin sout P0 P1 P2 P3 C[0] C[1] C[2] C[3] C elements accumulate in pipeline stages B array elements pass through

Might be more easy to see drawn this way

Matrix Multiplication Two-dimensional pipeline

Example pipeline with two paths This is an application for a pattern operator

Structures that allow two-way movement between stages Not truly a pipeline We will look into these structures separately.

Questions