Book News

>> 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...

1 comments:

Anonymous,  February 22, 2014 at 3:34 PM  

The issue with clGetDeviceIDs here might've been the 3rd parameter, which should be 0 when the number of available devices is queried.

There's also a bug in the Ch14 FFT example, in the fft_init(...) kernel function. Due to the scattered, bit-reversed addressing of the g_data buffers, and the lack of global synchronization possibility, it might happen that work items overwrite the input with their partial results (/* Load global data */ vs. /* Store results in global memory */ parts). The easiest fix would be using separate input and output buffers in that kernel.

Post a Comment

  © Blogger template Werd by Ourblogtemplates.com 2009

Back to TOP