Computer Science and Engineering Parallel and Distributed Processing CSE 8380 February 3, 2005 Session 7.

Slides:



Advertisements
Similar presentations
Parallel Algorithms.
Advertisements

PRAM Algorithms Sathish Vadhiyar. PRAM Model - Introduction Parallel Random Access Machine Allows parallel-algorithm designers to treat processing power.
Instructor Neelima Gupta Table of Contents Parallel Algorithms.
Optimal PRAM algorithms: Efficiency of concurrent writing “Computer science is no more about computers than astronomy is about telescopes.” Edsger Dijkstra.
Lecture 3: Parallel Algorithm Design
Parallel vs Sequential Algorithms
CSCI-455/552 Introduction to High Performance Computing Lecture 11.
Advanced Algorithms Piyush Kumar (Lecture 12: Parallel Algorithms) Welcome to COT5405 Courtesy Baker 05.
PRAM (Parallel Random Access Machine)
Efficient Parallel Algorithms COMP308
TECH Computer Science Parallel Algorithms  several operations can be executed at the same time  many problems are most naturally modeled with parallelism.
Advanced Topics in Algorithms and Data Structures Lecture pg 1 Recursion.
Advanced Topics in Algorithms and Data Structures Classification of the PRAM model In the PRAM model, processors communicate by reading from and writing.
PRAM Models Advanced Algorithms & Data Structures Lecture Theme 13 Prof. Dr. Th. Ottmann Summer Semester 2006.
Simulating a CRCW algorithm with an EREW algorithm Efficient Parallel Algorithms COMP308.
Advanced Topics in Algorithms and Data Structures
Uzi Vishkin.  Introduction  Objective  Model of Parallel Computation ▪ Work Depth Model ( ~ PRAM) ▪ Informal Work Depth Model  PRAM Model  Technique:
Slide 1 Parallel Computation Models Lecture 3 Lecture 4.
Overview Efficient Parallel Algorithms COMP308. COMP 308 Exam Time allowed : 2.5 hours Answer four questions (out of six). If you attempt to answer more.
1 Lecture 11 Sorting Parallel Computing Fall 2008.
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
1 Lecture 3 PRAM Algorithms Parallel Computing Fall 2008.
Fall 2008Paradigms for Parallel Algorithms1 Paradigms for Parallel Algorithms.
Basic PRAM algorithms Problem 1. Min of n numbers Problem 2. Computing a position of the first one in the sequence of 0’s and 1’s.
Simulating a CRCW algorithm with an EREW algorithm Lecture 4 Efficient Parallel Algorithms COMP308.
RAM and Parallel RAM (PRAM). Why models? What is a machine model? – A abstraction describes the operation of a machine. – Allowing to associate a value.
1 Lecture 2: Parallel computational models. 2  Turing machine  RAM (Figure )  Logic circuit model RAM (Random Access Machine) Operations supposed to.
Computer Science and Engineering Parallel and Distributed Processing CSE 8380 February 8, 2005 Session 8.
Parallel Algorithms Sorting and more. Keep hardware in mind When considering ‘parallel’ algorithms, – We have to have an understanding of the hardware.
A.Broumandnia, 1 5 PRAM and Basic Algorithms Topics in This Chapter 5.1 PRAM Submodels and Assumptions 5.2 Data Broadcasting 5.3.
COMP308 Efficient Parallel Algorithms
Outline  introduction  Sorting Networks  Bubble Sort and its Variants 2.
Computer Science and Engineering Parallel and Distributed Processing CSE 8380 March 01, 2005 Session 14.
Sorting. Quick Sort Example 2, 1, 3, 4, 5 2, 4, 3, 1, 5, 5, 6, 9, 7, 8, 5 S={6, 5, 9, 2, 4, 3, 5, 1, 7, 5, 8} 1, 234, 5 5 5, 6, 7, 8, 9.
Graph Algorithms. Definitions and Representation An undirected graph G is a pair (V,E), where V is a finite set of points called vertices and E is a finite.
-1.1- Chapter 2 Abstract Machine Models Lectured by: Nguyễn Đức Thái Prepared by: Thoại Nam.
RAM, PRAM, and LogP models
1 PRAM Algorithms Sums Prefix Sums by Doubling List Ranking.
1Computer Sciences Department. Book: Introduction to Algorithms, by: Thomas H. Cormen Charles E. Leiserson Ronald L. Rivest Clifford Stein Electronic:
Parallel Algorithms. Parallel Models u Hypercube u Butterfly u Fully Connected u Other Networks u Shared Memory v.s. Distributed Memory u SIMD v.s. MIMD.
06/12/2015Applied Algorithmics - week41 Non-periodicity and witnesses  Periodicity - continued If string w=w[0..n-1] has periodicity p if w[i]=w[i+p],
Parallel Processing & Distributed Systems Thoai Nam Chapter 2.
Data Structures and Algorithms in Parallel Computing Lecture 1.
5 PRAM and Basic Algorithms
Lecture 9 Architecture Independent (MPI) Algorithm Design
Algorithmics - Lecture 41 LECTURE 4: Analysis of Algorithms Efficiency (I)
3/12/2013Computer Engg, IIT(BHU)1 PRAM ALGORITHMS-3.
BITS Pilani Pilani Campus Data Structure and Algorithms Design Dr. Maheswari Karthikeyan Lecture1.
3/12/2013Computer Engg, IIT(BHU)1 PRAM ALGORITHMS-1.
Computer Science and Engineering Parallel and Distributed Processing CSE 8380 April 28, 2005 Session 29.
PRAM and Parallel Computing
Introduction to Algorithms
Lecture 3: Parallel Algorithm Design
PRAM Model for Parallel Computation
COMPUTATIONAL MODELS.
Parallel Algorithms (chap. 30, 1st edition)
Lecture 2: Parallel computational models
Parallel computation models
PRAM Algorithms.
CS 583 Fall 2006 Analysis of Algorithms
PRAM Model for Parallel Computation
PRAM architectures, algorithms, performance evaluation
Bitonic Sorting and Its Circuit Design
Lecture 5 PRAM Algorithms (cont.)
CSE838 Lecture notes copy right: Moon Jung Chung
Professor Ioana Banicescu CSE 8843
Unit –VIII PRAM Algorithms.
Introduction to Algorithms
Parallel Algorithms A Simple Model for Parallel Processing
Module 6: Introduction to Parallel Computing
Presentation transcript:

Computer Science and Engineering Parallel and Distributed Processing CSE 8380 February 3, 2005 Session 7

Computer Science and Engineering Contents Abstract Models PRAM Model Complexity Analysis Introduction to Parallel Algorithms Sorting

Computer Science and Engineering What is a Model? According to Webster’s Dictionary, a model is “a description or analogy used to help visualize something that cannot be directly observed.” According to The Oxford English Dictionary, a model is “a simplified or idealized description or conception of a particular system, situation or process.”

Computer Science and Engineering Why Models? In general, the purpose of Modeling is to capture the salient characteristics of phenomena with clarity and the right degree of accuracy to facilitate analysis and prediction. Megg, Matheson and Tarjan (1995)

Computer Science and Engineering Models in Problem Solving  Computer Scientists use models to help design problem solving tools such as:  Fast Algorithms  Effective Programming Environments  Powerful Execution Engines

Computer Science and Engineering A model is an interface separating high level properties from low level ones An Interface Applications Architectures Provides operations Requires implementation MODEL

Computer Science and Engineering Models in this class  Shared Memory Model  Distributed Memory Model

Computer Science and Engineering PRAM Model Synchronized Read Compute Write Cycle EREW ERCW CREW CRCW Complexity: T(n), P(n), C(n) Control Private Memory P1P1 Private Memory P2P2 Private Memory PpPp Global Memory

Computer Science and Engineering The PRAM model and its variations (cont.)  There are different modes for read and write operations in a PRAM.  Exclusive read(ER)  Exclusive write(EW)  Concurrent read(CR)  Concurrent write(CW)  Common  Arbitrary  Minimum  Priority  Based on the different modes described above, the PRAM can be further divided into the following four subclasses.  EREW-PRAM model  CREW-PRAM model  ERCW-PRAM model  CRCW-PRAM model

Computer Science and Engineering Analysis of Algorithms  Sequential Algorithms  Time Complexity  Space Complexity  An algorithm whose time complexity is bounded by a polynomial is called a polynomial-time algorithm. An algorithm is considered to be efficient if it runs in polynomial time.

Computer Science and Engineering Analysis of Sequential Algorithms NP P NP-complete NP-hard The relationships among P, NP, NP-complete, NP-hard

Computer Science and Engineering Analysis of parallel algorithm Performance of a parallel algorithm is expressed in terms of how fast it is and how much resources it uses when it runs. Run time, which is defined as the time during the execution of the algorithm Number of processors the algorithm uses to solve a problem The cost of the parallel algorithm, which is the product of the run time and the number of processors

Computer Science and Engineering Analysis of parallel algorithm The NC-class and P-completeness NP P NP-complete NC P-complete NP-hard The relationships among P, NP, NP-complete, NP-hard, NC, and P- complete

Computer Science and Engineering Simulating multiple accesses on an EREW PRAM  Broadcasting mechanism:  P1 reads x and makes it known to P2.  P1 and P2 make x known to P3 and P4, respectively, in parallel.  P1, P2, P3 and P4 make x known to P5, P6, P7 and P8, respectively, in parallel.  These eight processors will make x know to another eight processors, and so on.

Computer Science and Engineering Simulating multiple accesses on an EREW PRAM (cont.) Simulating Concurrent read on EREW PRAM with eight processors using Algorithm Broadcast_EREW x x x P1 (a) x x x x P2 (b) x x x x x P3 (c) x x x x x x x x x P5 (d) x P4 x P6 x P7 x P8 LLL L

Computer Science and Engineering Parallel Algorithms  Constructs  Processor Pi  Forall  Where  Do in Parallel  Others

Computer Science and Engineering Simulating multiple accesses on an EREW PRAM (cont.) Algorithm Broadcast_EREW Processor P 1 y (in P 1 ’s private memory)  x L[1]  y for i=0 to log p-1 do forall P j, where 2 i +1 < j < 2 i+1 do in parallel y (in P j ’s private memory)  L[j-2 i ] L[j]  y endfor

Computer Science and Engineering Enumeration Sort  Given a list on n numbers a 1, a 2, …, a n  We try to find the position of each element a i in the sorted list by computing the number of elements smaller than it  It c i elements are smaller than a i, then it is the (c i +1)th element in the sorted list  If 2 or more elements have the same value, the element with the largest index in the unsorted list will be considered the largest in the sorted list.

Computer Science and Engineering Sort-CRCW Assumptions  To sort n elements, we use n 2 processors (n rows and n columns)  P i,j  processor in row i, column j  Concurrent write  sum of all values  A[1..n] array of elements in global memory  C[1..n]  array to store number of elements smaller than every element in A

Computer Science and Engineering Sort-CRCW  Two steps 1. Each row of processors i computes C[i], the number of elements smaller than A[i]. Each processor P i,j compares A[i] and A[j], then updates C[i] appropriately 2. The first row in each P i,1 row places places A[i] in its proper position in the sorted list (C[i] + 1)

Computer Science and Engineering Algorithm Details Detail of two step Algorithm /* step 1 */ forall P i,j, where 1 < i, j<n do in parallel if A[i] > A[j] or (A[i] = A[j] and i > j) then C[i]  1 else C[i]  0 endif endfor /* step 2 */ forall P i,l, where 1 < i<n do in parallel A[C[i] +1]  A [i] endfor

Computer Science and Engineering Complexity  Run time: T(n) = O(1)  Number of processors: P(n) = n 2  Cost: c(n) = O(n 2 )  Is it cost optimal?  No! (sequential sort can be done in O(n log n)

Computer Science and Engineering Example: sort (9, 4, 6) P 1,1 P 1,2 P 1,3 649 A = 9 & 99 & 49 & 6 P 2,1 P 2,2 P 2,3 4 & 94 & 44 & 6 P 3,1 P 3,2 P 3,3 6 & 96 & 46 & C = 964 A = Concurrent write SUM T(n) = O(1) P(n) = n 2 C(n) = T(n) * P(n) = O(n 2 )