1/16 CALCULATING PREFIX SUMS Vladimir Jocovi ć 2012/0011
2/16 WHAT ARE ALL-PREFIX SUMS? The all-prefix-sums operation takes: The all-prefix-sums operation takes: a binary associative operator ⊕ a binary associative operator ⊕ an ordered set of n elements [a0, a1,..., an − 1] an ordered set of n elements [a0, a1,..., an − 1] And returns the ordered set And returns the ordered set [a0, (a0 ⊕ a1),..., (a0 ⊕ a1 ⊕... ⊕ an − 1)] [a0, (a0 ⊕ a1),..., (a0 ⊕ a1 ⊕... ⊕ an − 1)] Inclusive type Inclusive type
3/16 WHAT ARE ALL-PREFIX SUMS? Example: Example: Operation ⊕ is addition Operation ⊕ is addition Input array - [3, 1, 7, 0, 4, 1, 6, 3] Input array - [3, 1, 7, 0, 4, 1, 6, 3] Would return: Would return: Output array - [3, 4, 11, 11, 15, 16, 22, 25] Output array - [3, 4, 11, 11, 15, 16, 22, 25]
4/16 WHERE ARE ALL-PREFIX SUMS USED? To lexically compare strings of characters To lexically compare strings of characters To evaluate polynomials To evaluate polynomials Sorting algorithms (radix sort, quicksort) Sorting algorithms (radix sort, quicksort)
5/16 HOW DOES THE HARDWARE LOOK LIKE? Graph representing PrefixSumKernel Io.input(“x”, type, …Io.output(“z”, type, … result = x + (cnt < loopVal?0:sum); Storing partial sum
6/16 HOW DOES THE HARDWARE LOOK LIKE? Graph representing PrefixSumKernel at its final step
7/16 HOW DOES THE HARDWARE LOOK LIKE? Manager graph
8/16 ALGORITHM
9/16 ALGORITHM
10/16 ALGORITHM
11/16 ALGORITHM
12/16 KERNEL CODE
13/16 BUILD AND RUN
14/16 CONCLUSION Poor maxeler results? Poor maxeler results? Just a simulation, not a real hardware Just a simulation, not a real hardware
15/16 REFERENCES - Delft University of Technology, Netherlands - Delft University of Technology, Netherlands Carnegie Mellon University, USA - Carnegie Mellon University, USA Oxford e-Research Centre - Oxford e-Research Centre Wikipedia - Wikipedia
16/16 QUESTIONS AND ANSWERS