From ee1baacd898e84ea1532d5ca25d43566eb10c259 Mon Sep 17 00:00:00 2001 From: Yora <13516067@std.stei.itb.ac.id> Date: Thu, 11 Apr 2019 19:58:27 +0700 Subject: [PATCH] add radix --- src/radix_sort_par3.cu | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/radix_sort_par3.cu b/src/radix_sort_par3.cu index 3669e6d..942a286 100644 --- a/src/radix_sort_par3.cu +++ b/src/radix_sort_par3.cu @@ -15,7 +15,7 @@ int getMax(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 ]++; } @@ -117,8 +117,7 @@ int main(int argc, char *argv[]) clock_gettime(CLOCK_REALTIME, &start); - radixsort<<<1,32>>>(d_arr,n); - cudaMemcpy(arr, d_arr, sizeof(int)*n,cudaMemcpyDeviceToHost); + radixsort(arr,n); clock_gettime(CLOCK_REALTIME, &stop); print(arr,n); @@ -127,7 +126,6 @@ int main(int argc, char *argv[]) printf("\n%d.%09d s\n", duration.tv_sec, duration.tv_nsec); //deallocate host memory - cudaFree(d_arr); return 0; } -- GitLab