[Paper Review] The implementation and optimization of Bitonic sort algorithm based on CUDA
This paper presents an optimized CUDA-based implementation of the Bitonic sort algorithm, leveraging shared memory and register usage to reduce global memory accesses and kernel launch overhead. The optimized version achieves up to 30x speedup over CPU-based quicksort on 32-bit random integers, demonstrating the effectiveness of GPU acceleration for parallel sorting in data-intensive workloads.
This paper describes in detail the bitonic sort algorithm,and implements the bitonic sort algorithm based on cuda architecture.At the same time,we conduct two effective optimization of implementation details according to the characteristics of the GPU,which greatly improve the efficiency. Finally,we survey the optimized Bitonic sort algorithm on the GPU with the speedup of quick sort algorithm on the CPU.Since Quick Sort is not suitable to be implemented in parallel,but it is more efficient than other sorting algorithms on CPU to some extend.Hence,to see the speedup and performance,we compare bitonic sort on GPU with quick Sort on CPU. For a series of 32-bit random integer,the experimental results show that the acceleration of our work is nearly 20 times.When array size is about 216,the speedup ratio is even up to 30.
Motivation & Objective
- To address the performance bottleneck of naive GPU porting of Bitonic sort, which suffers from high kernel launch overhead and excessive global memory access.
- To improve GPU sorting efficiency by minimizing memory latency and thread synchronization costs through architectural-aware optimizations.
- To evaluate the performance of the optimized Bitonic sort against CPU-based quicksort, a standard high-performance sequential sorting algorithm.
- To demonstrate the feasibility and scalability of Bitonic sort on modern GPUs for general-purpose sorting workloads.
- To explore the potential of GPU-accelerated sorting for data-parallel applications beyond traditional CPU sorting.
Proposed method
- Implement Bitonic sort on CUDA by launching a kernel for each compare-exchange step, with each thread handling one comparison operation.
- Optimize memory access by loading subsequences of length $2^s$ into shared memory per block, reducing repeated global memory reads.
- Use block-level synchronization via CUDA's __syncthreads() to coordinate multiple steps within a single kernel launch, eliminating inter-kernel host synchronization.
- Apply register optimization by caching frequently accessed addresses (e.g., indices in phases 3 and 2) to reduce redundant global memory loads.
- Structure the kernel launch to process multiple steps (e.g., steps 3 and 2) in sequence within one kernel, minimizing kernel launch latency.
- Use coalesced memory access patterns where possible to maximize memory throughput on the GPU.
Experimental results
Research questions
- RQ1How can Bitonic sort be efficiently mapped to the CUDA execution model to minimize kernel launch overhead and global memory access?
- RQ2To what extent can shared memory and register usage reduce memory latency and improve performance in GPU-based Bitonic sort?
- RQ3What is the performance gain of the optimized Bitonic sort compared to CPU-based quicksort on large-scale random integer arrays?
- RQ4How does the speedup of the optimized Bitonic sort scale with increasing array size on a GPU?
- RQ5What are the performance characteristics of the optimized Bitonic sort on different data types (e.g., 32-bit integers, floats, doubles) and hardware configurations?
Key findings
- The optimized Bitonic sort implementation achieves a maximum speedup of 30x over CPU-based quicksort on arrays of size $2^{16}$ (65,536 elements).
- For arrays of size $2^{28}$ (256M elements), the speedup ratio remains at 19.6x, demonstrating strong scalability on large datasets.
- The semi-optimized version (using shared memory only) reduces execution time from 173.77ms (basic) to 162.56ms on 32M elements, a 6.4% improvement.
- The fully optimized version (shared memory + register usage) reduces time from 173.77ms to 120.93ms on 32M elements, a 29.8% improvement over the basic implementation.
- The number of kernel launches is drastically reduced by combining multiple steps into a single kernel, significantly lowering launch latency.
- The performance gain is consistent across array sizes, with speedup ranging from 20.1x to 30x depending on input size and optimization level.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.