Compiling clinfo with NVIDIA's OpenCL SDK leads to error C2061: syntax error: identifier 'cl_device_affinity_domain'

早过忘川 提交于 2020-06-17 09:45:29

问题


Following this issue, I'm trying to compile the clifo tool using the MSVC toolchain. I use this CMakeLists.txt file which successfully finds NVIDIA's OpenCL SDK:

Found OpenCL: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v3.2/lib/Win32/OpenCL.lib (found version "1.1")

However when compiling with cmake --build . I get many errors, from which the first one is:

c:\path\to\clinfo\src\info_ret.h(43): error C2061: syntax error: identifier 'cl_device_affinity_domain' [C:\path\to\clinfo\build\clinfo.vcxproj]

I tried defining the cl_device_affinity_domain enumerate type explicitly in the ext.h header file:

#ifndef CL_VERSION_1_1

#define CL_DEVICE_AFFINITY_DOMAIN_NUMA (1 << 0)
#define CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE (1 << 1)
#define CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE (1 << 2)
#define CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE (1 << 3)
#define CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE (1 << 4)
#define CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE (1 << 5)

typedef enum
{
    CL_DEVICE_AFFINITY_DOMAIN_NUMA,
    CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE,
    CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE,
    CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE,
    CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE,
    CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE
} cl_device_affinity_domain;

#endif

with no avail and sadly the clinfo developer is also hesitant to help! I wonder if this error has anything to do with the CMake file I have used? otherwise I would appreciate it if you could help me understand what is the problem and how I can resolve it.

P.S.1. Maybe I should use nvcc instead? I have the below version available:

...> nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2010 NVIDIA Corporation
Built on Thu_Nov__4_13:45:48_PDT_2010
Cuda compilation tools, release 3.2, V0.2.1221

P.S.2. OK, it turns out that I had a very outdated NVIDIA CUDA toolkit installed!

来源:https://stackoverflow.com/questions/62251277/compiling-clinfo-with-nvidias-opencl-sdk-leads-to-error-c2061-syntax-error-id

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