Day 2: Multiple Dimensions and Work-Groups
Yesterday we saw how to use clEnqueueNDRangeKernel to execute a set of work-items that processed a unidimensional array. Today we’ll see how to extend that to multidimensional arrays and take advantage of OpenCL’s work-groups to increase the size of the problems we can tackle.
Multidimensional Work-Item Ranges
When a host calls clEnqueueNDRangeKernel to execute a kernel, it defines an index space. Each point in this index space is identified by a unique global ID that represents one work-item.
A kernel can find the global ID of the work-item it’s executing by calling get_global_id. In the example we saw yesterday the index space was unidimensional, and therefore the kernel only needed to call get_global_id ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access