55246

empty openCL program throws deprecation warning

Question:

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.

Answer1:

The issue here is that cl.hpp is for OpenCL 1.X platforms, but the rest of AMD's SDK supports OpenCL 2.0. The clCreateSampler 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 <a href="https://github.com/KhronosGroup/OpenCL-CLHPP/releases" rel="nofollow">directly from Khronos</a>. To target OpenCL 2.0 with this header, you would include it like this:

#define CL_HPP_TARGET_OPENCL_VERSION 200 #include <CL/cl2.hpp>

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:

#define CL_HPP_TARGET_OPENCL_VERSION 120 #include <CL/cl2.hpp>

(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:

#define CL_USE_DEPRECATED_OPENCL_1_2_APIS #include <CL/cl.hpp>

Recommend

  • Opencl clGetPlatformIDs error -1001
  • declaring and defining pointer vetors of vectors in OpenCL Kernel
  • Error “undefined reference to `__cudaRegisterLinkedBinary” when compiling CUDA with CMake
  • Concurrent kernel execution not working in AMD A10 APU
  • OpenCL ND-Range boundaries?
  • Adressing vector elements in C / openCL
  • Timed interval always evaluates to zero
  • OpenCL Simple “Hello World!” program compiles correctly but spits out garbage when executed
  • Nested loops in OpenCl Kernel
  • hadoop namenode is not formatting
  • Using require.js with Twitter Boostrap API and backbone
  • OpenGL Compute shader sync different work groups
  • AWS Cli sync with non DNS compatible bucket
  • OpenCL and GPU global synchronization
  • Increase margins for rotated axis labels with Crossfilter
  • Unselect column after pasting data
  • how to force the use of cmov in gcc and VS
  • JDBI's @BindBean doesn't find named parameters in bean class during INSERT
  • Receive custom intent without activity restart
  • NHibernate proxyexception
  • How to create a custom Powershell operator?
  • Can't compile Arduino CapSense example
  • can variables be set randomly when declaring them again?
  • How to revert to previous XCode version?
  • How solve “Qt: Untested Windows version 10.0 detected!”
  • C: Incompatible pointer type initializing
  • x64 applications using gdi+: what are the consequences on performance?
  • How to get Eclipse Oxygen to run on Java 9
  • iOS: Detect app start via notification press
  • Meteor helpers not available in Angular template
  • Exception “firebase.functions() takes … no argument …” when specifying a region for a Cloud Function
  • Is calc() supported in html email?
  • req.body is undefined - nodejs
  • Get object from AWS S3 as a stream
  • Symfony2: How to get request parameter
  • Function pointer “assignment from incompatible pointer type” only when using vararg ellipsis
  • Akka Routing: Reply's send to router ends up as dead letters
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • Is there a mandatory requirement to switch app.yaml?
  • Benchmarking RAM performance - UWP and C#