Skip to content
Khronos OpenCL-CLHPP
C++ Other
  1. C++ 98.8%
  2. Other 1.2%
Branch: master
Clone or download

Latest commit

bashbaug C++ bindings for cl_khr_extended_versioning (#82)
* C++ bindings for cl_khr_extended_versioning

* add OpenCL target version defines for tests

* fix 32-bit Windows tests

We need to jump through a few hoops for 32-bit Windows, since
CL_CALLBACK is special on 32-bit Windows.  These changes add
and remove CL_CALLBACK appropriately.

* switch to cl_khr_extended_versioning define
Latest commit 0192662 Apr 27, 2020


Type Name Latest commit message Commit time
Failed to load latest commit information.
docs Make it possible to use the repository as a submodule directly Sep 20, 2019
examples Make it possible to use the repository as a submodule directly Sep 20, 2019
external Add submodules for CMock and Unity Dec 7, 2018
include C++ bindings for cl_khr_extended_versioning (#82) Apr 27, 2020
tests C++ bindings for cl_khr_extended_versioning (#82) Apr 27, 2020
.gitmodules Add submodules for CMock and Unity Dec 7, 2018
.travis.yml Don't paralellise Travis builds (#74) Sep 23, 2019
CMakeLists.txt Fix test build with optimizations (#90) Mar 16, 2020 Create Oct 10, 2018
LICENSE.txt Change license to Apache 2.0 (#91) Mar 25, 2020 Fix the cmake command (#81) Jan 15, 2020 Simplified build of cl2.hpp to skip python script. Nov 4, 2014
input_cl.hpp use a more specific template type parameter for getInfo functions Apr 2, 2020

OpenCLTM API C++ bindings (cl.hpp and cl2.hpp)

Doxgen documentation for the cl2.hpp header is available here:


  • include/CL/cl2.hpp: The latest, maintained, version of the C++ bindings. It should work with all versions of OpenCL (including 1.x). This is what most users will want.

  • input_cl.hpp (DEPRECATED): Acts as the master source for the 1.x version of the header (include/CL/cl.hpp). The reason for doing it this way is to generate an appropriate set of functors with varying argument counts without assuming variadic template support in the header. This version of the C++ bindings is deprecated and is no longer maintained; it is strongly recommended to switch to cl2.hpp if possible.

  • A generator script written in python to convert input_cl.hpp into cl.hpp, generating the functor expansions as necessary. cl2.hpp does not require this as it uses variadic templates expanded in the compiler.

  • docs: Doxygen file used to generate HTML documentation for cl2.hpp.

  • examples: A simple example application using the very basic features of the header and generating cl.hpp dynamically through the build system.

  • tests: A (very small, incomplete) set of regression tests. Building the tests requires Python, Ruby, Unity and CMock. For the last two we use Unity 2.1.0 and CMock top-of-tree from Github (the version 2.0.204 on Sourceforge does not work).

  • CMakeLists.txt: A build system that both generates the example and drives generation of cl.hpp.

To get external dependencies needed for testing, use --recursive when cloning the repository, or run git submodule update --init.

You may need to tell CMake where to find the OpenCL headers and libraries, using the variables OPENCL_INCLUDE_DIR and OPENCL_LIB_DIR.

These can be set either as environment variables, or on the cmake command line using the syntax -D<VAR>=<VALUE>.

The following is an example set of commands to checkout and build the C++ bindings (adapt paths as required):

    git clone --recursive
    cd OpenCL-CLHPP
    mkdir build
    cd build
    cmake .. -DOPENCL_INCLUDE_DIR=/path/to/OpenCL/headers -DOPENCL_LIB_DIR=/path/to/OpenCL/library
    make test

After building, the headers appear in build/include/CL/.

If Doxygen is available, you can generate HTML documentation by typing make docs.

You can’t perform that action at this time.