From af067baefd4e4e3775f7939dd218fa764e0312b3 Mon Sep 17 00:00:00 2001
From: yora <13516067@std.stei.itb.ac.id>
Date: Thu, 11 Apr 2019 12:01:04 +0000
Subject: [PATCH] edit radix

---
 src/radix_sort_par.cu | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/radix_sort_par.cu b/src/radix_sort_par.cu
index ecc6b18..a4613c2 100644
--- a/src/radix_sort_par.cu
+++ b/src/radix_sort_par.cu
@@ -18,14 +18,14 @@ __device__ int getMax(int arr[], int n)
 // the digit represented by exp. 
 __device__ void countSort(int arr[], int n, int exp) 
 { 
-	int index = threadIdx.x;
-    int stride = blockDim.x;
+//	int index = threadIdx.x;
+//    int stride = blockDim.x;
 
     int *output= (int*)malloc(sizeof(int)*n); // output array 
     int i, count[10] = {0}; 
   
     // Store count of occurrences in count[] 
-    for (i = index; i < n; i+=stride) 
+    for (i = 0; i < n; i++) 
         count[ (arr[i]/exp)%10 ]++; 
   
     // Change count[i] so that count[i] now contains actual 
@@ -34,7 +34,7 @@ __device__ void countSort(int arr[], int n, int exp)
         count[i] += count[i - 1]; 
   
     // Build the output array 
-    for (i = n - 1; i >= index; i-=stride) 
+    for (i = n - 1; i >= 0; i--) 
     { 
         output[count[ (arr[i]/exp)%10 ] - 1] = arr[i]; 
         count[ (arr[i]/exp)%10 ]--; 
@@ -42,7 +42,7 @@ __device__ void countSort(int arr[], int n, int exp)
   
     // Copy the output array to arr[], so that arr[] now 
     // contains sorted numbers according to current digit 
-    for (i = index; i < n; i+=stride) 
+    for (i = 0; i < n; i++) 
         arr[i] = output[i]; 
 } 
   
-- 
GitLab