-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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!
andsortperm
using 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.