arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1304.7863cs.LOcs.DS
收藏

ACL2满足GPU:在ACL2中形式化基于CUDA的可分解全对最短路径算法

ACL2 Meets the GPU: Formalizing a CUDA-based Parallelizable All-Pairs Shortest Path Algorithm in ACL2

David S. Hardin, Samuel S. Hardin

摘要:

随着图形处理单元(GPU)的能力增强以及GPU开发环境的成熟,开发人员越来越多地转向GPU来卸载主主机CPU的数值密集型并行计算。现代GPU具有数百个核心,并提供编程细节,如双精度浮点,甚至有限的递归。然而,这种从CPU到GPU的转变提出了一个问题:我们如何知道这些新的基于GPU的算法是正确的?为了探索这一新的验证前沿,我们在ACL 2中正式定义了一种用于加权图的可并行化全对最短路径(APSP)算法,该算法最初使用NVIDIA的CUDA语言编写。ACL 2规范是使用单线程对象(stobj)和尾递归编写的,因为stobj/尾递归组合可以从命令式程序设计语言中产生最直接的转换,以及ACL 2本身中的高效,可伸缩的可执行规范。ACL 2版本的APSP算法可以处理数百万个顶点和边,几乎没有垃圾生成,并且执行速度是用C编写的基于主机的APSP版本的六分之一-对于定理证明器来说,这是一个非常值得尊敬的结果。除了形式化的APSP算法(它使用Dijkstra的最短路径算法在其核心),我们还提供了原来的APSP代码缺乏的能力,即最短路径恢复。路径恢复是使用实现LIFO堆栈的辅助ACL 2 stobj完成的,这已被证明是正确的。为了结束实验,我们将ACL 2版本的APSP内核移植回C,导致速度下降不到5%,并且还执行了部分回移植到CUDA,令人惊讶的是,这产生了轻微的性能提升。

英文摘要:

As Graphics Processing Units (GPUs) have gained in capability and GPU development environments have matured, developers are increasingly turning to the GPU to off-load the main host CPU of numerically-intensive, parallelizable computations. Modern GPUs feature hundreds of cores, and offer programming niceties such as double-precision floating point, and even limited recursion. This shift from CPU to GPU, however, raises the question: how do we know that these new GPU-based algorithms are correct? In order to explore this new verification frontier, we formalized a parallelizable all-pairs shortest path (APSP) algorithm for weighted graphs, originally coded in NVIDIA's CUDA language, in ACL2. The ACL2 specification is written using a single-threaded object (stobj) and tail recursion, as the stobj/tail recursion combination yields the most straightforward translation from imperative programming languages, as well as efficient, scalable executable specifications within ACL2 itself. The ACL2 version of the APSP algorithm can process millions of vertices and edges with little to no garbage generation, and executes at one-sixth the speed of a host-based version of APSP coded in C- a very respectable result for a theorem prover. In addition to formalizing the APSP algorithm (which uses Dijkstra's shortest path algorithm at its core), we have also provided capability that the original APSP code lacked, namely shortest path recovery. Path recovery is accomplished using a secondary ACL2 stobj implementing a LIFO stack, which is proven correct. To conclude the experiment, we ported the ACL2 version of the APSP kernels back to C, resulting in a less than 5% slowdown, and also performed a partial back-port to CUDA, which, surprisingly, yielded a slight performance increase.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑