Skip to content
Snippets Groups Projects
Commit 3bbe6610 authored by Dinda Yora Islami's avatar Dinda Yora Islami
Browse files

add radix

parent eccf813f
Branches
Tags
No related merge requests found
......@@ -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++)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment