the power of how fast is sorting parallel computation
play

The power of How fast is sorting? parallel computation Input: - PowerPoint PPT Presentation

The power of How fast is sorting? parallel computation Input: array of numbers. 2 , D. J. Bernstein Each number in 1 2 represented in binary. Thanks to: University of Illinois at Chicago Output:


  1. ✂ � � ✁ ✂ ✂ ✁ The power of How fast is sorting? parallel computation Input: array of numbers. � 2 , D. J. Bernstein Each number in 1 ✁ 2 represented in binary. Thanks to: University of Illinois at Chicago Output: array of numbers, NSF CCR–9983950 in increasing order, Alfred P. Sloan Foundation represented in binary; same multiset as input. A machine is given the input and computes the output. How much time does it use?

  2. ✂ ✁ � � ✁ � ✂ ✂ How fast is sorting? The answer depends computation how the machine w Input: array of numbers. � 2 , Each number in 1 ✁ 2 Possibility 1: The represented in binary. “1-tape Turing machine using selection sort.” Illinois at Chicago Output: array of numbers, CCR–9983950 in increasing order, Specifically: The machine Foundation represented in binary; a 1-dimensional arra � ) “cells.” same multiset as input. containing Θ( Each cell stores Θ(lg A machine is given the input and computes the output. Input and output a How much time does it use? stored in these cells.

  3. ✂ � � ✁ ✂ ✂ ✁ How fast is sorting? The answer depends on how the machine works. Input: array of numbers. � 2 , Each number in 1 ✁ 2 Possibility 1: The machine is a represented in binary. “1-tape Turing machine using selection sort.” Output: array of numbers, in increasing order, Specifically: The machine has represented in binary; a 1-dimensional array � ) “cells.” same multiset as input. containing Θ( � ) bits. Each cell stores Θ(lg A machine is given the input and computes the output. Input and output are How much time does it use? stored in these cells.

  4. ✂ ✂ � � ✁ ✁ ✂ rting? The answer depends on The machine also how the machine works. “head” moving through numbers. Head contains Θ(1) � 2 , 1 ✁ 2 Possibility 1: The machine is a binary. “1-tape Turing machine Head can see the cell using selection sort.” its current array position; of numbers, perform arithmetic rder, Specifically: The machine has move to adjacent a binary; a 1-dimensional array � ) “cells.” input. containing Θ( Selection sort: Head � ) bits. Each cell stores Θ(lg looks at each array given the input picks up the largest the output. Input and output are moves it to the end does it use? stored in these cells. picks up the second etc.

  5. The answer depends on The machine also has a how the machine works. “head” moving through array. Head contains Θ(1) cells. Possibility 1: The machine is a “1-tape Turing machine Head can see the cell at using selection sort.” its current array position; perform arithmetic etc.; Specifically: The machine has move to adjacent array position. a 1-dimensional array � ) “cells.” containing Θ( Selection sort: Head � ) bits. Each cell stores Θ(lg looks at each array position, picks up the largest number, Input and output are moves it to the end of the array, stored in these cells. picks up the second largest, etc.

  6. � � ends on The machine also has a Moving to adjacent � (1) seconds. machine works. “head” moving through array. takes Head contains Θ(1) cells. The machine is a Moving a number � (1) seconds. � 1+ machine Head can see the cell at takes sort.” its current array position; Same for comparisons perform arithmetic etc.; machine has Total sorting time: move to adjacent array position. � (1) seconds. � 2+ array “cells.” Selection sort: Head Cost of machine: � ) bits. Θ(lg looks at each array position, � (1) Euros � 1+ picks up the largest number, � (1) cells. � 1+ output are for moves it to the end of the array, cells. Negligible extra cost picks up the second largest, etc.

  7. � The machine also has a Moving to adjacent array position � (1) seconds. “head” moving through array. takes Head contains Θ(1) cells. Moving a number to end of array � (1) seconds. � 1+ Head can see the cell at takes its current array position; Same for comparisons etc. perform arithmetic etc.; Total sorting time: move to adjacent array position. � (1) seconds. � 2+ Selection sort: Head Cost of machine: looks at each array position, � (1) Euros � 1+ picks up the largest number, � (1) cells. � 1+ for moves it to the end of the array, Negligible extra cost for head. picks up the second largest, etc.

  8. � � � � � ✂ also has a Moving to adjacent array position Possibility 2: The � (1) seconds. through array. takes “2-dimensional RAM Θ(1) cells. using merge sort.” Moving a number to end of array � ) � (1) seconds. � 1+ the cell at takes Machine has Θ( position; Same for comparisons etc. in a 2-dimensional � ) rows, Θ( rithmetic etc.; Θ( Total sorting time: adjacent array position. Machine also has a � (1) seconds. � 2+ Head Merge sort: Head Cost of machine: rray position, sorts first 2 ✁ numb � (1) Euros � 1+ rgest number, sorts last 2 ✄ numb � (1) cells. � 1+ for end of the array, merges the sorted Negligible extra cost for head. second largest,

  9. � � ✂ � � Moving to adjacent array position Possibility 2: The machine is a � (1) seconds. takes “2-dimensional RAM using merge sort.” Moving a number to end of array � ) cells � (1) seconds. � 1+ takes Machine has Θ( Same for comparisons etc. in a 2-dimensional array: � ) rows, Θ( � ) columns. Θ( Total sorting time: Machine also has a head. � (1) seconds. � 2+ Merge sort: Head recursively Cost of machine: sorts first 2 ✁ numbers; � (1) Euros � 1+ sorts last 2 ✄ numbers; � (1) cells. � 1+ for merges the sorted lists. Negligible extra cost for head.

  10. � � � � � ✂ � � � � � � � � � � � � � � adjacent array position Possibility 2: The machine is a Merging requires seconds. “2-dimensional RAM to “random” array using merge sort.” � 0 er to end of array Average jump: � ) cells seconds. Machine has Θ( to adjacent array p risons etc. in a 2-dimensional array: Each move takes � ) rows, Θ( � ) columns. Θ( time: Total sorting time: Machine also has a head. seconds. � (1) seconds. � 1 � 5+ Merge sort: Head recursively machine: Cost of machine: once sorts first 2 ✁ numbers; � (1) Euros. � 1+ sorts last 2 ✄ numbers; cells. merges the sorted lists. cost for head.

  11. ✂ � � � � � (1) jumps � 1+ Possibility 2: The machine is a Merging requires “2-dimensional RAM to “random” array positions. using merge sort.” � (1) moves � 0 � 5+ Average jump: � ) cells Machine has Θ( to adjacent array positions. in a 2-dimensional array: � (1) seconds. Each move takes � ) rows, Θ( � ) columns. Θ( Total sorting time: Machine also has a head. � (1) seconds. � 1 � 5+ Merge sort: Head recursively Cost of machine: once again sorts first 2 ✁ numbers; � (1) Euros. � 1+ sorts last 2 ✄ numbers; merges the sorted lists.

  12. � � � � ✂ � � (1) jumps � 1+ The machine is a Merging requires Possibility 3: The RAM to “random” array positions. “pipelined 2-dimensional rt.” using radix-2 sort.” � (1) moves � 0 � 5+ Average jump: � ) cells � ) to adjacent array positions. Machine has Θ( 2-dimensional array: in a 2-dimensional � (1) seconds. Each move takes � ) columns. Θ( Each cell in the arra Total sorting time: has a head. network links to the � (1) seconds. � 1 � 5+ cells in the same column. Head recursively Each cell in the top Cost of machine: once again ✁ numbers; network links to the � (1) Euros. � 1+ ✄ numbers; cells in the top row. rted lists. Machine also has a attached to top-left

  13. � � (1) jumps � 1+ Merging requires Possibility 3: The machine is a to “random” array positions. “pipelined 2-dimensional RAM using radix-2 sort.” � (1) moves � 0 � 5+ Average jump: � ) cells to adjacent array positions. Machine has Θ( in a 2-dimensional array. � (1) seconds. Each move takes Each cell in the array has Total sorting time: network links to the 2 adjacent � (1) seconds. � 1 � 5+ cells in the same column. Each cell in the top row has Cost of machine: once again network links to the 2 adjacent � (1) Euros. � 1+ cells in the top row. Machine also has a CPU attached to top-left cell.

  14. � � � � � � � � (1) jumps � 1+ Possibility 3: The machine is a Radix-2 sort: CPU rray positions. “pipelined 2-dimensional RAM shuffles array using using radix-2 sort.” even numbers befo � (1) moves � 0 � 5+ 3 1 4 1 5 9 2 6 � ) cells y positions. Machine has Θ( 4 2 6 3 1 1 5 9. in a 2-dimensional array. � (1) seconds. es Each cell in the array has Then using bit 1: time: network links to the 2 adjacent 4 1 1 5 9 2 6 3. seconds. cells in the same column. Then using bit 2: Each cell in the top row has machine: once again 1 1 9 2 3 4 5 6. network links to the 2 adjacent Then using bit 3: cells in the top row. 1 1 2 3 4 5 6 9. Machine also has a CPU � ) bits. etc. Θ(lg attached to top-left cell.

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend