arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1503.06532cs.DCcs.PF
收藏

用OpenCL代替OpenMP进行并行CPU编程的可行性

The Feasibility of Using OpenCL Instead of OpenMP for Parallel CPU Programming

Kamran Karimi

摘要:

OpenCL和CUDA是用于对GPGPU进行编程的主要工具之一。然而,它也允许在多核CPU上运行相同的代码,使其成为历史悠久的OpenMP的竞争对手。在本文中,我们比较了OpenCL和OpenMP在CPU上开发和运行计算量大的代码时的情况。编程和性能方面的方便性都被考虑在内。由于与GPU不同,不涉及内存复制操作,因此我们的比较测量了OpenCL和OpenMP的代码生成质量以及线程管理效率。我们在两种情况下评估这些开发工具的性能:大量的短期运行的计算繁重的并行代码执行,当更多的线程管理被执行,和少量的长期运行的并行代码执行,当需要较少的线程管理。结果表明,OpenCL和OpenMP在两种情况下各赢一场。我们认为,虽然使用OpenMP需要较少的设置,OpenCL可以是一个可行的替代OpenMP从性能的角度来看,特别是当一个高数量的线程调用是必需的。我们还提供了从OpenMP迁移到OpenCL时需要注意的一些潜在陷阱。

英文摘要:

OpenCL, along with CUDA, is one of the main tools used to program GPGPUs. However, it allows running the same code on multi-core CPUs too, making it a rival for the long-established OpenMP. In this paper we compare OpenCL and OpenMP when developing and running compute-heavy code on a CPU. Both ease of programming and performance aspects are considered. Since, unlike a GPU, no memory copy operation is involved, our comparisons measure the code generation quality, as well as thread management efficiency of OpenCL and OpenMP. We evaluate the performance of these development tools under two conditions: a large number of short-running compute-heavy parallel code executions, when more thread management is performed, and a small number of long-running parallel code executions, when less thread management is required. The results show that OpenCL and OpenMP each win in one of the two conditions. We argue that while using OpenMP requires less setup, OpenCL can be a viable substitute for OpenMP from a performance point of view, especially when a high number of thread invocations is required. We also provide a number of potential pitfalls to watch for when moving from OpenMP to OpenCL.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑