Skip to content

Commit 62b6311

Browse files
committed
Updated readme and order
1 parent afce0d2 commit 62b6311

File tree

2 files changed

+26
-25
lines changed

2 files changed

+26
-25
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ function compute_minima(points)
272272
(a, b) -> (min(a[1], b[1]), min(a[2], b[2])), # Keep each coordinate's minimum
273273
points,
274274
init=(typemax(Float32), typemax(Float32)),
275+
neutral=(typemax(Float32), typemax(Float32)),
275276
)
276277
end
277278

src/sort/cpu_sample_sort.jl

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,31 @@ function _sample_sort_histogram!(
1313
end
1414

1515

16+
function _sample_sort_compute_offsets!(histograms, max_tasks)
17+
@inbounds begin
18+
# Sum up histograms and compute global offsets for each task
19+
offsets = @view histograms[1:max_tasks, max_tasks + 1]
20+
for itask in 1:max_tasks
21+
for j in 1:max_tasks
22+
offsets[j] += histograms[j, itask]
23+
end
24+
end
25+
accumulate!(+, offsets, init=0, inclusive=false)
26+
27+
# Compute each task's local offset into each bucket
28+
for itask in 1:max_tasks
29+
accumulate!(
30+
+, @view(histograms[itask, 1:max_tasks]),
31+
init=0,
32+
inclusive=false,
33+
)
34+
end
35+
end
36+
37+
offsets
38+
end
39+
40+
1641
function _sample_sort_move_buckets!(
1742
v, dest, ord,
1843
splitters, global_offsets, task_offsets,
@@ -41,31 +66,6 @@ function _sample_sort_move_buckets!(
4166
end
4267

4368

44-
function _sample_sort_compute_offsets!(histograms, max_tasks)
45-
@inbounds begin
46-
# Sum up histograms and compute global offsets for each task
47-
offsets = @view histograms[1:max_tasks, max_tasks + 1]
48-
for itask in 1:max_tasks
49-
for j in 1:max_tasks
50-
offsets[j] += histograms[j, itask]
51-
end
52-
end
53-
accumulate!(+, offsets, init=0, inclusive=false)
54-
55-
# Compute each task's local offset into each bucket
56-
for itask in 1:max_tasks
57-
accumulate!(
58-
+, @view(histograms[itask, 1:max_tasks]),
59-
init=0,
60-
inclusive=false,
61-
)
62-
end
63-
end
64-
65-
offsets
66-
end
67-
68-
6969
function _sample_sort_sort_bucket!(
7070
v, dest, offsets, itask, max_tasks;
7171
lt, by, rev, order

0 commit comments

Comments
 (0)