我在我的戴尔 1558 中安装了 ATI HD Radeon 5470,并且在我的 win7-64 上安装了 AMDAPP SDK 2.8,问题是当我使用 opencl 代码对设备进行微调时,它说:
“找不到任何设备:没有错误”
我知道我已经安装了最新的催化剂驱动程序,并且我的所有其他程序都可以很好地与 GPU 配合使用,但我不知道为什么它会生成此报告。这是我用来查找设备的代码:谢谢大家帮我找出问题所在?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef MAC
#include <OpenCL/cl.h>
#else
#include <CL/cl.h>
#endif
int main() {
cl_platform_id platform;
cl_device_id *devices;
cl_uint num_devices, addr_data;
cl_int i, err;
char name_data[48], ext_data[4096];
err = clGetPlatformIDs(1, &platform, NULL);
if(err < 0) {
perror("Couldn't find any platforms");
exit(1);
}
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL,
1, NULL, &num_devices);
if(err < 0) {
perror("Couldn't find any devices");
exit(1);
}
devices = (cl_device_id*)
malloc(sizeof(cl_device_id) * num_devices);
clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL,
num_devices, devices, NULL);
for(i=0; i<num_devices; i++) {
err = clGetDeviceInfo(devices[i], CL_DEVICE_NAME,
sizeof(name_data), name_data, NULL);
if(err < 0) {
perror("Couldn't read extension data");
exit(1);
}
clGetDeviceInfo(devices[i], CL_DEVICE_ADDRESS_BITS,
sizeof(ext_data), &addr_data, NULL);
clGetDeviceInfo(devices[i], CL_DEVICE_EXTENSIONS,
sizeof(ext_data), ext_data, NULL);
printf("NAME: %s\nADDRESS_WIDTH: %u\nEXTENSIONS: %s",
name_data, addr_data, ext_data);
}
free(devices);
return 0;
}