Algorithm Engineering
(aka. How to Write Fast Code)
I/O Algorithms and Parallel Samplesort
CS26 S260 β Lecture cture 6 Yan n Gu
Algorithm Engineering (aka. How to Write Fast Code) CS26 S260 - - PowerPoint PPT Presentation
Algorithm Engineering (aka. How to Write Fast Code) CS26 S260 Lecture cture 6 Yan n Gu I/O Algorithms and Parallel Samplesort Review of Samplesort CS260: Algorithm Semisort Engineering Lecture 6 Course Policy 2 Sample-sort
CS26 S260 β Lecture cture 6 Yan n Gu
2
Analo logou gous s to mult ltiw iway ay quic ickso ksort 1.
Spli lit in input ut array in into π contiguo iguous us suba barra rrays ys of siz ize π. So Sort subar arrays rays recursi sivel vely
β¦ π, sorted π
π, sorted β¦
Analo logou gous s to mult ltiw iway ay quic ickso ksort 1.
Spli lit in input ut array in into π contiguo iguous us suba barra rrays ys of siz ize π. So Sort subar arrays rays recursi sivel vely y (sequ equent entia ially lly)
π, sorted β¦ Bucket 1 Bucket 2 Bucket π β€ π1 β€ β€ π2 β€ β― β€ π πβ1 β€
Size β π
Bucket 1 Bucket 2 Bucket π β€ π1 β€ β€ π2 β€ β― β€ π πβ1 β€ sorted
7
key 45 12 45 61 28 61 61 45 28 45 Value 2 5 3 9 5 9 8 1 7 5
key 12 61 61 61 45 45 45 45 28 28 Value 5 8 9 9 2 5 1 3 7 5
key 45 45 45 45 12 61 61 61 28 28 Value 2 5 1 3 5 8 9 9 7 5
key 45 45 45 45 12 61 61 61 28 28 Value 1 5 3 2 5 8 9 9 7 5
Parallel In-Place Algorithms: Theory and Practice Julienne: A Framework for Parallel Graph Algorithms using Work- efficient Bucketing Semi-Asymmetric Parallel Graph Algorithms for NVRAMs Efficient BVH Construction via Approximate Agglomerative Clustering Theoretically-Efficient and Practical Parallel DBSCAN
12
13
KV-pairs with a certain key
number of KV-pairs with a certain key
14
keys 37 β¦ 58 β¦ 92 β¦
12 9 52
92 56
11 19 8
key value
Linked lists of values
56
12 9 52
92 56
11 19 8 44 31
56
keys 37 β¦ 58 β¦ 92 β¦ key value
Arrays
values
ο’ Problem ο Need to pre-count the number of each key
Edge list Sorted edge list (3,5) (3,5) (1,7) (3,7) (2,3) (3,6) (3,6) (5,4) (5,4) (1,6) (3,7) (1,7) (1,6) (2,3) 1 2 3 4 5 6 7
key 45 45 45 45 12 61 61 61 28 28 Value 1 5 3 2 5 8 9 9 7 5
key 45 45 45 45 12 61 61 61 28 28 Value 1 5 3 2 5 8 9 9 7 5
key 45 45 45 45 12 61 61 61 28 28 Value 1 5 3 2 5 8 9 9 7 5
22
as heavy keys, others are light keys
light keys each corresponds to a range of ππ/π
5 5 5 8 8 8 8 8 17 17 β¦β¦ 11 17
S
Sampling (Counting) Sorting
5 5 5 8 8 8 8 8 17 17 β¦β¦ 11 17
Counting & Filtering
keys 8 20 65 β¦ Range 0-15 16-31 keys 5 11 17 21 26 31 ... Heavy keys Light keys
Sorted samples:
Analogous to multiway quicksort
subarrays of size π
β¦ π π
β¦
Analogous to multiway quicksort
subarrays of size π’. Sort subarrays recursively (sequentially)
Size β π’
β¦ Bucket 1 Bucket 2 Bucket π β€ π1 β€ β€ π2 β€ β― β€ π πβ1 β€ β¦
Bucket 1 Bucket 2 Bucket π β¦ sorted
[π, π, π, π, π, π, π, π, π, π, π, π, π, π, π, π]
[π, π, π, π, π, π, π, π, π, π, π, π, π, π, π, π]
[π, π, π, π, π, π, π, π, π, π, π, π, π, π, π, π] [π, π, π, π, π, π, π, π, π, ππ, ππ, ππ, ππ, ππ, ππ, ππ]
[β , β , β , β , β , β , β , β , β , β , β , β , β , β , β , β ]
32
[π, β , β , β , β , π, β , β , β , π, β , β , π, β , β , β ] [π, π, π, β , β , π, β , β , β , π, π, π, π, β , β , β ]
[π, π, π, π, π, π, π, π, π, π, π, π, π, π, π, π]
[π, π, π, π, π, π, π, π, π, π, π, π, π, π, π, π]
[π, π, π, π, π, π, π, π, π, π, π, π, π, π, π, π] [π, π, π, π, π, π, π, π, π, ππ, ππ, ππ, ππ, ππ, ππ, ππ]
[β , β , β , β , β , β , β , β , β , β , β , β , β , β , β , β ]
33
[π, β , β , β , β , π, β , β , β , π, β , β , π, β , β , β ] [π, π, π, β , β , π, β , β , β , π, π, π, π, β , β , β ]
talked about a simpler version that does not have either bound
light buckets are small (contains π π/π’ elements, analysis in [GSSB15])
34
35
36
studen dents ts have e reserved ved the paper ers s for reading ing and pre resentin enting
er 8 i is no not reserved, rved, Yunshu shu wil ill l present ent it it o
dlines, ines, in instruc uction tions s and schedu edule les s are on course e webpag age e and and il ilearn
37
38
ice e talk lks to y your fri riends nds and/ d/or r cl classmates smates before re your r pre resent sentat ation, ion, in in ord rder r to gu guarante ntee e that everything ything you say y makes s sense nse and is is unde derst rstand andab able le.
do it since itβs embarrassing.
done ne sli lides es to Ya Yan 48h ahead, ad, as well ll as the co corr rrespo ponding nding paper er re reading. ing.
39
40
iz is is on 4/ 4/24. I wil ill s l send nd each of you a go googl gle doc, and you shoul uld d answer wer in in it it.
doc keeps track of all your edits (so please donβt cheat).
is op
book, k, but you shoul uld d stil ill l revie iew w the le lectures es sin ince e the le lengt gth h is is fo for 1 h hour and d you mig ight t not have e tim ime to s search ch for each proble lem. m.
41
42
il 29, so so you stil ill l have e more than 2 w weeks. s.
have e at th that tim ime
uld d start now, , and meanwh nwhile ile, , You shoul uld d expe pect ct at le least t two d days ys in in w writ itin ing g the report
43
proposa posal l meeting: ing: 5/1
sal: : 5/4
ly progr gress ss report 1: 5/ 5/13
ilest stone
: 5/22
ly progr gress ss report 2: 5/ 5/29
inal l project t presenta entation ion: : 6/1-5
inal l re report rt due: : 6/ 6/8
44
sal: : 10%
ly progr gress ss report 1: 5% 5%
ilest stone
: 10%
Weekly ly pro rogr gress ss re report rt 2: 2: 5% 5%
inal l project t presenta entation ion: : 20%
inal l report: : 50%
45
ilest stone
: 5-min inute ute talk lk for each studen dent, , dis iscuss uss the pro rogr gress ss and if if you meet the go goals ls in in th the pro roposal sal
inal l project t presenta entation ion: : 20+5(Q&A &A) ) min inutes utes for each student, dent, talk lk about t your r work rk lik like the paper er pre resentat entation ion
46