Chapter 4. Kernel programming: data types and device memory

 

This chapter covers
  • Introducing a simple OpenCL kernel
  • Using OpenCL’s scalar and vector data types
  • Understanding the OpenCL device model

 

In this chapter, we’re going to put aside the scaffolding that creates and deploys kernels, and start coding the kernels themselves. We’ll examine the data types available in OpenCL kernels, and that means we’ll finally get to discuss vectors. When you process data with vectors, you put aside boring, decades-old data types like char, float, and int, and use new, exciting data types like char16, int3, and float4. Now we’re cooking!

I didn’t learn about vector programming until after I left college, but I’ve always enjoyed it since. It doesn’t ...

Get OpenCL in Action 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.