>> Wednesday, February 12, 2014
A coworker pointed out that two of my book's examples don't work properly: device_ext_test and buffer_check. After testing both on my Linux/AMD system, I was forced to agree. So I fixed the code and sent the updated zip files to the publisher.
The device_ext_test application fails because of clGetDeviceIDs. This doesn't seem to work properly when you want to determine how many devices are present. To be specific, the following line of code causes the error:
clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 1, NULL, &num_devices);
When this executes, it returns CL_INVALID_VALUE. I have no idea why this is, but I removed the call to clGetDeviceIDs and the error disappears.
My second error is more interesting. buffer_check fails because of the call to clCreateSubBuffer. My original code set the sub-buffer's origin to 120. This isn't an aligned memory address, and when I wrote the application, alignment wasn't a concern. But now my call to clCreateSubBuffer produces CL_MISALIGNED_SUB_BUFFER_OFFSET, a new error that was introduced in OpenCL 1.2. To clear this, I set the origin to 0x100. Now all is well.
In other news, Manning has made my book the Deal of the Day for February 13. Woo-hoo! That Oculus Rift book looks pretty incredible as well...