Is this errata for the book or an issue with the source code?
Book and source.
Chapter 7, Section: Creating Buffers and Sub-Buffers, page: 251
Book:
Performing square kernel by many devices requires passing subsequent parts of
buffer to clEnqueueNDRangeKernel() which is done with offset. But created
buffer can contain only NUM_BUFFER_ELEMENTS elements and offset, calculated to
be multiple of that size, for subsequent devices is out of the range of the
buffer.
Size of buffer should be calculated as:
sizeof(float) * NUM_BUFFER_ELEMENTS * number_of_devices
Source:
In loop:
// Submit kernel enqueue to each queue
for (int i = 0; i < queues.size(); i++)
...
size_t offset = i * NUM_BUFFER_ELEMENTS * sizeof(int);
...
Offset should be calculated with 'sizeof(float)' instead of 'sizeof(int)',
because float * inputOutput is passed to: 'buffer = clCreateBuffer(...)'.
Original issue reported on code.google.com by eqo...@gmail.com on 12 Dec 2013 at 3:05
Original issue reported on code.google.com by
eqo...@gmail.com
on 12 Dec 2013 at 3:05