The spec doesn’t seem to be clear on this, so I thought I would ask here:
I have created a context using clCreateContextFromType and CL_DEVICE_TYPE_ALL which returns a non zero context and CL_SUCCESS.
When querying this context for all devices using clGetContextInfo with CL_CONTEXT_DEVICES i also get CL_SUCCESS, however the returned size and device list do not appear to be correct.
The problem is:
The returned data is 32 bit, not 64 and the data is not a valid device.
The size is 4 bytes, which is half a word on my 64 bit MacBook Pro running Mac OSX Snow Leopard. The size given by sizeof(cl_device_id) is of course 8 bytes. So arguably this is invalid, or the implementation is made for a 32bit machine…? However, if I ignore this, there should be 2 devices returned (CPU+GPU), which queries on the platform indicate. Also ignoring this, the value of the data is always 0x2, which when treated like a device seems to be invalid also (although I was not thorough).
Has anyone else come across this? Or am I missing something obvious? Perhaps it is a problem with the implementation or current spec?
Other OpenCL code seems to work, but I would like to be able to query the context like this.
Platform:
Name = “Apple”;
Vendor = “Apple”;
Version = “OpenCL 1.0 (May 28 2009 16:54:15)”;
GPU:
Name = “GeForce 9400M”;
Vendor = “NVIDIA”;
Version = “OpenCL 1.0”;
CPU:
Name = “Intel® Core™2 Duo CPU T9550 @ 2.66GHz”;
Vendor = “Intel”;
Version = “OpenCL 1.0”;
I was unable to reproduce your problem so am wondering what is the version of SnowLeopard you are running. BTW if you have an Apple Developer account, do please file a bug using your ADC account.
Snow Leopard build 10A380 until I can find a dual layer DVD to update.
I have installed XCode Xcode 3.1 2199 from that DVD (snowleopard_10a432_userdvd) dmg.
However (before I lost my HDD) I had similar problems with the update prior to 10a432, I can’t remember the build number.
The OpenCL version is given from clGetPlatformInfo in my original post as “OpenCL 1.0 (May 28 2009 16:54:15)”.
I have an ADC account and if the problem persists after I update I will submit a bug report. I was hoping it was my error, and not a problem with the build so I could continue work.
I managed to install the latest build by restoring my Snow Leopard dmg to a spare partition using Disk Utility. Suffice to say that worked, and now the unexpected behaviour I have described has stopped. Yay me for finding a bug, if only it was still relevant.