Author: Jason Sanders & Edward Kandrot
Parallel programming is hard and general purpose parallel programming using the GPU is the hardest of the hard...
Publisher: Addison Wesley, 2010
Aimed at: Cuda beginners
Pros: Well structured, easy-to-read
Cons: Lacks overiew
Reviewed by: Harry Fairhead
Well not any longer.
This book makes it all seem simple. In fact my only real complaint about this approach is that just occasionally you want to say to the authors - "OK, I get it - move on!"
This is a patient and careful presentation of programming in CUDA C. Generally each topic is introduced with a standard C programing doing the job on the processor and then a GPU version of the same program is developed step-by-step. Similarly the topics are broken down in to very small chapters that you can read through quite quickly.
After a basic introduction to CUDA the book gets you started actually programming very simple parallel code. By Chapter 4 you are summing arrays of data in parallel and by Chapter 5 you are working out the dot product of two vectors using synchronised threads. Chapter 6 provides a simple ray tracing example using constant memory. Chapter 7 deals with using texture memory which leads on nicely to Chapter 8's treatment of mixing CUDA and OpenGL. The book doesn't deal with using CUDA with DirectX but the reader is reassured that it works in more or less the same way - short example would have helped.
From this point on we deal with increasingly specialized examples, atomics, streams and multiple GPUs. The book closes with a look at additional tools and an appendix which deals with all the messy bits that would have interrupted the flow of the book.
This is not an advanced book and so there are lots of things it doesn't deal with. For example it doesn't deal with alternatives to CUDA, the new Fermi GPU architecture or advanced optimisation techniques. What this means is that if you are serious about GPU programming you will need to read a more advanced book - but this one will get you started.
This is an easy book to read given the perceived difficulty of the subject. The authors manage a light, amusing but not too over the top style. They write as if they were talking to you about the subject and this works well.
The book does have one drawback, however, and this is that it doesn't really give you an overview of how things work. As you go through the chapters you do understand what is being introduced but you have the uneasy feeling that another rabbit is about to be pulled out of the hat in the next chapter. You don't really have a clear idea of where you are going. However, if you just trust the authors you do get to the destination in the end and achieve a good understanding of the CUDA approach to parallelism - but you are still left with the uneasy feeling a the end of the book that there might be more.
Criticisms aside this is the book you need if you want to get into CUDA and general purpose GPU programming. Of course you need to know some C and if you are an expert in CUDA you might find the pace a little slow - but then why are you reading this introductory book?
Highly recommended - just get a copy.