vocaro的回答是绝对正确的;你可以使用总是在Snow Leopard和Lion上使用CPU计算设备,即使你的特定图形芯片不支持OpenCL。
下面的程序将显示在一个给定的Macintosh上的OpenCL的设备:
// clang -framework OpenCL dumpcl.c -o dumpcl && ./dumpcl
#include
#include
#include
int main(int argc, char* const argv[]) {
cl_uint num_devices, i;
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, 0, NULL, &num_devices);
cl_device_id* devices = calloc(sizeof(cl_device_id), num_devices);
clGetDeviceIDs(NULL, CL_DEVICE_TYPE_ALL, num_devices, devices, NULL);
char buf[128];
for (i = 0; i < num_devices; i++) {
clGetDeviceInfo(devices[i], CL_DEVICE_NAME, 128, buf, NULL);
fprintf(stdout, "Device %s supports ", buf);
clGetDeviceInfo(devices[i], CL_DEVICE_VERSION, 128, buf, NULL);
fprintf(stdout, "%s\n", buf);
}
free(devices);
}
我的MacBook,这给:
Device Intel(R) Core(TM) i7-2635QM CPU @ 2.00GHz supports OpenCL 1.1
Device ATI Radeon HD 6490M supports OpenCL 1.1
你可以要求使用该另一装置信息方案作为出发点。 Khronos API参考clGetDeviceInfo应该是有用的。