Intel OpenCL 2.0 and c++ bindings problem

Hi all,

I’ve installed the latest OpenCL 2.0 from Intel on Windows 7 64-bit. I also have CUDA 6.0 installed. The program using c++ bindings compiles fine using
either OpenCL 1.1 included with CUDA. OpenCL 2.0 included with Intel gives some warnings:

x86_64-w64-mingw32-g++ -O2 -o paragon_tds paragon_tds.cpp -I"C:\Program Files (x
86)\Intel\OpenCL SDK\4.6\include" -L"C:\Program Files (x86)\Intel\OpenCL SDK\4.
6\lib\x64" -lOpenCL
In file included from paragon_tds.cpp:28:0:
C:\Program Files (x86)\Intel\OpenCL SDK\4.6\include/CL/cl.hpp: In constructor ’
cl::Sampler::Sampler(const cl::Context&, cl_bool, cl_addressing_mode, cl_filter_
mode, cl_int*)’:
C:\Program Files (x86)\Intel\OpenCL SDK\4.6\include/CL/cl.hpp:4307:21: warning:
cl_sampler* clCreateSampler(cl_context, cl_bool, cl_addressing_mode, cl_filte
r_mode, cl_int*)’ is deprecated (declared at C:\Program Files (x86)\Intel\OpenCL
SDK\4.6\include/CL/cl.h:1365) [-Wdeprecated-declarations]
object
= ::clCreateSampler(
^
C:\Program Files (x86)\Intel\OpenCL SDK\4.6\include/CL/cl.hpp:4312:19: warning:
‘_cl_sampler* clCreateSampler(cl_context, cl_bool, cl_addressing_mode, cl_filte
r_mode, cl_int*)’ is deprecated (declared at C:\Program Files (x86)\Intel\OpenCL
SDK\4.6\include/CL/cl.h:1365) [-Wdeprecated-declarations]
&error);
^
In file included from paragon_tds.cpp:28:0:
C:\Program Files (x86)\Intel\OpenCL SDK\4.6\include/CL/cl.hpp: In constructor ’
cl::CommandQueue::CommandQueue(cl_command_queue_properties, cl_int*)’:
C:\Program Files (x86)\Intel\OpenCL SDK\4.6\include/CL/cl.hpp:5117:25: warning:
cl_command_queue* clCreateCommandQueue(cl_context, cl_device_id, cl_command_q
ueue_properties, cl_int*)’ is deprecated (declared at C:\Program Files (x86)\Int
el\OpenCL SDK\4.6\include/CL/cl.h:1358) [-Wdeprecated-declarations]
object
= ::clCreateCommandQueue(
^
C:\Program Files (x86)\Intel\OpenCL SDK\4.6\include/CL/cl.hpp:5118:56: warning:
‘_cl_command_queue* clCreateCommandQueue(cl_context, cl_device_id, cl_command_q
ueue_properties, cl_int*)’ is deprecated (declared at C:\Program Files (x86)\Int
el\OpenCL SDK\4.6\include/CL/cl.h:1358) [-Wdeprecated-declarations]
context(), device(), properties, &error);
^
C:\Program Files (x86)\Intel\OpenCL SDK\4.6\include/CL/cl.hpp: In constructor ’
cl::CommandQueue::CommandQueue(const cl::Context&, cl_command_queue_properties,
cl_int*)’:
C:\Program Files (x86)\Intel\OpenCL SDK\4.6\include/CL/cl.hpp:5148:21: warning:
'cl_command_queue* clCreateCommandQueue(cl_context, cl_device_id, cl_command_q
ueue_properties, cl_int*)’ is deprecated (declared at C:\Program Files (x86)\Int
el\OpenCL SDK\4.6\include/CL/cl.h:1358) [-Wdeprecated-declarations]
object
= ::clCreateCommandQueue(context(), devices0, properties, &
error);
^
C:\Program Files (x86)\Intel\OpenCL SDK\4.6\include/CL/cl.hpp:5148:85: warning:
'cl_command_queue* clCreateCommandQueue(cl_context, cl_device_id, cl_command_q
ueue_properties, cl_int*)’ is deprecated (declared at C:\Program Files (x86)\Int
el\OpenCL SDK\4.6\include/CL/cl.h:1358) [-Wdeprecated-declarations]
object
= ::clCreateCommandQueue(context(), devices0, properties, &
error);

 ^

C:\Program Files (x86)\Intel\OpenCL SDK\4.6\include/CL/cl.hpp: In constructor ’
cl::CommandQueue::CommandQueue(const cl::Context&, const cl::Device&, cl_command
_queue_properties, cl_int*)’:
C:\Program Files (x86)\Intel\OpenCL SDK\4.6\include/CL/cl.hpp:5165:21: warning:
'cl_command_queue* clCreateCommandQueue(cl_context, cl_device_id, cl_command_q
ueue_properties, cl_int*)’ is deprecated (declared at C:\Program Files (x86)\Int
el\OpenCL SDK\4.6\include/CL/cl.h:1358) [-Wdeprecated-declarations]
object
= ::clCreateCommandQueue(
^
C:\Program Files (x86)\Intel\OpenCL SDK\4.6\include/CL/cl.hpp:5166:52: warning:
‘_cl_command_queue* clCreateCommandQueue(cl_context, cl_device_id, cl_command_q
ueue_properties, cl_int*)’ is deprecated (declared at C:\Program Files (x86)\Int
el\OpenCL SDK\4.6\include/CL/cl.h:1358) [-Wdeprecated-declarations]
context(), device(), properties, &error);
^
C:\Program Files (x86)\Intel\OpenCL SDK\4.6\include/CL/cl.hpp: In member functi
on ‘cl_int cl::CommandQueue::enqueueTask(const cl::Kernel&, const std::vector<cl
::Event>, cl::Event) const’:
C:\Program Files (x86)\Intel\OpenCL SDK\4.6\include/CL/cl.hpp:5942:15: warning:
‘cl_int clEnqueueTask(cl_command_queue, cl_kernel, cl_uint, _cl_event* const*,
_cl_event**)’ is deprecated (declared at C:\Program Files (x86)\Intel\OpenCL SDK
\4.6\include/CL/cl.h:1372) [-Wdeprecated-declarations]
::clEnqueueTask(
^
C:\Program Files (x86)\Intel\OpenCL SDK\4.6\include/CL/cl.hpp:5946:46: warning:
‘cl_int clEnqueueTask(cl_command_queue, cl_kernel, cl_uint, _cl_event* const*,
_cl_event**)’ is deprecated (declared at C:\Program Files (x86)\Intel\OpenCL SDK
\4.6\include/CL/cl.h:1372) [-Wdeprecated-declarations]
(event != NULL) ? &tmp : NULL),
^
The program stops working at the last statement below.

// Get device and platform
std::vector&lt;cl::Platform&gt; platforms;
std::vector&lt;cl::Device&gt; devices, device;

// cl::Device device;
cl::Platform platform;
std::string devicename;
cl::Platform::get(&platforms);

I would like to install the previous version of Intel OpenCL but they don’t let you.

Is there another cure?

Many thanks!

This comes from the C++ header using deprecated APIs from previous versions of the OpenCL API. If you #define CL_USE_DEPRECATED_OPENCL_2_0_APIS before you include cl.hpp, the compiler should be happy.