Abstract
Minimum spanning tree is a classical problem in graph theory that plays a key role in a broad domain of applications. This paper proposes a minimum spanning tree algorithm using Prim's approach on Nvidia GPU under CUDA architecture. By using new developed GPU-based Min-Reduction data parallel primitive in the key step of the algorithm, higher efficiency is achieved. Experimental results show that we obtain about 2 times speedup on Nvidia GTX260 GPU over the CPU implementation and 3 times speedup over non-primitives GPU implementation.
Introduction
The Minimum Spanning Tree (MST) is a cornerstone of graph theory, essential for everything from designing efficient telecommunication networks to VLSI circuit layout. While Prim’s algorithm is a classic, "greedy" approach to solving MST, it is notoriously difficult to parallelize due to its irregular data access patterns and inherently sequential nature.
Previous attempts to port Prim’s algorithm to the GPU often resulted in performance worse than standard CPU implementations because the overhead of managing the GPU outweighed the gains. The authors set out to bridge this gap by optimizing the most expensive part of the algorithm: finding the minimum value in a list of candidate edges.
Methodology
The authors introduce two primary innovations to make Prim’s algorithm "GPU-friendly":
1. Optimized Graph Representation
Standard adjacency lists use pointers, which GPUs handle poorly. The authors proposed a representation using CUDA’s built-in int2 vector data types and stored the graph in texture memory. This allowed for more efficient memory coalescing and took advantage of the GPU's specialized hardware caches.
2. GPU Min-Reduction (GMR) Primitive
The core of Prim’s algorithm involves repeatedly finding the minimum weight edge connected to the growing tree. The authors developed a custom "Min-Reduction" primitive that handles arrays of any length and returns both the minimum value and its index. To overcome the lack of global synchronization in CUDA, they used a two-kernel approach alongside optimization techniques like template metaprogramming to unroll loops and static shared memory to avoid bank conflicts.
Experimental Evaluation
The researchers evaluated their implementation using synthetic graphs generated by the Georgia Tech graph generator suite (GTgraph). The graphs ranged from 128 to 16,384 vertices with edge weights randomly assigned between 1 and 1,000.
Experimental results measured on an NVIDIA GTX260 GPU against the CPU-based Boost Graph Library (BGL) showed:
- Speedup vs. CPU: For a graph with 16,384 vertices, the GPU implementation was approximately 2 times faster than the BGL serial implementation.
- Speedup vs. Naive GPU: The optimized version was 3 times faster than a GPU version that did not use the specialized Min-Reduction primitives.
- Scaling: The performance advantage of the GPU version became more pronounced as the number of vertices increased, particularly after passing the 4,096-vertex threshold.
Conclusion
This work demonstrates that identifying and mapping computationally expensive sub-tasks to highly optimized data-parallel primitives is a viable strategy for parallelizing irregular algorithms. While the sequential nature of Prim’s outer loop remains a performance ceiling, the achieved speedups provide a strong foundation for future work in optimizing other irregular problems, such as Dijkstra’s Single Source Shortest Path (SSSP) algorithm.
Summary updated