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.

Slides:



Advertisements
Similar presentations
PRAM Algorithms Sathish Vadhiyar. PRAM Model - Introduction Parallel Random Access Machine Allows parallel-algorithm designers to treat processing power.
Advertisements

Optimal PRAM algorithms: Efficiency of concurrent writing “Computer science is no more about computers than astronomy is about telescopes.” Edsger Dijkstra.
Advanced Topics in Algorithms and Data Structures Lecture 7.2, page 1 Merging two upper hulls Suppose, UH ( S 2 ) has s points given in an array according.
Lecture 3: Parallel Algorithm Design
1 Parallel Parentheses Matching Plus Some Applications.
Parallel vs Sequential Algorithms
Advanced Algorithms Piyush Kumar (Lecture 12: Parallel Algorithms) Welcome to COT5405 Courtesy Baker 05.
PRAM (Parallel Random Access Machine)
Advanced Topics in Algorithms and Data Structures Lecture 7.1, page 1 An overview of lecture 7 An optimal parallel algorithm for the 2D convex hull problem,
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.
Advanced Topics in Algorithms and Data Structures Lecture 6.1 – pg 1 An overview of lecture 6 A parallel search algorithm A parallel merging algorithm.
Advanced Topics in Algorithms and Data Structures Page 1 Parallel merging through partitioning The partitioning strategy consists of: Breaking up the given.
Simulating a CRCW algorithm with an EREW algorithm Efficient Parallel Algorithms COMP308.
Uzi Vishkin.  Introduction  Objective  Model of Parallel Computation ▪ Work Depth Model ( ~ PRAM) ▪ Informal Work Depth Model  PRAM Model  Technique:
Stanford University CS243 Winter 2006 Wei Li 1 Loop Transformations and Locality.
Advanced Topics in Algorithms and Data Structures 1 Lecture 4 : Accelerated Cascading and Parallel List Ranking We will first discuss a technique called.
Prune-and-search Strategy
1 Lecture 11 Sorting Parallel Computing Fall 2008.
Accelerated Cascading Advanced Algorithms & Data Structures Lecture Theme 16 Prof. Dr. Th. Ottmann Summer Semester 2006.
Parallel Merging Advanced Algorithms & Data Structures Lecture Theme 15 Prof. Dr. Th. Ottmann Summer Semester 2006.
1 Lecture 6 More PRAM Algorithm Parallel Computing Fall 2008.
5 - 1 § 5 The Divide-and-Conquer Strategy e.g. find the maximum of a set S of n numbers.
Time-series data analysis
CSC 2300 Data Structures & Algorithms March 20, 2007 Chapter 7. Sorting.
11-1 Matrix-chain Multiplication Suppose we have a sequence or chain A 1, A 2, …, A n of n matrices to be multiplied –That is, we want to compute the product.
1 Lecture 3 PRAM Algorithms Parallel Computing Fall 2008.
Fall 2008Paradigms for Parallel Algorithms1 Paradigms for Parallel Algorithms.
Advanced Topics in Algorithms and Data Structures 1 Two parallel list ranking algorithms An O (log n ) time and O ( n log n ) work list ranking algorithm.
Simulating a CRCW algorithm with an EREW algorithm Lecture 4 Efficient Parallel Algorithms COMP308.
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.
Outline  introduction  Sorting Networks  Bubble Sort and its Variants 2.
© The McGraw-Hill Companies, Inc., Chapter 6 Prune-and-Search Strategy.
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.
CSCI 256 Data Structures and Algorithm Analysis Lecture 14 Some slides by Kevin Wayne copyright 2005, Pearson Addison Wesley all rights reserved, and some.
The LCA Problem Revisited
1 Lectures on Parallel and Distributed Algorithms COMP 523: Advanced Algorithmic Techniques Lecturer: Dariusz Kowalski Lectures on Parallel and Distributed.
1 PRAM Algorithms Sums Prefix Sums by Doubling List Ranking.
Computer Science and Engineering Parallel and Distributed Processing CSE 8380 February 3, 2005 Session 7.
Complexity 20-1 Complexity Andrei Bulatov Parallel Arithmetic.
Parallel architecture Technique. Pipelining Processor Pipelining is a technique of decomposing a sequential process into sub-processes, with each sub-process.
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],
1 Sorting (Bubble Sort, Insertion Sort, Selection Sort)
“Sorting networks and their applications”, AFIPS Proc. of 1968 Spring Joint Computer Conference, Vol. 32, pp
Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar
Fall 2008Simple Parallel Algorithms1. Fall 2008Simple Parallel Algorithms2 Scalar Product of Two Vectors Let a = (a 1, a 2, …, a n ); b = (b 1, b 2, …,
Introduction to Complexity Analysis. Computer Science, Silpakorn University 2 Complexity of Algorithm algorithm คือ ขั้นตอนการคำนวณ ที่ถูกนิยามไว้อย่างชัดเจนโดยจะ.
Data Structures and Algorithms in Parallel Computing Lecture 8.
CSCI-256 Data Structures & Algorithm Analysis Lecture Note: Some slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. 18.
3/12/2013Computer Engg, IIT(BHU)1 PRAM ALGORITHMS-3.
Compressing Bi-Level Images by Block Matching on a Tree Architecture Sergio De Agostino Computer Science Department Sapienza University of Rome ITALY.
3/12/2013Computer Engg, IIT(BHU)1 PRAM ALGORITHMS-1.
Example 2 You are traveling by a canoe down a river and there are n trading posts along the way. Before starting your journey, you are given for each 1
PRAM and Parallel Computing
Lecture 3: Parallel Algorithm Design
Parallel Algorithms (chap. 30, 1st edition)
Advanced Algorithms Analysis and Design
Lecture 2: Parallel computational models
Parallel computation models
PRAM Algorithms.
Lecture 5 PRAM Algorithms (cont.)
Numerical Algorithms Quiz questions
Unit –VIII PRAM Algorithms.
Parallel Algorithms A Simple Model for Parallel Processing
Module 6: Introduction to Parallel Computing
Presentation transcript:

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.

Basic techniques for CRCW PRAM  The Common CRCW rule allows concurrent writes only when all the processors attempting to write into a common memory location are trying to write the same value. Problem 1. Min of n numbers Sequential solution – linear time Parallel optimal solution – constant time and linear number of processors.

The following program computes MIN of n numbers stored in the array C[1..n] in O(1) time with n 2 processors. Algorithm A1 for each 1  i  n do in parallel M[i]:=0 for each 1  i,j  n do in parallel if i  j C[i]  C[j] then M[j]:=1 for each 1  i  n do in parallel if M[i]=0 then output:=i

Let us reduce a number of processors  Assume that we have an algorithm A k working in O(1) time with processors Algorithm A k+1 1.Let  =1/2 2. Partition the input array C of size n into disjoint blocks of size n  each 3. Apply in parallel algorithm A k to each of these blocks 4. Apply algorithm A k to the array C’ consisting of n/ n  minima in the blocks.

Complexity  We can compute minimum of n numbers using CRCW PRAM model in O(log log n) with n processors by applying a strategy of partitioning the input into pieces of size ParCost = n  log log n

Problem 2. Computing a position of the first one in the sequence of 0’s and 1’s. FIRST-ONE-POSITION(A)=4 for the input array A=[0,0,0,1,0,0,0,1,1,1,0,0,0,1] Algorithm A (2 parallel steps and n 2 processors) for each 1  i<j  n do in parallel if A[i] =1 and A[j]=1 then A[j]:=0 for each 1  i  n do in parallel if A[i] =1 then FIRST-ONE-POSITION:=i

Reducing number of processors Algorithm B – it reports if there is any one in the table. There-is-one:=0 for each 1  i  n do in parallel if A[i] =1 then There-is-one:=1

Now we can merge two algorithms 1.Partition table A into segments of size 2.In each segment apply the algorithm B 3.Find position of the first one in these sequence by applying algorithm B 4.Apply algorithm A to this single segment and compute the final value

Complexity  We apply twice algorithm A each time to the array of length which need only ( ) 2 = n processors  The time is O(1) and number of processors is n.