Code Yarns ‍👨‍💻
Tech Blog ❖ Personal Blog

CUDA by Example

📅 2011-Feb-06 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ book, cuda ⬩ 📚 Archive


With single processor speeds having hit a wall, there is a lot of interest in heterogeneous computing today. One of the popular ways to speed up applications is to rewrite them as massively parallel applications that execute on the NVIDIA CUDA architecture. It is quite hard to think of parallel solutions to existing problems and writing CUDA programs can be a minefield. These factors have made learning to swim in the choppy waters of CUDA difficult for beginners. Despite an abundance of CUDA information on the web, there has been no introductory material that is both simple and of good quality. The new book CUDA by Example: An Introduction to General-Purpose GPU Programming written by Jason Sanders and Edward Kandrot (both NVIDIA employees) aims to be such an introductory book for CUDA programming.

The only prerequisite expected of this book’s reader is knowledge of C. Spread over 12 quick chapters, the book uses example CUDA C programs all through to introduce concepts and explain their usage. Every example program is thoroughly broken down and the authors explain every stage of the process. It is quite heartening to see this detailed hand-holding extend all the way through to the complex concepts and last chapters. Chapters 1-5 are essential reading and the reader should be able to write simple CUDA programs after this point. The rest of the chapters acquaint concepts which are useful to further optimize the CUDA solution to take advantage of the problem domain or the CUDA architecture or both.


The book is strictly introductory, thankfully, and does not explain the CUDA architecture and its inner workings. I cannot commend the authors enough for taking this hard-line and making the jump into CUDA as simple and painless as they have done here. It would be natural to read the CUDA Programming Guide after this and keep it around as a reference for CUDA programming. This book is perfect for any inquisitive programmer wanting a taste of CUDA to see if it is worth her time. The avid reader can finish this book, having worked the examples and understood the major concepts, easily over a weekend.

Example code and errata of the book can be found here.

Rating: 4/4

© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 • 📧