1 Sorting Networks
Sorting
3 Sorting Network (Bitonic Sorting Network)
4 Sorting Network (Bitonic Sorting Network)
5 Comparator x y max(x,y) min(x,y)
6 Comparator max min
7 Comparator max min
8
9 Levels 123 Depth = 3 Width = 4
Level 1
Level 2
Level 3
InputOutput
InputOutput
levels
17 Sort(n) Sort(n/2) Merge(n) In Out depth Recursive construction of Bitonic Sorting Network
18 Merge(n) Merge(n/2) depth Recursive construction of merging network
19 Induction Basis Sort(2) Merge(2)
20 Width Sorting network depth: Merger width Total depth
21 Counting Networks
22 The Counting Problem 0 Shared variable
23 0 Token = Increment request Shared variable
24 1 Increment request Shared variable 0
25 1 Shared variable
26 1 Increment request Shared variable
27 2 Shared variable 1 Increment request
28 2 Shared variable
29 2 Increment request Shared variable
30 3 Increment request Shared variable 2
31 6 Sequential Bottleneck Shared variable The requests have to be serialized
32 Counting Network Inputs Outputs
33 Counting Network
34 Balancer Inputs Outputs Token
35 Balancer Inputs Outputs
36 Balancer
37 Balancer
38 Balancer
39 Balancer
40 Balancer
41 Balancer
42 Balancer All tokens together
43 Balancer Step property
44 Balancer Step property Another example
45 Balancer Step property Another example
46 Balancer Step property Another example
47 Counting Network (Bitonic Counting Network)
48 Counting Network
49 Counting Network
50 Counting Network
51 Counting Network
52 Counting Network
53 Counting Network
54 Counting Network
55 Counting Network
56 Counting Network
57 Counting Network
58 Counting Network
59 Counting Network
60 Counting Network
61 Counting Network
62 Counting Network
63 Counting Network
64 Counting Network
65 Counting Network All tokens
66 Counting Network All tokensStep property
67 Counting Network Another example Step property
68 Counting Network Another example Step property
69 Counting Network Another example Step property
70 Counting Network Another example Step property
71 Counting Network Parallelism Many increment requests are processed simultaneously
72 Counting Token = Increment request Output Shared variables
73 Counting Output Shared variables
74 Counting Returned value Shared variable value is increased by 4 (output width)
75 Counting Increment request
76 Counting
77 Counting Returned value
78 Counting Increment request
79 Counting Returned value
80 Counting
81 Counting Returned value
82 Counting
83 Counting Returned value
84 Counting
85 Counting Returned value
86 Counting All tokens
87 Bitonic Counting Network Isomorphic to Bitonic Sorting Network
88 Count(n) Count(n/2) Merge(n) In Out depth
89 Merge(n) Merge1(n/2) Merge2(n/2) depth Step Prop. Step Prop. Step Prop.
90 Even subsequence Odd subsequence
91 Merge(n) Merge1(n/2) Merge2(n/2)
92 Theorem: Proof: The proof is by induction on For the merger is a balancer and the claim holds trivially. Induction Basis: The merger(n) produces output Z with step property if both inputs X and Y have step property
93 Induction Hypothesis: Merge(n/2) If step sequence Then step sequence Assume that every merger of size n/2 and smaller performs merging properly
94 Merge(n) Induction step: If step Then step We want to show that: Suppose and have the step property. Then we show that has the step property
95 If has the step property then and have the step property Tokens
96 Merge1(n/2) Merge2(n/2) step Therefore, from induction hypothesis: Output sequence
97 First, we show: Where denotes the total number of tokens in sequence
98 We have: Merger 1 Merger 2
99 or Since has the step property: Therefore: Similarly:
100
101 Now, we show that has the step property There is at most one wire where the two sequences differ #tokens step
102 Step property Merge1(n/2) Merge(n/2) Merge(n)