Add bitonic sort implementation#1217
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1217 +/- ##
==========================================
- Coverage 80.09% 79.34% -0.76%
==========================================
Files 119 119
Lines 8407 8594 +187
==========================================
+ Hits 6734 6819 +85
- Misses 1673 1775 +102
Continue to review full report at Codecov.
|
maleadt
left a comment
There was a problem hiding this comment.
Looks great! Good to have an implementation that doesn't rely on dynamic parallelism, which doesn't always perform well.
It'll take a while before I can review properly, but I added some quick thoughts already.
I believe it's faster for many scenarios than the existing quicksort, so maybe sort!{::AnyCuVector} should also use it. The complexity is worse though: for large enough arrays quicksort will outperform this, but that seems to be around lengths of ~16 million.
Maybe select the best algorithm at run time then? With possible customizability using an alg::Algorithm keyword like Base.
|
Thanks for preliminary feedback @maleadt
|
|
1c9f627 to
991f3ae
Compare
991f3ae to
de44670
Compare
|
Totally forgot about this, sorry! I've squashed and rebased the commits, and did some minor NFC changes (e.g. rename |
|
Cool thanks! I just started a new job so this was off my radar too :) |
Implementation of
sortperm!andsortpermusing a bitonic sorter. The underlying bitonic sorter is general enough for any length array, and can do simple sorting as well as sortperm.I believe it's faster for many scenarios than the existing quicksort, so maybe
sort!{::AnyCuVector}should also use it. The complexity is worse though: for large enough arrays quicksort will outperform this, but that seems to be around lengths of ~16 million. Lengths like 2^n+1 perform similarly to 2^(n+1), hence the jagged performance curve. This data is from rtx 2070.