计算机工程与应用 ›› 2015, Vol. 51 ›› Issue (21): 41-47.

• 理论研究、研发设计 • 上一篇    下一篇

面向CPU-GPU架构的源到源自动映射方法

朱正东1,刘  袁1,魏洪昌1,颜  康1,王寅峰2,董小社1   

  1. 1.西安交通大学 电子与信息工程学院,西安 710049
    2.深圳信息职业技术学院,广东 深圳 518172
  • 出版日期:2015-11-01 发布日期:2015-11-16

Novel automatic mapping technology on CPU-GPU heterogeneous systems

ZHU Zhengdong1, LIU Yuan1, WEI Hongchang1, YAN Kang1, WANG Yinfeng2, DONG Xiaoshe1   

  1. 1.School of Electronic & Information Engineering, Xi’an Jiaotong University, Xi’an 710049, China
    2.Shenzhen Institute of Information Technology, Shenzhen, Guangdong 518172, China
  • Online:2015-11-01 Published:2015-11-16

摘要: 针对GPU上应用开发移植困难的问题,提出了一种串行计算源程序到并行计算源程序的映射方法。该方法从串行源程序中获得可并行化循环的层次信息,建立循环体结构与GPU线程的对应关系,生成GPU端核心函数代码;根据变量引用读写属性生成CPU端控制代码。基于该方法实现了一个编译原型系统,完成了C语言源程序到CUDA源程序的自动生成。对原型系统在功能和性能方面的测试结果表明,该系统生成的CUDA源程序与C语言源程序在功能上一致,其性能有显著提高,在一定程度上解决了计算密集型应用向CPU-GPU异构多核系统移植困难的问题。

关键词: 通用计算图形处理器(GPGPU), 统一计算架构(CUDA), 自动映射, 源到源编译

Abstract: Aiming at the developing and porting difficulties of GPU-based applications, a mapping approach is proposed, which converts serial computing source code into equivalent parallel computing source code. This approach acquires hierarchies of parallelizable loops from serial sources, establishes the correspondence between loop structures and GPU threads, and generates the core function code for GPU. Meanwhile, CPU control code is generated according to read/write attributes of variable references. A compiler prototype is implemented based on this approach, which translates C code into CUDA code automatically. Functionality and performance evaluations of the prototype show that the CUDA code generated is functionally equivalent to the original C code, with significant improvement in performance, thus ?overcomes the difficulty in porting compute-intensive applications to CPU-GPU heterogeneous systems.

Key words: General Purpose Graphic Processing Unit(GPGPU), Compute Unified Device Architecture(CUDA), automatic mapping, source to source compile