// get device's OpenCL version (min of DEVICE and DRIVER version) HGPU_GPU_version HGPU_GPU_device_get_version(cl_device_id device){ HGPU_GPU_version version, version2; char* version_str = HGPU_GPU_device_get_info_str(device,CL_DEVICE_VERSION); version = HGPU_GPU_version_get(version_str); if (version.minor>=1) { char* version_str2 = HGPU_GPU_device_get_info_str(device,CL_DEVICE_OPENCL_C_VERSION); // CL_DEVICE_OPENCL_C_VERSION option only in OpenCL 1.1 version2 = HGPU_GPU_version_get(version_str2); version = HGPU_GPU_version_min(version,version2); free(version_str2); } free(version_str); return version; }
// get platform's OpenCL version HGPU_GPU_version HGPU_GPU_platform_get_version(cl_platform_id platform){ HGPU_GPU_version version; char* version_str = HGPU_GPU_platform_get_info_str(platform,CL_PLATFORM_VERSION); version = HGPU_GPU_version_get(version_str); free(version_str); return version; }