Demo project to learn
OpenCL is an open industry standard for programming a heterogeneous collection of CPUs, GPUs and other discrete computing devices organized into a single platform. It is more than a language. OpenCL is a framework for parallel programming and includes a language, API, libraries and a runtime system to support software development. Using OpenCL, for example, a programmer can write general purpose programs that execute on GPUs without the need to map their algorithms onto a 3D graphics API such as OpenGL or DirectX.
A program that computes vector (3d) addition. The input data is read from
data file. One input row looks like:
1.173 18.221 89.311
Output is on
stdout in a very verbose format.
I ran into problems managing the correct datatypes and passing the correct sizes (
size_t variables) to the functions. Most of the time it will work but the results will be wrong, as the kernel will just work on some other memory.
Not every data block is equally good for handling with the GPU. Data that the device should work on should already be available in blocks on the host side.
For now I kept myself from doing asynchronous stuff. But writing to the device in asynchronous way could speed up the process.
[#Khronos:2011]: Khronos, OpenCL 1.1 Specification, 2011.