论文标题
TPU上的大规模离散傅立叶变换
Large-Scale Discrete Fourier Transform on TPUs
论文作者
论文摘要
在这项工作中,我们介绍了张量处理单元(TPU)簇上的大规模离散傅立叶变换(DFT)的两种平行算法。两种平行算法与DFT的两个公式相关联:一个基于kronecker乘积,是特定于输入数据和vandermonde矩阵之间的特定密集矩阵乘法,在这项工作中表示为KDFT;另一个基于著名的Cooley-Tukey算法和相调整,在这项工作中称为FFT。 KDFT和FFT公式都充分利用了TPU在矩阵乘法中的强度。 KDFT公式可以直接使用不均匀输入,而无需其他步骤。在两种并行算法中,将数据分解的策略应用于输入数据。通过数据分解,KDFT和FFT中的密集矩阵乘积保持在TPU核心内,可以完全并行执行。 TPU内核之间的通信是通过两个并行算法中的单余程方案实现的,该方案在两个相邻的核心之间以及沿互连网络上的同一方向之间同时发送和接收数据。单档方案是为TPU簇的互连拓扑设计设计的,最大程度地减少了TPU内核之间通信所需的时间。 KDFT和FFT均在TensorFlow中实现。三维复杂的DFT是在尺寸$ 8192 \ times 8192 \ times 8192 $的示例上执行的,带有完整的TPU POD:KDFT的运行时间为12.66秒,FFT的运行时间为8.3秒。提供了缩放分析以证明TPU上两个DFT实现的高平行效率。
In this work, we present two parallel algorithms for the large-scale discrete Fourier transform (DFT) on Tensor Processing Unit (TPU) clusters. The two parallel algorithms are associated with two formulations of DFT: one is based on the Kronecker product, to be specific, dense matrix multiplications between the input data and the Vandermonde matrix, denoted as KDFT in this work; the other is based on the famous Cooley-Tukey algorithm and phase adjustment, denoted as FFT in this work. Both KDFT and FFT formulations take full advantage of TPU's strength in matrix multiplications. The KDFT formulation allows direct use of nonuniform inputs without additional step. In the two parallel algorithms, the same strategy of data decomposition is applied to the input data. Through the data decomposition, the dense matrix multiplications in KDFT and FFT are kept local within TPU cores, which can be performed completely in parallel. The communication among TPU cores is achieved through the one-shuffle scheme in both parallel algorithms, with which sending and receiving data takes place simultaneously between two neighboring cores and along the same direction on the interconnect network. The one-shuffle scheme is designed for the interconnect topology of TPU clusters, minimizing the time required by the communication among TPU cores. Both KDFT and FFT are implemented in TensorFlow. The three-dimensional complex DFT is performed on an example of dimension $8192 \times 8192 \times 8192$ with a full TPU Pod: the run time of KDFT is 12.66 seconds and that of FFT is 8.3 seconds. Scaling analysis is provided to demonstrate the high parallel efficiency of the two DFT implementations on TPUs.