Hello,
I am trying to get started with developing some OpenCL codes on a Mac Pro to take advantage of its dual GPUs for calculations (not rendering, just purely mathematical computations). I am following the OpenCL programming guide published by Apple, but ran into a problem with the compiler claiming a device error with the FirePro D500 GPU.
The error returned from the compiler is:
[CL_DEVICE_NOT_AVAILABLE] : OpenCL Error : Error: build program driver returned (-2)
From here this seemed to suggest that by selecting the secondary GPU (I guess the one that is not rendering?), that may resolve the problem:
https://github.com/bulletphysics/bullet3/issues/208
However, following the code tidbit in Apple's technical note (https://developer.apple.com/library/content/technotes/tn2335/_index.html) Xcode 8.3.3 still fails to compile, claiming that I have conflicting types for "CGLQueryRenderInfo" with the code below:
Can anyone suggest how I should approach this problem? Is the OpenCL driver broken as some have suggested?
I am trying to get started with developing some OpenCL codes on a Mac Pro to take advantage of its dual GPUs for calculations (not rendering, just purely mathematical computations). I am following the OpenCL programming guide published by Apple, but ran into a problem with the compiler claiming a device error with the FirePro D500 GPU.
The error returned from the compiler is:
[CL_DEVICE_NOT_AVAILABLE] : OpenCL Error : Error: build program driver returned (-2)
From here this seemed to suggest that by selecting the secondary GPU (I guess the one that is not rendering?), that may resolve the problem:
https://github.com/bulletphysics/bullet3/issues/208
However, following the code tidbit in Apple's technical note (https://developer.apple.com/library/content/technotes/tn2335/_index.html) Xcode 8.3.3 still fails to compile, claiming that I have conflicting types for "CGLQueryRenderInfo" with the code below:
Code:
// look up available GPUs
cl_uint num = 0;
clGetDeviceIDs(NULL,CL_DEVICE_TYPE_GPU, 0, NULL, &num);
cl_device_id devices[num];
clGetDeviceIDs(NULL,CL_DEVICE_TYPE_GPU,num,devices,NULL);
cl_context ctx = clCreateContext(NULL,num,devices,NULL,NULL,NULL);
// select non-connected GPU
CGLRendererInfoObj rend;
GLint nrend = 0;
GLint nonDisplayGPURendererID = 0x0;
CGLQueryRendererInfo(0xffffffff, &rend, &nrend);
for(GLint idx=0; idx<nrend; idx++) {
GLint online = 1;
CGLDescribeRenderer(rend, idx, kCGLRPOnline, &online);
if(!online) {
GLint accelerated = 0;
CGLDescribeRenderer(rend, idx, kCGLRPAcceleratedCompute, &accelerated);
if(accelerated) {
CGLDescribeRenderer(rend, idx, kCGLRPRendererID,
&nonDisplayGPURendererID);
break;
}
}
}
CGLDestroyRendererInfo(rend);
// Converting a renderer ID to a cl_device_id
cl_device_id gpu = (cl_device_id)(intptr_t)(nonDisplayGPURendererID&~0xff);
// Obtain a dispatch queue for GPU in system
dispatch_queue_t queue = gcl_create_dispatch_queue(CL_DEVICE_TYPE_GPU, gpu);
// Optional: check device with clGetDeviceInfo
char name[128];
// cl_device_id gpu = gcl_get_device_id_with_dispatch_queue(queue);
clGetDeviceInfo(gpu, CL_DEVICE_NAME, 128, name, NULL);
fprintf(stdout, "Created a dispatch queue using the %s\n", name);
Can anyone suggest how I should approach this problem? Is the OpenCL driver broken as some have suggested?
Last edited by a moderator: