Faster Merging Networks with Constant Periods Marek Piotr ow (a - - PowerPoint PPT Presentation

faster merging networks with constant periods
SMART_READER_LITE
LIVE PREVIEW

Faster Merging Networks with Constant Periods Marek Piotr ow (a - - PowerPoint PPT Presentation

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


slide-1
SLIDE 1

Faster Merging Networks with Constant Periods

  • M. Jaros and M. Piotr´
  • w

University of Wroclaw

Faster Merging Networks with Constant Periods

Marek Piotr´

  • w

(a join work with Michał Jaros) JAF25 — CMFBD 2006

Faculty of Mathematics and Computer Science 1

slide-2
SLIDE 2

Faster Merging Networks with Constant Periods

  • M. Jaros and M. Piotr´
  • w

University of Wroclaw

The talk outline

  • Bitonic parallel sorting through merging
  • Comparator networks
  • Some results
  • Key proof techniques
  • Conclusions

Faculty of Mathematics and Computer Science 2

slide-3
SLIDE 3

Faster Merging Networks with Constant Periods

  • M. Jaros and M. Piotr´
  • w

University of Wroclaw

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

slide-4
SLIDE 4

Faster Merging Networks with Constant Periods

  • M. Jaros and M. Piotr´
  • w

University of Wroclaw

Bitonicsort algorithm as a comparator networks

P P P

2

P

3

P

4

P

5

P

6

P

7 1

Bitonicsort for 8 processors. Each arrow represents Compare&Exchange

  • peration.

Faculty of Mathematics and Computer Science 4

slide-5
SLIDE 5

Faster Merging Networks with Constant Periods

  • M. Jaros and M. Piotr´
  • w

University of Wroclaw

Comparator networks

1

R R R R

2 3 4

(2,3) W W

2 1

(2,4) (1,3) (1,4) 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

slide-6
SLIDE 6

Faster Merging Networks with Constant Periods

  • M. Jaros and M. Piotr´
  • w

University of Wroclaw

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(log2 n)-depth, O(nlog2 n)- size. – Ajtai, Koml´

  • s & Szemer´

edi ’83: O(logn)-depth, O(nlogn)-size.

  • Applications of sorting/merging networks:

Designing of parallel algorithms, circuit switching and packet routing.

Faculty of Mathematics and Computer Science 6

slide-7
SLIDE 7

Faster Merging Networks with Constant Periods

  • M. Jaros and M. Piotr´
  • w

University of Wroclaw

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(log2 N), period = O(logN);

  • Periodification Schema of Kutyłowski, Lory´

s, Oesterdiekhoff and Wanka (1994), depth: O(logN)×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

slide-8
SLIDE 8

Faster Merging Networks with Constant Periods

  • M. Jaros and M. Piotr´
  • w

University of Wroclaw

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 12logn. 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 9log3 n = 5.67·logn.

Faculty of Mathematics and Computer Science 8

slide-9
SLIDE 9

Faster Merging Networks with Constant Periods

  • M. Jaros and M. Piotr´
  • w

University of Wroclaw

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 6logn. Theorem 5 There is a periodic comparator network of period 4 that merges two sorted sequences of n numbers in time 4logn. 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

slide-10
SLIDE 10

Faster Merging Networks with Constant Periods

  • M. Jaros and M. Piotr´
  • w

University of Wroclaw

Constant-delay networks

Definition: Let A = S1,S2,...,Sd 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) = max

0≤j<N {lst(j,A)−fst(j,A)+1},

A⇒D = / 0,..., / 0,

D-times

S1,S2,...,Sd. A(i) =

i−1

  • j=0

A⇒ j·delay(A).

Faculty of Mathematics and Computer Science 10

slide-11
SLIDE 11

Faster Merging Networks with Constant Periods

  • M. Jaros and M. Piotr´
  • w

University of Wroclaw

Constant-depth networks versus constant-delay networks

A B

Definition: For any comparator network A = S1,...,Sd and D = delay(A), let us define B = S′

1,...,S′ D, S′ q =

Sq+pD : 0 ≤ p ≤ (d −q)/D

  • to be a

compact form of A.

Faculty of Mathematics and Computer Science 11

slide-12
SLIDE 12

Faster Merging Networks with Constant Periods

  • M. Jaros and M. Piotr´
  • w

University of Wroclaw

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 = S1,...,Sd 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

slide-13
SLIDE 13

Faster Merging Networks with Constant Periods

  • M. Jaros and M. Piotr´
  • w

University of Wroclaw

The merging network of Canfield-Williamson

Canfield-Williamson’s network with 32 = 25 inputs.

Faculty of Mathematics and Computer Science 13

slide-14
SLIDE 14

Faster Merging Networks with Constant Periods

  • M. Jaros and M. Piotr´
  • w

University of Wroclaw

The basic component of our merging network with 92 inputs and delay 3.

Faculty of Mathematics and Computer Science 14

slide-15
SLIDE 15

Faster Merging Networks with Constant Periods

  • M. Jaros and M. Piotr´
  • w

University of Wroclaw

The packed version of our basic component with 92 inputs and period 3.

Faculty of Mathematics and Computer Science 15

slide-16
SLIDE 16

Faster Merging Networks with Constant Periods

  • M. Jaros and M. Piotr´
  • w

University of Wroclaw

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
  • ne can obtain much simpler constructions and proofs.
  • We conjecture that our networks sort any sequence of n items in O(log2 n)

time.

Faculty of Mathematics and Computer Science 16