[Paper Review] Fast k Nearest Neighbor Search using GPU
This paper presents a GPU-accelerated k-nearest neighbor (KNN) search using NVIDIA CUDA, leveraging the highly parallel nature of the brute-force algorithm to achieve up to 120× speedup over CPU-based C implementations and 40× over KD-tree methods. The CUDA implementation exhibits negligible sensitivity to data dimensionality, enabling efficient high-dimensional KNN computation for applications like content-based image retrieval.
The recent improvements of graphics processing units (GPU) offer to the computer vision community a powerful processing platform. Indeed, a lot of highly-parallelizable computer vision problems can be significantly accelerated using GPU architecture. Among these algorithms, the k nearest neighbor search (KNN) is a well-known problem linked with many applications such as classification, estimation of statistical properties, etc. The main drawback of this task lies in its computation burden, as it grows polynomially with the data size. In this paper, we show that the use of the NVIDIA CUDA API accelerates the search for the KNN up to a factor of 120.
Motivation & Objective
- To address the computational bottleneck of k-nearest neighbor (KNN) search in high-dimensional spaces, which scales polynomially with data size.
- To exploit the massive parallelism of GPU architectures to accelerate KNN computation beyond what is feasible with traditional CPU-based implementations.
- To demonstrate that GPU acceleration via CUDA can significantly reduce computation time while minimizing the impact of increasing data dimensionality.
- To enable practical use of high-dimensional descriptors in KNN-based applications such as content-based image retrieval by overcoming performance limitations.
Proposed method
- Implement the brute-force KNN algorithm using NVIDIA CUDA to exploit data-level parallelism across all query-reference point distance computations.
- Use CUDA kernels to compute all pairwise Euclidean distances between n query points and m reference points in parallel.
- Perform parallel sorting of distances for each query point using GPU-optimized sorting kernels to identify the k smallest distances.
- Optimize memory access patterns and minimize host-device data transfers to reduce latency, especially for high-dimensional data.
- Compare performance against CPU-based C implementations and KD-tree-based approaches using standardized benchmarks across varying dimensions and data sizes.
- Utilize CUDA profiling tools to analyze performance bottlenecks, particularly identifying memory transfer overhead in low-dimensional cases.
Experimental results
Research questions
- RQ1Can GPU acceleration via CUDA significantly reduce the computation time of k-nearest neighbor search compared to traditional CPU-based implementations?
- RQ2How does the dimensionality of the data space affect the performance of KNN search on CPU versus GPU architectures?
- RQ3Does the CUDA-based brute-force KNN implementation outperform optimized KD-tree-based methods in terms of speed and scalability?
- RQ4To what extent does memory transfer overhead limit performance in low-dimensional KNN computations on GPU?
- RQ5Can the GPU-accelerated KNN method enable the use of higher-dimensional feature descriptors in real-world applications like content-based image retrieval?
Key findings
- The CUDA-based brute-force KNN implementation achieves up to 120× speedup over MATLAB-based CPU implementations and 100× over C-based CPU code on the same hardware.
- For high-dimensional data (e.g., D=96), the CUDA implementation shows near-constant computation time regardless of dimensionality, with a slope of only 0.001 in time vs. dimension plots.
- In contrast, CPU-based brute-force and KD-tree methods show significant performance degradation with increasing dimension, with slopes of 0.56 and 0.20 respectively for the brute-force and KD-tree methods at N=4800.
- The CUDA implementation becomes the fastest method when data dimension exceeds 8, despite memory transfer overhead, due to superior parallelization of distance computations.
- For N=38400 and D=96, the CUDA method completes the KNN search in 43.74 seconds, compared to 1 hour for CPU-based methods and 20 minutes for the KD-tree approach.
- The KDT-C implementation is generally 3× faster than brute-force CPU methods, but remains outperformed by CUDA when data dimension exceeds 8.
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.