基于3D张量与硬件加速的Floyd-Warshall算法重实现
The Floyd-Warshall Algorithm Re-implemented Using 3D-Tensors and Hardware Acceleration
AI总结:
本研究重实现了基于PyTorch等GPU库加速的Floyd-Warshall算法与R-Kleene算法,配套了可控规模的随机图生成器,实验验证其运行时间远优于NetworkX的传统实现。
摘要:
Floyd-Warshall(FW)算法是一种经典但极为重要的算法,用于求解全点对简单路径(APSP)问题。尽管NetworkX等开源图优化库已提供该算法的实现,但它们并未利用图形处理单元(GPU)等现代并行处理硬件,而这类硬件可将计算时间大幅缩短至迭代或递归实现的零头。本研究提出了一种利用PyTorch等开源GPU库重实现的Floyd-Warshall算法。此外,本文还进一步实现了R-Kleene算法——这是一种稍新的算法,采用分治递归但高度并行化的架构来求解APSP问题。研究还贡献了一个随机图生成器,可生成不同规模的各类图,其密度和连通性通过启发式方法控制。研究在这些启发式生成的图上,评估了GPU加速的FW算法与R-Kleene算法的运行时间,并将二者相互对比,同时也与NetworkX中广泛使用的实现进行了对比。上述算法的GPU实现代码、随机图生成器以及Blender动画文件均可在https://github.com/tanjary21/APSP_GPU/ 获取。
英文摘要:
The Floyd-Warshall(FW) algorithm, is an ancient but a largely important algorithm used to solve the all-pairs simple-paths(APSP) problem. While the algorithm is available for use in open-source graph optimization libraries such as NetworkX, they do not take advantage of modern parallel processing hardware such as Graphics Processing Units(GPUs), which would reduce compute time to a fraction of its iterative or recursive implementations. In this work, a re-implementation of the Floyd-Warshall algorithm using open-source GPU libraries such as PyTorch is presented. A further implementation of the R-Kleene is also described, a slightly newer algorithm used for solving the APSP problem in a divide-and-conquer, recursive but highly parallelized architecture. In addition, a random graph generator that generates a wide range of graphs of different scales is also contributed, where the densities and connectivities are controlled using some heuristics. The run-times of the GPU accelerated FW algorithm and R-Kleene on these heuristically generated graphs are evaluated against each other and to the widely used implementation from NetworkX. The code for the GPU implementation of the algorithms, the random graph generator, and the Blender animation file are available at https://github.com/tanjary21/APSP_GPU/.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。