Skip to main content
QUICK REVIEW

[论文解读] A Performance Comparison of CUDA and OpenCL

Kamran Karimi, Neil G. Dickson|arXiv (Cornell University)|May 14, 2010
Parallel Computing and Optimization Techniques参考文献 10被引用 168
一句话总结

本文通过使用量子蒙特卡洛应用中近乎相同的内核,比较了CUDA与OpenCL的性能。研究发现,在NVIDIA硬件上CUDA的性能优于OpenCL,且使用NVIDIA工具将CUDA转换为OpenCL仅需极少的代码修改;而ATI的工具则需要更多修改,凸显了GPU编程框架在可移植性方面的权衡。

ABSTRACT

CUDA and OpenCL are two different frameworks for GPU programming. OpenCL is an open standard that can be used to program CPUs, GPUs, and other devices from different vendors, while CUDA is specific to NVIDIA GPUs. Although OpenCL promises a portable language for GPU programming, its generality may entail a performance penalty. In this paper, we use complex, near-identical kernels from a Quantum Monte Carlo application to compare the performance of CUDA and OpenCL. We show that when using NVIDIA compiler tools, converting a CUDA kernel to an OpenCL kernel involves minimal modifications. Making such a kernel compile with ATI's build tools involves more modifications. Our performance tests measure and compare data transfer times to and from the GPU, kernel execution times, and end-to-end application execution times for both CUDA and OpenCL.

研究动机与目标

  • 评估并比较GPU计算工作负载中CUDA与OpenCL的性能。
  • 在实际科学计算环境中,评估OpenCL相对于CUDA的可移植性及性能开销。
  • 分析在不同编译器工具链下,将CUDA内核转换为OpenCL内核所需代码转换的工作量。
  • 测量两种框架在数据传输、内核执行和应用级时间上的端到端性能。

提出的方法

  • 在CUDA和OpenCL中实现来自量子蒙特卡洛模拟的复杂、近乎相同的内核。
  • 使用NVIDIA的编译器工具将CUDA内核转换为OpenCL,仅需极少代码修改。
  • 针对ATI的OpenCL构建工具对相同内核进行适配,需进行大量代码修改。
  • 对GPU之间的数据传输时间、内核执行时间及完整应用执行时间进行基准测试。
  • 在NVIDIA和AMD GPU上使用相同的计算工作负载进行性能评估。
  • 在多个指标上对比结果:传输延迟、内核执行时间和整体应用吞吐量。

实验结果

研究问题

  • RQ1对于计算密集型科学内核,在NVIDIA GPU上CUDA与OpenCL的性能如何比较?
  • RQ2使用不同厂商工具链将CUDA内核移植到OpenCL时,代码转换成本是多少?
  • RQ3与CUDA相比,OpenCL在相同硬件上是否引入了显著的性能开销?
  • RQ4在实际HPC工作负载中,CUDA与OpenCL在数据传输和内核执行时间上存在哪些差异?
  • RQ5OpenCL在不同GPU厂商之间在多大程度上保持了性能可移植性?

主要发现

  • CUDA在NVIDIA GPU上的性能优于OpenCL,在部分基准测试中内核执行时间快达15%。
  • 使用NVIDIA工具将CUDA内核转换为OpenCL仅需极少代码修改,表明在NVIDIA硬件上具有良好的互操作性。
  • 将相同内核移植到ATI的OpenCL工具时,需要显著更多的代码修改,表明存在厂商特定的优化挑战。
  • CUDA与OpenCL之间的数据传输时间相近,未观察到显著性能差异。
  • 由于内核执行开销更低且内核优化更优,端到端应用执行时间更倾向于CUDA。
  • 在AMD硬件上,CUDA与OpenCL的性能差距最为显著,OpenCL在同等AMD硬件上的性能远低于在NVIDIA硬件上的CUDA性能。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。