I have a set of integer values and I want to sort them using Thrust. Is there a possiblity for using only some high bits/low bits in this sorting. If possible I do not want to use user defined comparator, because it changes the used algorithm from radix-sort to merge-sort and increases elapsed time quite much.
I think when all the numbers have the same value on a bit, the bit is skipped while sorting, so is it feasible to use the lowest possible bit number and hope it will be sufficient. (ie: for 5 bits using char with 8 bits and setting upper 3 bits to 0)
Example:
sort<4, 0>(myvector.begin(), myvector.end())
sort<4, 1>(myvector.begin(), myvector.end())
sort using only 4 bits, high or low..
Something similar to http://www.moderngpu.com/sort/mgpusort.html
Thrust's interface abstracts away algorithm implementation details such as the fact that one of the current sorting strategies is a radix sort. Due to the possibility that the underlying sort implementation could change from version to version, backend to backend, or even invocation to invocation, there is no way for the user to communicate the number of bits to sort.
Fortunately, such explicit information generally isn't necessary. When appropriate, Thrust's current sorting implementation will inspect the sorting keys and omit superfluous computation amidst zeroed bits.