Chapter 4

Examples

Abstract

This chapter provides four complete OpenCL examples (both host code and kernels). The examples include OpenCL implementations of histogram, image rotation, and convolution, as well as a producer-consumer design executing on multiple devices. These algorithms illustrate features such as communication via local memory, atomic operations, images, samplers, and pipes.

Keywords

local memory

local atomics

global atomics

barriers

memory fences

images

samplers

C++ API

pipes

multiple devices

4.1 OpenCL Examples

This chapter discusses some basic OpenCL examples, which allow us to summarize our understanding of the specification discussed in Chapter 3. These examples demonstrate the programming steps needed to write complete ...

Get Heterogeneous Computing with OpenCL 2.0 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.