Starting from:

$25

SWE3021- Project #4: Counting Sort using CUDA Solved

1           Counting Sort
In this assignment, you will implement a parallel counting sort algorithm in CUDA. Counting sort is a non-comparative sorting algorithm, which can be easily implemented in C function as follows.

void counting_sort(int arr[], int size, int MAX)

{ int histogram[MAX];

for (i=0; i<MAX; i++){ histogram[i] = 0;

}

for (i=0; i<size; i++){ histogram[arr[i]]++;

}

for (i=0;i<MAX;i++){ for (j=0;j<histogram[i];j++){ cout << i << " ";

}

}

}

Skeleton codes are located in /home/swe3021/project4. Note that you need to implement all CUDA functions in counting_sort.cu file since it is the only file that you will submit. Driver files will be changed to measure the performance of your code with different inputs. You are free to change the driver code for testing purpose.

yourid@titan1:~$ cp -r ~swe3021/project4 .

yourid@titan1:~$ cd project4 yourid@titan1:~/project4$ ls counting_sort.cu driver1.cpp Makefile

In order to compile, simply run make command as follows. yourid@titan1$ make

More products