Search code examples
macosopenclosx-mountain-liongpgpuosx-mavericks

Simulating OpenCL 1.1 with OpenCL 1.2


I working with OpenCL and develop code that should be compiled on systems with OpenCL 1.1 while taking advantage of OpenCL 1.2 features when available.

Is it possible to simulate OpenCL 1.1 on a system with OpenCL 1.2?

I'm using Apple OpenCL framework, on Mac, and I want to make sure that the code will work for people who have OpenCL 1.1 (e.g. with Mountain Lion) before pushing the code back to the central repository.


Solution

  • Maybe you could take a look at the cl.hpp from the Khronos Group.

    Link to the header only library: http://www.khronos.org/registry/cl/

    Link to an short example: http://www.thebigblob.com/using-the-cpp-bindings-for-opencl/

    This is a C++ OpenCL wrapper which delivers you OpenCL 1.0, 1.1 or 1.2 support depending on the OpenCL header versions in your system path. I think you could go a way like this to reach that at compile time.

    If you have newer headers, but you want to restrict the version you can take a look at this thread: Cannot compile OpenCL application using 1.2 headers in 1.1 version

    Or do you want to choose the appropriate OpenCL functions at runtime?