Sorting 2 or 3 arrays by key with CUDA Thrust

We have compared two approaches to sort arrays by key, with the same key. One of those approaches uses thrust::zip_iterator and the other thrust::gather. We have tested them in the case of sorting two arrays or three arrays. In all the two cases, the approach using thrust::gather has shown to be faster. The full codes are available on our GitHub website: 2 Arrays solution 3 Arrays solution In the following, some timing results (NVIDIA GTX 960 card): Timing in the case of 2 arrays for...
More

Sorting by key with tuple key and customized comparison operator

Sorting an array by key is possible once an ordering is defined for the tuple key. Defining an ordering is possible with CUDA Thrust by an overload of the “<” comparison operator. Accordingly, sorting tuples with CUDA Thrust can be performed by a combination of thrust::sort_by_key, zip iterators and tuples. Our GitHub web page contains an example on how this can be simply accomplished.
More

Sorting tuples with CUDA Thrust

Sorting tuples is possible once an ordering is defined for the tuples. Defining an ordering is possible with CUDA Thrust by an overload of the “<” comparison operator. Accordingly, sorting tuples with CUDA Thrust can be performed by a combination of thrust::sort, zip iterators and tuples. Our GitHub web page contains an example on how this can be simply accomplished.
More

Sorting many small “packed” arrays by key in CUDA

On problem of interest, is that of extending the approach in "Sorting many small arrays by key in CUDA" to the case when multiple arrays must be ordered according to the same key. Unfortunately, it is not possible to use cub::BlockRadixSort by "packing" the arrays using zip iterators and tuples. Accordingly, we have exploited an helper index approach. On our GitHub website a fully worked example is reported.
More

Sorting many small arrays in CUDA

In many applications, the problem of sorting many small arrays in CUDA arises. CUB offers a possible solution to face this problem. On our Git Hub website, we report an example that can be reused for this purpose. The idea is assigning the small arrays to be sorted to different thread blocks and then using cub::BlockRadixSort to sort each array. Two versions are provided, one loading and one loading the small arrays into shared memory.
More