得到“ cl_version.h:未定义CL_TARGET_OPENCL_VERSION。默认为220(OpenCL 2.2)”运行时警告 [英] Getting "cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 220 (OpenCL 2.2)" warning during runtime

查看:932
本文介绍了得到“ cl_version.h:未定义CL_TARGET_OPENCL_VERSION。默认为220(OpenCL 2.2)”运行时警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

帖子,我正在main.c 代码= nofollow noreferrer>此GitHub Gist

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

运行CMake命令 find_package(需要OpenCL)我得到了:

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")

表示已找到OpenCL SDK 2.2版。这与我从 clinfo 工具获得的东西矛盾,该工具为Intel的SDK /平台检测到1.2 OpenCL。现在,当运行可执行文件时,我得到:

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。默认为220(OpenCL 2.2)

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

我的问题是:


  1. 为什么我会从CMake和 clinfo 中获得两个不同版本的OpenCL?

  2. 我的警告是什么

  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?

PS 此处 cmake的输出。.--debug-find

推荐答案

clinfo报告的SDK中的OpenCL版本是2种不同的东西:

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


  • clinfo报告了GPU支持的OpenCL版本

  • SDK OpenCL版本是SDK支持的最大版本

现在,如果您在程序中使用OpenCL 2.0,并且您的GPU支持OpenCL 1.2,那么我怀疑其中一个CL函数将报告错误,或者程序将具有未定义的行为。您可以使用 #define CL_TARGET_OPENCL_VERSION< version> 在程序中设置目标OpenCL版本,例如

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

,然后目标版本以上的API应该不会'没空。

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

这篇关于得到“ cl_version.h:未定义CL_TARGET_OPENCL_VERSION。默认为220(OpenCL 2.2)”运行时警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆