What is a good sorting algorithm on CUDA?

后端 未结 4 856
南笙
南笙 2021-02-04 13:09

I have an array of struct and I need to sort this array according to a property of the struct (N). The object looks like this:

 struct OBJ
 { 
   int N; //sort a         


        
4条回答
  •  囚心锁ツ
    2021-02-04 13:32

    Use the sorting calls available in the CUDPP or the Thrust library.

    If you use cudppSort, note that it only works with integers or floats. To sort your array of structures, you can first sort the keys along with an index array. Later, you can use the sorted index array to move the structures to their final sorted location. I have described how to do this for the cudppCompact compaction algorithm in a blog post here. The steps are similar for sorting an array of structs using cudppSort.

提交回复
热议问题