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)

Ok, I did some more digging and it seemed that the code was able to compile without a problem, but at runtime OpenCL would still fail to reach neither the GPU nor my CPU, suggesting a driver-level problem?

Ok, I did some more digging and it seemed that the code was able to compile without a problem, but at runtime OpenCL would still fail to reach neither the GPU nor my CPU, suggesting a driver-level problem?

Can anyone suggest a solution to this?

Click to expand...

Can you post the actual error you are getting. The driver is supplied by Apple so I highly doubt that is the issue unless something is really messed up with your install.

There are several issues with your code. Especially the kernel. Are you compiling this in Xcode? What version are you using. I see you use dispatch_release on the GCD queue. That is extremely old and no longer used. I fixed the issues and it compiled and ran correctly for me.

The main issue is that your kernel is wrong. The syntax is not right. Also you can't multiply two pointers together. Just curious are you aware how c pointers work?

Yes, I am compiling this in Xcode 8.3.3. I believe that it is the latest version? Admittedly I have only gotten started with C very recently. Prior to this it was mostly Perl and Python so I am still not very familiar with C-type pointers.

There was still an issue that I could not resolve, as gcl_create_dispatch_queue() only called CL_DEVICE_TYPE_GPU, but for some reason the binary kept churning out runtime warnings and errors that said,

and the same error code -2 from CL_DEVICE_NOT_AVAILBLE and the warning message actually made me wonder if they were actually referring to the same problem, where OpenCL tried to compile the code for the CPU and failed, despite that I asked explicitly only to queue GPU's.

Is there a newer guide than the one Apple supplied that I can refer to as well?

Yes, I am compiling this in Xcode 8.3.3. I believe that it is the latest version? Admittedly I have only gotten started with C very recently. Prior to this it was mostly Perl and Python so I am still not very familiar with C-type pointers.

There was still an issue that I could not resolve, as gcl_create_dispatch_queue() only called CL_DEVICE_TYPE_GPU, but for some reason the binary kept churning out runtime warnings and errors that said,

and the same error code -2 from CL_DEVICE_NOT_AVAILBLE and the warning message actually made me wonder if they were actually referring to the same problem, where OpenCL tried to compile the code for the CPU and failed, despite that I asked explicitly only to queue GPU's.

Is there a newer guide than the one Apple supplied that I can refer to as well?

While this example does not use Xcode per say it could be put into an Xcode project. It's quite easy to run. Just use terminal and cd into the directory and type make to compile. There is a small guide as well.

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)

Can anyone suggest how I should approach this problem? Is the OpenCL driver broken as some have suggested?

Click to expand...

--- Post Merged, Sep 12, 2017 ---

--- Post Merged, Sep 12, 2017 ---

The article between teagls and ocltypes17 regarding "getting the nonRendering GPU on the MacPro", there is an underlying question that went unanswered, namely once you get the nonDisplayCLDeviceId, what the heck do you do with it. It just sits there. Logically it should be input to the gcl_create_dispatch_queue command. The other somewhat unrelated question is how to test the nonDisplay device? Mine were replaced by Apple after they heated up and the display went coocoo but that says nothing about its current state.

Yes, I am compiling this in Xcode 8.3.3. I believe that it is the latest version? Admittedly I have only gotten started with C very recently. Prior to this it was mostly Perl and Python so I am still not very familiar with C-type pointers.

There was still an issue that I could not resolve, as gcl_create_dispatch_queue() only called CL_DEVICE_TYPE_GPU, but for some reason the binary kept churning out runtime warnings and errors that said,

and the same error code -2 from CL_DEVICE_NOT_AVAILBLE and the warning message actually made me wonder if they were actually referring to the same problem, where OpenCL tried to compile the code for the CPU and failed, despite that I asked explicitly only to queue GPU's.

Is there a newer guide than the one Apple supplied that I can refer to as well?

Click to expand...

This is kind of late but if you're familiar with python you may want to look into pyopencl. I've been using it for a while and works very well.

MacRumors attracts a broad audience
of both consumers and professionals interested in
the latest technologies and products. We also boast an active community focused on
purchasing decisions and technical aspects of the iPhone, iPod, iPad, and Mac platforms.