M. Jaros and M. Piotr´ ow Faster Merging Networks University of Wroclaw with Constant Periods Faster Merging Networks with Constant Periods Marek Piotr´ ow (a join work with Michał Jaros) JAF25 — CMFBD 2006 Faculty of Mathematics and Computer Science 1
M. Jaros and M. Piotr´ ow Faster Merging Networks University of Wroclaw with Constant Periods The talk outline • Bitonic parallel sorting through merging • Comparator networks • Some results • Key proof techniques • Conclusions Faculty of Mathematics and Computer Science 2
M. Jaros and M. Piotr´ ow Faster Merging Networks University of Wroclaw with Constant Periods Bitonicsort algorithm for a k -dimensional hypercube • Each processing unit has an element of a sequence. • Using Compare&Exchange operations recursively sort lower and upper subcubes of dimension k − 1 - one nondecreasing, the other - nonincreas- ing. • Merge obtained two sorted subsequence (that is, a bitonic sequence) us- ing Compare&Exchange operations. Faculty of Mathematics and Computer Science 3
M. Jaros and M. Piotr´ ow Faster Merging Networks University of Wroclaw with Constant Periods Bitonicsort algorithm as a comparator networks P 0 P 1 P 2 P 3 P 4 P 5 P 6 P 7 Bitonicsort for 8 processors. Each arrow represents Compare&Exchange operation. Faculty of Mathematics and Computer Science 4
M. Jaros and M. Piotr´ ow Faster Merging Networks University of Wroclaw with Constant Periods Comparator networks R 1 (1,3) R 2 (1,4) (2,3) R 3 (2,4) R 4 W W 1 2 A graphical representation of N = ( { [ 1 , 3 ] , [ 2 , 4 ] } , { [ 1 , 4 ] , [ 2 , 3 ] } ) . • Tasks: sorting, merging, selection • Complexity measures: size = # comparators, depth = # stages Faculty of Mathematics and Computer Science 5
M. Jaros and M. Piotr´ ow Faster Merging Networks University of Wroclaw with Constant Periods Merging and sorting networks • Sorting networks: comparator networks that sort any sequence. • Merging networks: comparator networks that sort any sequence con- sisting of two sorted subsequence. • 0/1 Principle: A comparator network that sorts (merges) any 0/1 se- quence is a sorting (merging, respectively) network. • The most famous constructions: – Batcher ’68: (odd-even sort, bitonic sort) O ( log 2 n ) -depth, O ( n log 2 n ) - size. edi ’83: O ( log n ) -depth, O ( n log n ) -size. – Ajtai, Koml´ os & Szemer´ • Applications of sorting/merging networks: Designing of parallel algorithms, circuit switching and packet routing. Faculty of Mathematics and Computer Science 6
M. Jaros and M. Piotr´ ow Faster Merging Networks University of Wroclaw with Constant Periods Periodic comparator networks A A A A A Examples of periodic constructions • Odd-Even Transpositions: depth = O ( N ) , period = 2; • Balanced Network of Dowd, Saks and Rudolph (1989): depth = O ( log 2 N ) , period = O ( log N ) ; • Periodification Schema of Kutyłowski, Lory´ s, Oesterdiekhoff and Wanka (1994), depth: O ( log N ) × the depth of a non-periodic network, period: 5 (3); Problem: A logarithmic gap between the depth of non-periodic sorting networks and sorting networks with constant periods. Faculty of Mathematics and Computer Science 7
M. Jaros and M. Piotr´ ow Faster Merging Networks University of Wroclaw with Constant Periods Periodic merging networks - known results Proposition 1 Any comparator network algorithm of period 2 merging two sorted sequences of length n has runtime Ω ( n ) . Theorem 2 (Kutyłowski, Lory´ s and Oesterdiekhoff’1998) There is a pe- riodic comparator network of period 3 that merges two sorted sequences of n numbers in time 12log n. Theorem 3 (Kutyłowski, Lory´ s and Oesterdiekhoff’1998) There is a pe- riodic comparator network of period 4 that merges two sorted sequences of n numbers in time 9log 3 n = 5 . 67 · log n. Faculty of Mathematics and Computer Science 8
M. Jaros and M. Piotr´ ow Faster Merging Networks University of Wroclaw with Constant Periods Periodic merging networks - new results Theorem 4 There is a periodic comparator network of period 3 that merges two sorted sequences of n numbers in time 6log n. Theorem 5 There is a periodic comparator network of period 4 that merges two sorted sequences of n numbers in time 4log n. Remarks: • The construction can be easily generalized to larger constant periods with decreasing multiplicative factor. • The networks are in fact sorting networks. • The proofs are much shorter. Faculty of Mathematics and Computer Science 9
M. Jaros and M. Piotr´ ow Faster Merging Networks University of Wroclaw with Constant Periods Constant-delay networks Definition: Let A = S 1 , S 2 ,..., S d be a comparator network of N registers. Let fst ( j , A ) and lst ( j , A ) denote the first and the last stages where the con- tents of register j is compared. Then delay ( A ) = 0 ≤ j < N { lst ( j , A ) − fst ( j , A )+ 1 } , max 0 ,..., / / A ⇒ D 0 , = S 1 , S 2 ,..., S d . � �� � D -times i − 1 � A ( i ) A ⇒ j · delay ( A ) . = j = 0 Faculty of Mathematics and Computer Science 10
M. Jaros and M. Piotr´ ow Faster Merging Networks University of Wroclaw with Constant Periods Constant-depth networks versus constant-delay networks A B Definition: For any comparator network A = S 1 ,..., S d and D = delay ( A ) , q = � � � let us define B = S ′ 1 ,..., S ′ D , S ′ S q + pD : 0 ≤ p ≤ ( d − q ) / D to be a compact form of A . Faculty of Mathematics and Computer Science 11
M. Jaros and M. Piotr´ ow Faster Merging Networks University of Wroclaw with Constant Periods Constant-depth networks versus constant-delay networks Definition: We will say that T ⊆ R N is closed on standard comparators if ∀ x ∈ T ∀ i < j ( x [ i : j ] ∈ T ) . Lemma 6 Let T ⊆ R N be closed on standard comparators and let A = S 1 ,..., S d be a standard N-input comparator network such that A ( i ) sorts any sequence from T for some fixed value i > 0 . Let B = S ′ 1 ,..., S ′ D , D = delay ( A ) denote the compact form of A. Then B ′ = B ( i − 1 + ⌈ d / D ⌉ ) also sorts any se- quence from T. Faculty of Mathematics and Computer Science 12
M. Jaros and M. Piotr´ ow Faster Merging Networks University of Wroclaw with Constant Periods The merging network of Canfield-Williamson Canfield-Williamson’s network with 32 = 2 5 inputs. Faculty of Mathematics and Computer Science 13
M. Jaros and M. Piotr´ ow Faster Merging Networks University of Wroclaw with Constant Periods The basic component of our merging network with 92 inputs and delay 3. Faculty of Mathematics and Computer Science 14
M. Jaros and M. Piotr´ ow Faster Merging Networks University of Wroclaw with Constant Periods The packed version of our basic component with 92 inputs and period 3. Faculty of Mathematics and Computer Science 15
M. Jaros and M. Piotr´ ow Faster Merging Networks University of Wroclaw with Constant Periods Conclusions • Merging is a nontrivial examples of a problem, where non-periodic and constant-periodic networks that solve it have asymptotically equal run- ning times. • Using the duality between constant periodic and constant delay networks one can obtain much simpler constructions and proofs. • We conjecture that our networks sort any sequence of n items in O ( log 2 n ) time. Faculty of Mathematics and Computer Science 16
Recommend
More recommend