Frontiers of Data and Domputing ›› 2022, Vol. 4 ›› Issue (2): 3-16.

doi: 10.11871/jfdc.issn.2096-742X.2022.02.001

• Special Issue: Advanced Intelliget Computing Platform and Application • Previous Articles     Next Articles

Implementation and Integration of OpenCL Operators in TensorFlow Framework

GUO Qiang(),CHENG Daguo(),SUN Yufei*(),ZHOU Jianyu(),ZHANG Yuzhi(),PEI Jiaao(),GAN Rundong(),CHEN Rui()   

  1. College of Software, Nankai University, Tianjin 300450, China
  • Received:2022-02-23 Online:2022-04-20 Published:2022-04-30
  • Contact: SUN Yufei;;;;;;;


[Objective] TensorFlow, a mainstream machine learning framework, and CUDA heterogeneous programming environment are currently being used widely in academia and industry. TensorFlow operators implemented in CUDA are the key to accelerating computation. However, TensorFlow's lack of support for OpenCL, an open general-purpose heterogeneous programming standard, severely limits the versatility of TensorFlow and prevents the full computational power of OpenCL hardware devices. [Methods] To address this issue, this paper deeply explores the implementation of TensorFlow, implements the OpenCL operator based on an in-depth analysis of the TensorFlow code structure, and implements the integration of the OpenCL operator in the 2.2.0 version of the TensorFlow framework. [Results] Based on the above implementation, TensorFlow can run on hardware devices supporting OpenCL 1.2 with the help of the OpenCL operator. Also, the optimization method proposed in this paper significantly improves the computational efficiency of the OpenCL operator. [Conclusions] The experiments show that the method proposed in this paper can effectively solve the problem that TensorFlow cannot be applied to OpenCL hardware devices.

Key words: TensorFlow, OpenCL, Operator