330 likes | 761 Views
Quicksort Algorithm on GPU. Team #11 Kha Man Hieu Nguyen. Introduction. Quicksort is one of the fastest sorting algorithms in practice on CPU but it is not considered an efficient sorting solution on GPU GOAL: Achieve a high Quicksort performance on GPU. Introduction. IMPORTANT.
E N D
Quicksort Algorithm on GPU Team #11 Kha Man Hieu Nguyen
Introduction • Quicksort is one of the fastest sorting algorithms in practice on CPU but it is not considered an efficient sorting solution on GPU GOAL: Achieve a high Quicksort performance on GPU Quicksort Algorithm on GPU
Introduction IMPORTANT Quicksort Algorithm on GPU
What is GPU • A graphics processing unit (GPU), also occasionally called visual processing unit (VPU), is a specialized electronic circuit designed to rapidly manipulate and alter memory to accelerate the creation of images in a frame buffer intended for output to a display (Wikipedia) Quicksort Algorithm on GPU
CPU vs GPU Quicksort Algorithm on GPU
An example of CUDA Hardware model Quicksort Algorithm on GPU
An example of CUDA Hardware model Warp is a group of threads perform the same instructions concurrently Quicksort Algorithm on GPU
An example of CUDA Hardware model Quicksort Algorithm on GPU
An example of CUDA Hardware model Synchronization Quicksort Algorithm on GPU
An example of CUDA Hardware model Two warps cannot execute simultaneously on a single multiprocessor Quicksort Algorithm on GPU
An example of CUDA Hardware model Quicksort Algorithm on GPU
Quicksort algorithm Quicksort Algorithm on GPU
In-place version Quicksort Algorithm on GPU
Problems with in-place version • GPUs have limited cache memory. • Expensive thread synchronization when the number of threads is huge. Quicksort Algorithm on GPU
GPU Quicksort • Phase One • Sequences divided • Block synchronization on the CPU Thread Block 1 Thread Block 2 Quicksort Algorithm on GPU
Quicksort • Phase Two • Each block is assigned own sequence • Run entirely on GPU Thread Block 1 Thread Block 2 Quicksort Algorithm on GPU
Quicksort – Phase One 2 2 0 7 4 9 3 3 3 7 8 4 8 7 2 5 0 7 6 3 4 2 9 8 Quicksort Algorithm on GPU
Quicksort – Phase One 2 2 0 7 4 9 3 3 3 7 8 4 8 7 2 5 0 7 6 3 4 2 9 8 • AssignThread Blocks Quicksort Algorithm on GPU
Quicksort – Phase One 2 2 0 7 4 9 3 3 3 7 8 4 8 7 2 5 0 7 6 3 4 2 9 8 • Uses an auxiliaryarray Quicksort Algorithm on GPU
Quicksort – Synchronization 2 2 0 7 4 9 3 3 3 7 8 4 8 7 2 5 0 7 6 3 4 2 9 8 LeftPointer = 0 1 Thread Block ONE Fetch-And-Add on LeftPointer 0 Thread Block TWO Quicksort Algorithm on GPU
Quicksort – Synchronization 2 2 0 7 4 9 3 3 3 7 8 4 8 7 2 5 0 7 6 3 4 2 9 8 3 2 LeftPointer = 2 2 Thread Block ONE Fetch-And-Add on LeftPointer 3 Thread Block TWO Quicksort Algorithm on GPU
Quicksort – Synchronization 2 2 0 7 4 9 3 3 37 8 4 8 7 2 5 0 7 6 3 4 2 9 8 3 2 2 3 LeftPointer = 4 5 Thread Block ONE Fetch-And-Add on LeftPointer 4 Thread Block TWO Quicksort Algorithm on GPU
Quicksort – Synchronization 2 2 0 7493 3 3 7 848 7 2 5 0 7 6 3 4 2 9 8 3 2 2 3 3 0 2 0 3 2 7 9 7 8 8 7 5 7 6 9 8 LeftPointer = 10 Quicksort Algorithm on GPU
Quicksort – Synchronization 2 2 0 7 4 9 3 3 3 7 8 4 8 7 2 5 0 7 6 3 4 2 9 8 3 2 2 3 3 0 2 0 3 2 4 4 4 7 9 7 8 8 7 5 7 6 9 8 Quicksort Algorithm on GPU
Two Pass Partitioning 2 2 0 7 4 9 3 3 3 7 8 4 8 7 2 5 0 7 6 3 4 2 9 8 < < < < < < < < < < = = = > > > > > > > > > > > = = = Quicksort Algorithm on GPU
Implementation plan • We will implement the GPU quicksort algorithm on our Hydra server, observe and analyze the result to see the improvement Quicksort Algorithm on GPU
References • D. Cederman and P. Tsigas, “A practical quicksort algorithm for graphic processors,” in Proc. 16th Annual European Symposium on Algorithms (ESA 2008), Sep. 2008, pp. 246-258. • E. Sintorn and U. Assarsson. Fast parallel gpu-sorting using a hybrid algorithm. Journal of Parallel and Distributed Computing, 68(10):1381 - 1388, 2008. General-Purpose Processing using Graphics. • Processing Units D. Cederman and P. Tsigas, “On sorting and load balancing on GPUs,” in Proc. SIGARCH Comput. Archit.News,36:11–18, 2009 • N. K. Govindaraju, J. Gray, R. Kumar, and D. Manocha, “ GPUTeraSort: High performance graphics coprocessor sorting for large database management,” in Proceedings of the 2006 ACM SIGMOD International Conference on Management of Data, pages 325-336, June 2006. Quicksort Algorithm on GPU
Question? Quicksort Algorithm on GPU