Chapter 9. OpenCL Case Study
Histogram
This chapter discusses optimizing memory-bound kernels—in this case, a histogram of 8-bit-per-pixel image data optimized into 256 histogram bins.
Keywords Example program, histogram, image, local, memory-bound, OpenCL

Introduction

This chapter discusses specific optimizations for a memory-bound kernel. The kernel we choose for this chapter is an image histogram operation. The source data for this operation is an 8-bit-per-pixel image with a target of counting into each of 256 32-bit histogram bins.
The principle of the histogram algorithm is to perform the following operation over each element of the image:
for( many input values ) {
histogram[ value ]++;
}
This algorithm performs many scattered read-modify-write ...

Get Heterogeneous Computing with OpenCL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.