Author: Matthew Scarpino
Publisher: Manning, 2011
Audience: Those familiar with OpenCL
Reviewer: Mike James
OpenCL is a difficult topic, how does an In Action book fare in explaining what it is all about.
OpenCL is the great hope for a hardware independent way to express your parallel programs so that they can run on whatever happens to be available. In most cases what potential users have in mind is running programs on the multi-core GPUs that are in most modern desktops. A good graphics card coupled with OpenCL gives you the power of last year's supercomputer. However, it is important to realize that OpenCL isn't just about using GPUs, you can throw in multiple CPU cores to the mix - it is a language for a heterogeneous architecture.
So how do you get started?
The simple answer is not via this book. Beginners should look elsewhere for an easy starter book because while this one is really well written it is organized in a way that aims to be complete rather than inspirational or educational. It doesn't give you a simple example and a brief explanation to let you get the whole picture into your head. Instead it goes into detail about the different parts that make up the OpenCL system. It goes over the data types and what you can do in a kernel, but if you are a beginner you will be wondering exactly how to get something done with a kernel and how exactly the parallelism fits into it all.
To give you some idea of just how much this isn't a beginners' book there is very little on setting up an OpenCL SDK to get you started and not even much in the way of helpful suggestions for where you might find getting started information. It is assumed that you have a graphics card and will download and install the appropriate SDK.
This isn't to say that the book is obscure or misleading - if you know how OpenCL works then its explanations are helpful and the detail it provides will make things clear for you.
The last part of the first section of the book deals with specific topics such as image processing, using C++, Java and Python and general coding styles.
Part 2 of the book is on applications. Here you will find some real OpenCL code to do real jobs. Chapter 11 is on map-reduce with examples of sorting, Chapter 12 is on QR decomposition starting with matrix operations such as transpose, multiplication, and building up to the QR decomposition. Chatper 13 deals with sparse matrices including steepest decent and conjugate gradient. Finally chapter 14 deals with signal processing including the FFT.
The third part of the book consists of two chapters about using OpenCL with OpenGL, covering how to make them work together on the same data and applications such as animation and image processing.
The book closes with some interesting and useful appendices on installing SDKs, real time rendering and using OpenCL on mobile devices - any of these could have been usefully expanded into full chapters.
So overall this is a useful book that spans the range from the online documentation to some good examples. You could easily save yourself a lot of time by using any of the examples in the book as starting points for your own implementations. The only area where the book is weak is in providing an easy starting point for the interested beginner.
As long as you already have a rough idea what an OpenCL program is all, about then this book is an essential next step.