PRAM algorithms from deepika


Published on

Basic PRAM algorithms

Published in: Education, Technology
1 Comment
  • please provide main source.
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

PRAM algorithms from deepika

  1. 1. KUVEMPU UNIVERSITY Department of Computer Science Jnana Sahyadri Shankarghatta Seminar on “ PRAM ALGORITHMS ” Presented by : Deepika R, 2 nd sem , M.Sc, Dept. Of Computer Science, Shankarghatta. Under the Guidance of : Suresh M, Dept. Of Computer Science, Shankarghatta.
  2. 2. <ul><li>Contents: </li></ul><ul><ul><ul><ul><li>Introduction </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Computational Model </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Merging </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Sorting </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Computing the Convex Hull </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Applications </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Conclusion </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Bibliography </li></ul></ul></ul></ul>
  3. 3. Introduction: There are many application in day to day life that demand real time solution to problem. For example weather forecasting has to done in a timely fashion etc.. If an expert system is used to aid a physician in surgical procedures ,decisions have to be made within seconds. And so on. Programs written for such applications have to perform an enormous amount of computation. Even the fastest single-processor machine may not be able to come up with solutions within tolerable time limits. Parallel Random Access Machines (PRAM) offer the potential of decreasing the solution times enormously .
  4. 4. Example:- Say there are 100 numbers to be added and there are two persons A and B. Person A can add the first 50 numbers. At the same time B can add the next 50 numbers. When they are done, one of them can add two individual sums to get the final answer. So two people can add the 100 numbers in almost half the time required by one.
  5. 5. Computational model:- In the RAM (Random Access Machine) we assume that any of the following operation can be done in one unit of time: addition, subtraction, multiplication, division, comparison, memory access, assignment, and so on. This model widely accepted as a valid sequential model. An important feature of parallel computing that is absent in sequential computing is need for interprocessor communication . For example given any problem, the processor have to communicate among themselves and agree on the subproblems each will work on. Also they need to communicate to see whether every one has finished its task so on.
  6. 6. <ul><li>Contd… </li></ul><ul><li>Parallel models can be broadly categorized into 2 types: </li></ul><ul><li>Fixed connection machines </li></ul><ul><li>Shared memory machines </li></ul>
  7. 7. Fixed connection machines A fixed connection network is a graph whose nodes represent processor and edges represent communication links between processors. Here communication time depends on the lengths of these path. Ex:-
  8. 8. Shared memory model Here a number of processor work synchronously. They communicate with each other using common block of global memory that is accessible by all. This global memory is called common or shared memory.
  9. 9. Memory Access in PRAM <ul><li>Exclusive Read (ER): p processors can simultaneously read the content of p distinct memory locations. </li></ul><ul><li>Concurrent Read (CR): p processors can simultaneously read the content of p’ memory locations, where p’ < p . </li></ul><ul><li>Exclusive Write (EW): p processors can simultaneously write the content of p distinct memory locations. </li></ul><ul><li>Concurrent Write (CW): p processors can simultaneously write the content of p’ memory locations, where p’ < p . </li></ul>
  10. 10. Odd-Even Merge Odd-even merge is a merging algorithm based on divide-and conquer that yield itself to efficient parallelization. Step 1. Partition X 1 and X 2 into their odd and even parts. That is, partition X 1 odd =k 1 ,k 3 ,…..,k m-1 and X 1 even =k 2 ,k 4 ,…..,k m . Similarly, partition X 2 into X 2 odd and X 2 even Step 2. Recursively merge X 1 odd with X 2 odd using m processors. Let L 1 =l 1 ,l 2 ,……..l m be the result. Note that X 1 odd , X 1 even , X 2 odd and X 2 even using other m processors to get L 2 =l m+1 ,l m+2 ,……..l 2m Step 3.Shuffle L 1 and L 2 ; that is, form the sequence L=l 1 ,l m+1 ,l 2 ,l m+2 ,……..l m ,l 2m . Compare every pair and inter change them if they are out of order. That is, compare l m+1 with l 2 and interchange them if need be, compare l m+2 with l 3 and interchange them if need be, so on, Output the resultant sequence.
  11. 11. X1=2,5,8,11,13,16,21,25 X2=4,9,12,18,23,27,31,34 2,8,13,21 5,11,16,25 4,12,23,31 9,18,27,34 L 1 = 2,4,8,12,13,21,23,31 L 2 =5,9,11,16,18,25,27,34 L=2, 5,4 9,8 11,12 16,13 18,21 25,23 27,31 ,34 2,4,5,8,9,11,12,13,16,18,21,23,25,31,34 Compare and exchange Shuffle Merge Merge X 1 odd X 1 even X 2 odd X 2 even
  12. 12. Sorting Sorting is the task of arranging an unordered collection (sequence) of elements into monotonically increasing (or decreasing) order. Odd-Even Merge Sort Odd even merge sort employs the classical divide and conquer strategy. If X=k 1 ,k 2 ,…..,k n is the given sequence of n keys, it is partitioned into two subsequences X 1 1 =k 1 ,k 2 ,…..,k n/2 and X 2 1 =k n/2+1 ,k n/2+2 ,…..,k n of equal length. X 1 1 and X 2 1 are sorted recursively assigning n/2 processor to each. The two sorted subsequences are then finally merged.
  13. 14. <ul><li>Computing the Convex Hull </li></ul><ul><li>Take the set of points and divide the set into two halves </li></ul><ul><li>Assume that recursive call computes the convex hull of the two halves </li></ul><ul><li>Conquer stage: take the two convex hulls and merge it to obtain the convex hull for the entire set </li></ul>
  14. 16. Application:- PRAM on chip
  15. 17. <ul><li>Conclusions </li></ul><ul><ul><li>PRAM algorithm is the source of most fundamental ideas </li></ul></ul><ul><ul><li>It’s a source of inspiration for algorithms </li></ul></ul><ul><ul><li>PRAM is simple and easy to understand </li></ul></ul>
  16. 18. Bibliography: <ul><li>Fundamentals of Computer Algorithms </li></ul><ul><li>Ellis Horowitz </li></ul><ul><li> Sartaj Sahai </li></ul><ul><li> Sangunathevar Rajasekaran </li></ul>
  17. 19. Any Queries?????
  18. 20. Thank you…