Getting “cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)” warning during runtime

做~自己de王妃 提交于 2020-06-29 03:40:37

问题


Following this and this posts, I'm compiling the main.c code on this GitHub Gist.

Running CMake command find_package(OpenCL REQUIRED) I get this:

-- Looking for CL_VERSION_2_2 - found
-- Found OpenCL: C:/Program Files (x86)/IntelSWTools/system_studio_2020/OpenCL/sdk/lib/x86/OpenCL.lib (found version "2.2")

indicating that an OpenCL SDK version 2.2 was found. This is in contradiction with what I get from clinfo tool, detecting a 1.2 OpenCL for Intel's SDK/platforms. Now when running the executable I get:

cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)

My questions are:

  1. Why I get two different versions of OpenCL from CMake and clinfo?
  2. What is the warning I'm getting at runtime and how to fix that?

P.S. Here is the output of cmake .. --debug-find


回答1:


OpenCL version in SDK and reported by clinfo are 2 different things:

  • clinfo reports OpenCL version supported by your GPU
  • SDK OpenCL version is the max version supported by SDK

Now if you use in your program OpenCL 2.0 and your GPU supports OpenCL 1.2 then I would suspect one of the CL functions will report error or the program will have undefined behavior. You can set the target OpenCL version in your program using #define CL_TARGET_OPENCL_VERSION <version>, for example

#define CL_TARGET_OPENCL_VERSION 120

and then the API above target version shouldn't be available.



来源:https://stackoverflow.com/questions/62286806/getting-cl-version-h-cl-target-opencl-version-is-not-defined-defaulting-to-22

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!