Abstract. We present a comparison of several modern C ++ libraries providing high-level interfaces for programming multi-and many-core architectures on top of CUDA or OpenCL. The comparison focuses on the solution of ordinary differential equations and is based on odeint, a framework for the solution of systems of ordinary differential equations. Odeint is designed in a very flexible way and may be easily adapted for effective use of libraries such as MTL4, VexCL, or ViennaCL, using CUDA or OpenCL technologies. We found that CUDA and OpenCL work equally well for problems of large sizes, while OpenCL has higher overhead for smaller problems. Furthermore, we show that modern high-level libraries allow to effectively use the computational resources of many-core GPUs or multi-core CPUs without much knowledge of the underlying technologies. Key words. GPGPU, OpenCL, CUDA, C ++ , Boost.odeint, MTL4, VexCL, ViennaCL AMS subject classifications. 34-04, 65-04, 65Y05, 65Y10, 97N80 1. Introduction. Recently, general purpose computing on graphics processing units (GPGPU) has acquired considerable momentum in the scientific community. This is confirmed both by increasing numbers of GPGPU-related publications and GPU-based supercomputers in the TOP500 1 list. Major programming frameworks are NVIDIA CUDA and OpenCL. The former is a proprietary parallel computing architecture developed by NVIDIA for general purpose computing on NVIDIA graphics adapters, and the latter is an open, royalty-free standard for cross-platform, parallel programming of modern processors and GPUs maintained by the Khronos group. By nature, the two frameworks have their distinctive pros and cons. CUDA has a more mature programming environment with a larger set of scientific libraries, but is available for NVIDIA hardware only. OpenCL is supported on a wide range of hardware, but its native API requires a much larger amount of boilerplate code from the developer. Another problem with OpenCL is that it is generally difficult to achieve performance portability across different hardware architectures. Both technologies are able to provide scientists with the vast computational resources of modern GPUs at the price of a steep learning curve. Programmers need to familiarize themselves with a new programming language and, more importantly, with a new programming paradigm. However, the entry barrier may be lowered with the help of specialized libraries. The CUDA Toolkit includes several such libraries (BLAS implementations, Fast Fourier Transform, Thrust and others). OpenCL lacks standard libraries, but there are a number of third-party projects aimed at developing both CUDA and OpenCL programs. This paper presents a comparison of several modern C ++ libraries aimed at ease of GPGPU development. We look at both convenience and performance of the li-
VexCL REF is an expression template library for OpenCL/CUDA.
Programming CUDA and OpenCL: A Case Study Using Modern C++ Libraries
ArXiv
ArXiv
Computer Science Physics