This repository contains several pieces of code. As per usual the source code will be contained in src
directory, and all of the supporting libraries will be present in the include
directory.
This coursework prompts us to chose 3 sorting algorithms and parallelise them utilising the following:
- Threads;
- CUDA;
- A heterogenous approach, where the one of the CPU threads manages the GPU, while the other threads do computations as well.
Merge sort is is an efficient, general-purpose, and comparison-based sorting algorithm. Following the divide-and-conquer principle, it has a complexity of , same as Quick Sort.
To run the concurrent version, use the command: g++ src/merge_sort.cpp && ./a.out
To run the CUDA threaded version, move the src/cuda_merge_sort.cu
file to Visual Studio, and run it.
Quick Sort is one of the most popular sorting algorithms that uses comparisons to sort an array of n elements in a typical situation. Quicksort is based on the divide-and-conquer strategy.
To run the concurrent and parallel version, use the command: g++ src/quick_sort.cpp && ./a.out
To run the CUDA threaded version, move the src/cuda_quick_sort.cu
file to Visual Studio, and run it.
Radix Sort is a non-comparative sorting algorithm. It avoids comparison by creating and distributing elements into buckets according to their radix. This algorithm has a time complexity of , where n represents the number of elelments, and k their length.
To run the concurrent version, use the command: g++ src/radix_sort.cpp && ./a.out
To run the CUDA threaded version, move the src/cuda_radix_sort.cu
file to Visual Studio, and run it.
If there you have any suggestions or you need help running or understanding the code, do not hesitate to reach out (either by making a new Issue, or by emailing me).
//EOP