OpenCL books

Can anyone recommend a good OpenCL reference book? I’m new to OpenCL but I’m a seasoned programmer so I prefer reference style books to “step by step how to” style books. I found two that were published this summer that seem promising but they don’t have many reviews on Amazon yet:

OpenCL Programming Guide by Aaftab Munshi, Benedict Gaster, Timothy G. Mattson and James Fung … 0321749642

Heterogeneous Computing with OpenCL by Benedict Gaster, Lee Howes, David R. Kaeli and Perhaad Mistry (Aug 31, 2011) … 0123877660

Can anyone recommend either of theses or perhaps something else even better?

Adam Burr
Senior Research Associate
Blue Sky Studios
Greenwich, CT

FWIW I found the online documentation to be more than adequate, plus a few searches here and there. Although … the last programming language book I bought was for uni, “The (ANSI!) C programming language”, just on 20 years ago. I also had plenty of time to dabble.

I found the OpenCL spec itself is well written and easy to read. If you already know C, then this is the most useful for the language and host apis.

The AMD APP programming guide is also very good, and mostly applicable to other gpu’s. This helped with the understanding of the different memory hierarchies and processor topology which is key to getting performance. … _Guide.pdf

Of those you list, the second book looks the better, but i’m only going on the reviews (particularly the 1-star on the first) and the fact that Lee Howes hangs around the amd forums a bit and obviously knows what he’s talking about.

Thanks, that is helpful, I will check out the AMD site next.

Where can I find the best/alternate documentation for the C++ API?

For example, I’m having trouble figuring out what types (T) are appropriate for all the possible cl_device_info values in this call:

template <typename T>
cl_int cl::Device::getInfo(cl_device_info name, T * param)

Eight of them are documented here: … us-1.1.pdf

But there are about 42 more that seem to be undocumented. It isn’t a big deal, I can figure them out, but it made me think khronos the documentation might be a little bit thin. I’m not complaining, just curious.


Never mind, I’ve found all the documentation I need in the main “OpenCL 1.1 Specification” as you said. I did not realize that the “C++ Wrapper API” document was referring to table numbers in the “OpenCL 1.1 Specification” document, I thought there were just missing tables. Now I’m on the right track.

Thanks again,

NOTE TO MODERATORS: Can we get a sticky for reviews (not just mine) of the current books and document on OpenCL? I know people ask these questions a lot and I know I have written this information in other posts. I believe this would help newcommers to OpenCL out a lot.

I know you said you already found what you were looking for but I am sure you will learn with OpenCL sometimes having tons of references is very good. There are 3 actuall books out right now on OpenCL (There is another one from a while back but is basically a print out of the spec so I don’t count it). Note: There was an Nvidia book about CUDA that had one section on OpenCL but it was very small and tacked on. The three book I am talking about are the two books you mentioned and OpenCL in Action. … 982&sr=1-1

I have all three and have read them all. They all focus on different aspects.

Heterogenous Computing is all about geting going fast and has less about learning the full language. This can get you started fast but I think it would end up being slow in the long run if you only got that book as it quickly turns to a number of case studies. That said it is a really good book. One problem I find with this book is that there are only 4 code samples and they don’t start until chapter 4. If you want a book that provides you with basic tutorials they are here but you will not have reference code to work with until later examples. This book is clearly written by someone more familer with AMD but they do cover both platforms well.

OpenCL programming guide is the one I find myself using the most on a day to day basis when I need to reference something. It is a very good book and very through but you might find it a little dry as some sections start to feel like they are just a better reference. That in’t true as they provide great information but what i am trying to say is that you might find it difficult to sit down and read straight through. All of the code for this book in stored in Google Code repository.

OpenCL in Action is the newest book which I started reading through the early access program with Manning publishing (it is out now). It is a mixture of both of the other books and the one I would recommend if you only want one book. Again this has nothing to do with the quality of one book over the other as you should get them all if you can. This book has a good amount of code snippits which are very helpful is you just want to see a certain functionality buy itself but they also have bigger programs too. They have a good amount of C++ examples which is nice if you are interested in that. one thing I liked here is that they have a small reference section on OpenGL shader pipeline. I think this is great as most peopel think anyone interested in OpenCL already knows how to use shaders I have seen from many of my colleges this is not the case as they will constantly use the fixed function pipline.

Also I want to stress that simply reading the OpenCL spec, while pretty dry, is EXTREAMMLY helpful. I have read all of these books and still find myself understanding some things better when I read the spec. It is not a statement about these books but rather a statement to the quality of the spec and the people involved in writting it and also that these books above provide a good basis and foundation for OpenCL.

In addition the OpenCL programming guides from AMD and Nvidia as well as the documentation from Intel on OpenCL are VERY good. AMD has some great references to setting up windowing environments that would leave you searching and stumbling all over the web to find and integrate with OpenCL. Also they really help with optimization. With all that said I would to say I would recommend getting one of the formentioned books as well because AMD and Nvidia has a LOT of code that has nothing to do with the spec in their OpenCL code examples and is theire to make their lives easier when they make 400 examples.

So to sum this all up you have a lot of choices and unlike any other technology out there I have seen develop almost 98% of them are great.