Book review: CUDA By Example

It has been a while since my last post here, but I’m back! I had access to the French version of this book, thanks to the publisher.

CUDA is now in the trend, and there are several books, one of them I’ve also reviewed.

Content and opinions

The first two chapters are dedicated to introducing CUDA in computing science: why CUDA, why it can help someone and what nVidia offers. Of course, now nVidia offers more than what the book tells us (even nVidia offered more when the book was published if my memory serves me right).

Actual CUDA code is introduced next. The author adds small pieces in each chapter: first the specific syntax, then parallelism and threads, blocks and their cooperation with shared memory, constant memory and streams, texture memory.

The last step is the optimization of the code. The author starts with the interaction with OpenGL (and DirectX is left as an exercise), then atomicity, streams and finally multi GPUs. Some of these are only available on new GPUs, but it is not mentioned explicitly (you have to test your card with the provided code).

The last chapter browses through the different supports that are available: CUDA tools, documentation…

There are a lot of stuff that are “missing”. The most important thing is an explanation of how memory should be accessed. Coalescing memory is not even mentioned, and although nVidia made huge improvements since the first CUDA GPU, this is still one of the biggest ways to optimize your code. Also, the debuggers are mentioned, but there are sadly no real tutorial on this. You will have to fill some voids in your new knowledge (for instance the texture memory has more functionalities than what is described).


So CUDA By Example is a good introductory book with flaws. Contrary to the other book I read, this one (unfortunately?) does not dive into architectural details. You will still have to learn from the nVidia’s tutorials, but you will have an almost complete overview of CUDA.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.