An Introduction to Matlab x CUDA#
But why write a book? (a monologue)#
Let’s be honest, with the coming of the internet, information is in a surplus, rather than in a deficit. Whether it’s for the good or bad, let’s leave that for middle-schoolers to debate. So a question to ask oneself when writing yet another book is, “Why?”. And that is a very fair question to ask if you’re a wannabe author. After all, why would anyone write a book when there is an ocean of resources out there in the form of books, YouTube videos and lecture-slides?
And to that, my answer was, for the very same reason there is NPTEL, MIT-OCW and Stanford-Online. One of the fears of Professor Strang (MIT Professor, famous for his 18.06 Linear Algebra lectures) was that one day every student would have learned from the same source. While I do not share the fear, I do believe in the power of choice. Since everyone is not made the same, there is an expected difference in the way people learn. I’ll confess that the best book to learn this is Programming Massively Parallel Processors by David Kirk and Wen-mei Hwu. It’s easily the best book for CUDA out there. Hands down. In fact, if you have time and you would like to learn this topic with rigour, I would suggest starting there.
One of my Professors at Boston University writes great notes. His notes on Optimization are an absolute joy to read due to the sheer personality infused with the content. And that’s the kind of book/notes that I love. The kind that feels like there is a person on the other side walking you through it. So the whole question of, “Why write another book?”, went out the window.
The “side-quest” to write this book started because yours truly couldn’t find a tutorial that matched the best way I learn. So I found myself going through a large number of resources. And this “book” started as a markdown file where I wrote down everything I learned. And I kept adding to it as I learned.
So once I started polishing up my notes, the plan was to see if I could publish it. But that didn’t feel right. As someone who learned most of what he knew from free resources like MIT-OCW, I figured it’s only fair to give back. And this way, I also get to continuously add more things to it because, surprise, surprise, I’m a student too.
End of the day, I believe that knowledge should be free. I envision a world where the only thing that stops one from learning is a lack of interest, rather than some arbitrary monetary walls. While I do realize that there are aspects of my dream that are just not feasible, I’ll do my part to push things closer to the ideal. And this book is one of the ways I choose to do it. Is it difficult to spend time, energy and effort to write a book that will, probably, produce no returns? Absolutely. But to paraphrase JFK, we do these things, not because they’re easy, but because they’re hard. Because the goal will serve to organize and measure the best of our energies and skills. And if there’s one thing that defines engineers, it’s that we learn best by doing: Acta non verba.
So, here’s the book. The way it teaches the reader stems from another part of my life: motorbikes. I absolutely love them. And One does not simply start a novice by teaching the compression ratios of the engine or how the gears trade off torque for RPMs. Those are fundamental, yes, but irrelevant to a beginner. This book is written the same way my brother and my friend taught me to ride motorbikes: progressive overload. You start by learning how to get on the bike, putting the gear in neutral, turning it on, putting it in first gear and slowly releasing the clutch while you gradually accelerate the bike. Borrowing from that, the first few sections are going to be trivially simple. But I assure you the scripts and lessons get sophisticated as you move through it. And it is highly practice/implementation-based. So, having a CUDA-powered system by your side would be ideal. In addition, the topics are highly signal processing related since that is where I’m from, and as mentioned before, this started off as my own personal notes.
But to conclude, this book is essentially written for beginners and in a way that would maximize the probability of a younger me attaining the present me’s knowledge with minimal time expenditure. I hope y’all find it useful.