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

add radix

parent efa937eb
Branches
No related merge requests found
...@@ -15,7 +15,7 @@ int getMax(int arr[], int n) ...@@ -15,7 +15,7 @@ int getMax(int arr[], int n)
} }
__global__ void storeCount(int *count, int *arr, int n){ __global__ void storeCount(int *count, int *arr, int n){
for (i = 0; i < n; i++) for (int i = 0; i < n; i++)
count[ (arr[i]/exp)%10 ]++; count[ (arr[i]/exp)%10 ]++;
} }
...@@ -117,8 +117,7 @@ int main(int argc, char *argv[]) ...@@ -117,8 +117,7 @@ int main(int argc, char *argv[])
clock_gettime(CLOCK_REALTIME, &start); clock_gettime(CLOCK_REALTIME, &start);
radixsort<<<1,32>>>(d_arr,n); radixsort(arr,n);
cudaMemcpy(arr, d_arr, sizeof(int)*n,cudaMemcpyDeviceToHost);
clock_gettime(CLOCK_REALTIME, &stop); clock_gettime(CLOCK_REALTIME, &stop);
print(arr,n); print(arr,n);
...@@ -127,7 +126,6 @@ int main(int argc, char *argv[]) ...@@ -127,7 +126,6 @@ int main(int argc, char *argv[])
printf("\n%d.%09d s\n", duration.tv_sec, duration.tv_nsec); printf("\n%d.%09d s\n", duration.tv_sec, duration.tv_nsec);
//deallocate host memory //deallocate host memory
cudaFree(d_arr);
return 0; return 0;
} }
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