简体   繁体   中英

Checking opencl version in C

I am working with OpenCL and i am trying to find out which version is of OpenCl is running on my system. I have done the library addition and other things to add openCL in my Visual studio 2015. All i want is a small code which tells me which version is running. Thanks

I found out a video where it is showed how we can check it in C++(CL/cl.hpp) but in my sdk it is not available but only C version (CL/cl.h) is available

You should use clGetDeviceInfo along with parameter CL_DRIVER_VERSION according to this doc . Modify cl_device_id accordingly to your clGetDeviceIDs output.

 #include <CL/cl.h>
 #include <stdio.h>

 int main(int argc, char *argv[])
 {
     char *driver_version;
     clGetDeviceInfo(0, CL_DRIVER_VERSION, sizeof(char*), &driver_version, NULL);
     printf("%s\n", driver_version);
     return 0;
 }

clinfo输出 OpenCL 版本,以及许多其他可能有用的信息。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM