针对当前基于GPU的数值算法具有双精度数据性能低下的缺陷。提出了一种适于GPU统一计算架构Fermi—CUDA的混合精度平方根共轭梯度算法用以求解稀疏线性方程组。该算法采用单精度内迭代与双精度外迭代结合的方法,以充分利用GPU体系结构下单精度高性能和双精度高精度的优点。整个算法的计算部分完全在GPU端进行,减少了CPU和GPU之间的数据通信。实现了基于GPU的平方根共轭梯度法、Jacobi迭代法和Gauss—Seidel迭代法,分析它们作为内迭代算子对算法收敛性的影响。实验表明,该算法获得了与全双精度数据处理等同的计算精度,比GPU全双精度在浮点性能上提升近一倍,相对于CPU全双精度串行算法,最大加速比达到70以上。
GPU-based numerical algorithms have the shortcoming of low performance for double precision. We suggest a mixed precision conjugate gradient squared algorithm suitable for the GPU of Fermi-CUDA to solve sparse linear equations. The scheme uses a combination of single-precision inner iteration and double-precision outer iteration to take the advantages of efficient single-precision operation and accurate double-precision operation under the GPU structure. The calculation of the algorithm is implemented entirely on the GPU, which reduces the data transfer between CPU and GPU. Conjugate gradient squared algorithm, Jacobi iteration method and Gauss-Seidel iteration method based on GPU are implemented; and as inner iteration operators, their influence on the convergence of the whole process is analyzed. Experiments indicate that the mixed precision scheme maintains the native double-precision accuracy of data processing. At the same time, the floating point accuracy is improved by a factor of 2 compared with that using double-precision alone, and the maximum speedup ratio reaches to more than 70.