Search code examples
cudathrust

sorting in cuda Thrust


I am trying to use radix sort in the cuda. During research I found that thrust has the sorting feature in it.

which sorting algorithm does thrust library use for sorting?? 
Is it  Radix Sort???

Solution

  • You can find some details here:

    http://sbel.wisc.edu/Courses/ME964/Literature/thrustGPUgems2011.pdf http://www.greatlakesconsortium.org/events/manycore/files/TStaff-CUDA_Libraries.pdf

    From the second link:

    thrust::sort will select right algorithm

    • radix sort for built-in types(int, float, etc.)
    • merge sort where radix sort cannot be used

    For an even deeper understanding of the thrust implementation of the sort function you should read this technical paper: http://back40computing.googlecode.com/svn-history/r272/wiki/documents/RadixSortTR.pdf