Reputation: 11
I need to solve the sort problem with using (Quick Sort) ,so my problem is when i try to run the code many error appear to me but the major error is when i recall the Kernel QuickSort , because the kernel call itself twice ,so how can i solve this problem ,below my code ,so any one can help me .
Note: Iam new in programing in cuda .
__global__ void QuickSort(int p, int r,char *c)
{
if (p < r)
{ int q = Partition(p, r, c);
QuickSort<<<5,5>>>(p, q-1,c);
QuickSort<<<5,5>>>(q+1, r,c);
}
}
Upvotes: 0
Views: 2867
Reputation: 482
Your GPU card (compute capability 3.0) do not support Dynamic Parallelism, which needs compute capability 3.5 or higher. Dynamic Parallelism is to support the recursive method with new allocated resource in GPU. A Quicksort algorithm with cuda implementation and informantion of Dynamic Parallelism are showed here http://blogs.nvidia.com/2012/09/how-tesla-k20-speeds-up-quicksort-a-familiar-comp-sci-code/ .
However, in your GPU, I suggest to employ a different way to implement the Quicksort, as the implementation in the link above is just to demonstrate the benefits of Dynamic Parallelism instead of showing a algorithm with peak performance. Your can refer to this paper "GPU-Quicksort A Practical Quicksort Algorithm for Graphics Processors" for a better performance with your card.
Upvotes: 1