1 / 18

Linked List Ranking

Linked List Ranking. Parallel Algorithms. Work Analysis – Pointer Jumping. Number of Steps: Tp = O(Log N) Number of Processors: N Work = O(N log N) T1 = O(N) Work Optimal??. Common List Ranking Strategy. Reduce Rank Expand Strategy Similar to Odd-Even Prefix Sums

lorin
Download Presentation

Linked List Ranking

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Linked List Ranking Parallel Algorithms

  2. Work Analysis – Pointer Jumping • Number of Steps: Tp = O(Log N) • Number of Processors: N • Work = O(N log N) • T1 = O(N) • Work Optimal??

  3. Common List Ranking Strategy • Reduce Rank Expand Strategy • Similar to Odd-Even Prefix Sums • Algorithms vary in how items are selected for deletion in the Reduce Step • Some variation in the Expand Step.

  4. Reduce Rank Expand • Reduction Step - Delete non-adjacent elements in parallel until the list is of size O(p) (algorithms vary is this step) • Rank Step – Pointer jumping to rank the p remaining elements • Expand Step – Reinsert elements (in the reverse order), computing the rank as it is inserted

  5. Asynchronous PRAM – APRAM • Variant of the PRAM model • Features of CRCW PRAM – Plus • Processors may have different clock speeds and work asynchronously • Each processor has own random number generator

  6. Randomized Algorithm • Some portion of the algorithm’s outcome is non-deterministic • Performance stated in terms of expected order of time complexity – EO(f(n)) • EO(f(n)) – with high probability the results are within order f(n)

  7. APRAM List Ranking by Martel & Subramonian • Select m=EO(n/log n) elements at random • Each generates a random number between 1-N, selects those with values 1 to N / log N • Perform log log n iterations of pointer jumping • Each points to selected, nil, or pointer length log n • Pack selected elements to smaller array • Scan: each selected points to next selected or nil • Compute ranks of selected list-pointer jumping • Copy back to original list; scan to complete ranks *EO(n log log n) using p = O(n/log n)

  8. Demo: APRAM Randomized Algorithm

  9. Modifications for EREW Model APRAM • Each PU operates asynchronously • Must synchronize each at step • Steps 2, 4, 6 allow for Concurrent Reads EREW • Default execution is synchronous • Partition the array to eliminate Concurrent Reads

  10. Randomized EREW Algorithm (4.1) • Select O(p) elements at random • Each generates a random number between 1-N, selects those with values 1 to N / log N • Pack selected items into smaller array • Scan from selected item to next to set rank • Rank selected elements by pointer jumping • Write ranks back to original array • Scan from selected items to set remaining ranks

  11. Demo: EREW Randomized Algorithm

  12. Complexity Analysis • Selection - EO(n/p) • Compaction - prefix sums EO(n/p + log p) • Form LL - EO(n/p) • Pointer Jumping - EO ( n/p + log p) • Sequential Scan - EO(n/p) • OVERALL - EO ( n/p + log p) • Optimal speedup for p <= O (n / log n) • Which gives EO ( log n) time • See paper for proof.

  13. What next?? • Can we accomplish an O(log n) deterministic algorithm? • What was randomized in other algorithms? • Can it be made deterministic?

  14. Answer! • Yes & No, • Can Reduce deterministically! • Near Optimal • 2-Ruling Set (Cole & Vishkin) • A subset of the list such that no 2 elements are adjacent & there are exactly 1 or 2 non-ruling set elements between each ruling set element & its nearest successor

  15. Deterministic EREW LLR Step 1 • Select a Ruling Set of O(p) elements, O(n/p) distance apart • Keep track of actual distance (for ranking) • Repeatedly apply 2-Ruling Set Algorithm to increase the distance between the elements • Remaining steps are same

  16. Complexity Analysis • Select O(p) elements O(n/p) distance apart – O(n/p * log (n/p)) • Compact – O(n/p + log p) • Rank – O(n/p + log p) • Write back then Scan – O(n/p) O((log p) + (n/p) * log(n/p)) = O(n/p * log (n/p) ) for n>= p log p = O(log n log log n) for p =O(n/log n) Work O(n log log n)

  17. Advantages of New Algorithms • Simple, use basic strategies • Small constants • Small space requirements • Optimal & Near Optimal

More Related