diff --git a/src/radix_sort_par3.cu b/src/radix_sort_par3.cu index 9454d10c761dca51d92359c6321e1800dd51ff00..d23ea5810bb2e17e8d4a3a02fc8d94a344020b9a 100644 --- a/src/radix_sort_par3.cu +++ b/src/radix_sort_par3.cu @@ -26,15 +26,17 @@ void countSort(int arr[], int n, int exp) int *d_arr; int *output= (int*)malloc(sizeof(int)*n); // output array - int i, count[10] = {0}; + int i; + int d_count[10] = {0}; + int h_count[10] = {0}; cudaMalloc((void**)&d_arr,sizeof(int)*n); //cudaMalloc((void**)&count,sizeof(int)*10); cudaMemcpy(d_arr, arr, sizeof(int)*n,cudaMemcpyHostToDevice); - //cudaMemset(count,0,sizeof(int)*10); + //cudaMemset(d_count,0,sizeof(int)*10); // Store count of occurrences in count[] - storeCount<<<1,32>>>(count,d_arr,n,exp); - + storeCount<<<1,32>>>(d_count,d_arr,n,exp); + cudaMemcpy(h_count, d_count, sizeof(int)*10,cudaMemcpyDeviceToHost); // Change count[i] so that count[i] now contains actual // position of this digit in output[] for (i = 1; i < 10; i++)