Array (Dec 2022)

Influence of data amount, data type and implementation packages in GPU coding

  • Peng Xu,
  • Ming-Yan Sun,
  • Yin-Jun Gao,
  • Tai-Jiao Du,
  • Jin-Ming Hu,
  • Jun-Jie Zhang

Journal volume & issue
Vol. 16
p. 100261

Abstract

Read online

Graphic Processing Units (GPUs) are becoming popular in computational physics. Seeing the increasing trend of using GPUs in the physics community, we provide a comparison of the two major packages Numba and CuPy for GPU coding in Python language. We have discussed the influence of the data amount and data type on the performance of the GPU code. The data transferring time from GPU to CPU and its influence on the total execution time has also been analyzed. We find that when the grid numbers reaches 107, Numba will be faster than CuPy. Meanwhile, there is no noticeable difference in the data transmission speed between Numba and CuPy. Setting the data types as single-precision in Numba programs can improve the computation time by at least 20%.

Keywords