I downloaded the AMD APP 3.0 SDK and as soon as I include #include <CL/cl.hpp>
into my cpp it throws deprecation warnings:
1>c:\program files (x86)\amd app sdk\3.0\include\cl\cl.hpp(4240): warning
C4996: 'clCreateSampler': was declared deprecated
and many more.
Am I doing something wrong? I feel uncomfortable starting to play with openCL having so many warnings already before writing a single line of useful code.
The issue here is that
cl.hpp
is for OpenCL 1.X platforms, but the rest of AMD's SDK supports OpenCL 2.0. TheclCreateSampler
function was deprecated in OpenCL 2.0.Khronos have released an OpenCL 2.X version of the C++ bindings -
cl2.hpp
- which is what you should use if you wish to target OpenCL 2.0 devices using the C++ API. It may not have propagated to the vendor SDKs yet, but you can get the latest version directly from Khronos. To target OpenCL 2.0 with this header, you would include it like this:If you wish to target OpenCL 1.2 platforms instead, you just need to change the value of the
CL_HPP_TARGET_OPENCL_VERSION_MACRO
:(this will suppress the deprecation warnings that you previously received)
You could still use the 1.X header (
cl.hpp
) for 1.X platforms; you just need to make it clear that the deprecation warnings are not an issue for you: