arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2008.01938cs.DC
收藏

用GPU流水线实现求解动态规划问题

Solving Dynamic Programming Problem by Pipeline Implementation on GPU

Susumu Matsumae, Makoto Miyazaki

摘要:

在本文中,我们展示了在GPU上的动态规划(DP)的流水线实现的有效性。作为一个例子,我们解释了如何解决一个矩阵链乘法(MCM)问题的DP在GPU上。这个问题可以通过DP在$O(n^3)$步骤中顺序地解决,其中$n$是矩阵的数量,因为它的解表的大小为$n \times n$,并且表中的每个元素可以在$O(n)$步骤中计算。为此,典型的加速策略是并行化每个元素的$O(n)$步长计算,这可以通过并行前缀计算容易地实现,即,以锦标赛方式使用$n$线程的$O(\log n)$步骤计算。通过这种标准的并行化方法,我们可以用$n$线程在$O(n^2 \log n)$步骤中解决MCM问题。在我们的方法中,我们以流水线的方式在GPU上解决MCM问题,即,我们使用GPU核心来支持流水线阶段,使得解表的许多元素同时被部分地并行计算。我们的实现确定一个输出值,每一个计算步骤与$n$线程在一个管道的方式和构造的解决方案表完全在$O(n^2)$步骤与$n$线程。

英文摘要:

In this paper, we show the effectiveness of a pipeline implementation of Dynamic Programming (DP) on GPU. As an example, we explain how to solve a matrix-chain multiplication (MCM) problem by DP on GPU. This problem can be sequentially solved in $O(n^3)$ steps by DP where $n$ is the number of matrices, because its solution table is of size $n \times n$ and each element of the table can be computed in $O(n)$ steps. A typical speedup strategy for this is to parallelize the $O(n)$ step computation of each element, which can be easily achieved by parallel prefix computation, i.e., an $O(\log n)$ step computation with $n$ threads in a tournament fashion. By such a standard parallelizing method, we can solve the MCM problem in $O(n^2 \log n)$ steps with $n$ threads. In our approach, we solve the MCM problem on GPU in a pipeline fashion, i.e., we use GPU cores for supporting pipeline-stages so that many elements of the solution table are partially computed in parallel at one time. Our implementation determines one output value per one computational step with $n$ threads in a pipeline fashion and constructs the solution table totally in $O(n^2)$ steps with $n$ threads.

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

↑