cudpp

CUDA Stream compaction: understanding the concept

徘徊边缘 提交于 2019-12-30 19:27:47
问题 I am using CUDA/Thrust/CUDPP. As I understand, in Stream compaction, certain items in an array are marked as invalid and then "removed". Now what does "removal" really mean here? Suppose the original array A and has length 6. If 2 elements are invalid (by whatever condition we may provide) then Does the system create a new array of size 4 in GPU-memory to store the valid elements to get the final result? OR does it physically remove the invalid elements from memory and shrink the original

Sorting objects with Thrust CUDA

巧了我就是萌 提交于 2019-12-09 17:33:02
问题 Is it possible to sort objects using the Thrust library? I have the following struct: struct OB{ int N; Cls *C; //CLS is another struct. } Is it possible to use thrust in order to sort an array of OB according to N? Can you provide a simple example on using thrust to sort objects? If thrust is not able to do so, is there any other CUDA libraries that allows me to do so? 回答1: The docs for thrust::sort show it accepts a comparison operator. See in their example how those are defined and used. I

Segmented Sort with CUDPP/Thrust

拈花ヽ惹草 提交于 2019-12-06 13:51:55
问题 Is it possible to do segmented sort in with CUDPP in CUDA? By segmented sort, I mean to sort elements of array which are protected by flags like below. A[10,9,8,7,6,5,4,3,2,1] Flag array[1,0,1,0,0,1,0,0,0,0] Sort elements of A which are between consecutive 1. Expected output [9,10,6,7,8,1,2,3,4,5] 回答1: you can do this in a single sorting pass: the idea is to adjust the elements in your array such that sort will relocate elements only within the "segments" for your example: A[10,9,8,7,6,5,4,3

Sorting objects with Thrust CUDA

依然范特西╮ 提交于 2019-12-04 04:45:36
Is it possible to sort objects using the Thrust library? I have the following struct: struct OB{ int N; Cls *C; //CLS is another struct. } Is it possible to use thrust in order to sort an array of OB according to N? Can you provide a simple example on using thrust to sort objects? If thrust is not able to do so, is there any other CUDA libraries that allows me to do so? The docs for thrust::sort show it accepts a comparison operator. See in their example how those are defined and used. I haven't tested this, but based on the example, all you would need is a struct that looks something like