Ask HN: Best way to learn GPU programming?
I'd like to learn GPU programming but I'm having difficulty finding high-quality resources. I tried a class at coursera and was severely disappointed by both quality and content.
What are the best resources for learning things like GPU architecture, CUDA, Triton, etc?
My goal is to do be able to do something like take a description of Flash Attention and implement it from scratch, or optimize existing CUDA code.
10 comments
[ 2.7 ms ] story [ 39.2 ms ] threadhttps://juliagpu.org/
I've written CUDA kernels and I knew nothing about it going in.
The Nvidia dev blog has some easy to follow tutorials, but they don’t get very complicated.
Nvidia also has a learning platform which offers fairly decent courses at a cost. You get a certificate for finishing.
You’ll find some books out there with good reputations. Ultimately, this is an area that leans heavily toward paying money for good quality learning materials.
The course you are referring to is instructor-led and costs $10,000 to have them set up, for up to 20 people.
If you like lecture videos, I would recommend Hajj's YouTube playlist of 2021 lectures [2]. He works through a subset of the textbook.
This will give you a good foundation of GPU hardware architecture and CUDA programming. The knowledge is somewhat transferable to other areas of high-performance computing.
[1] https://www.amazon.com/Programming-Massively-Parallel-Proces...
[2] https://www.youtube.com/playlist?list=PLRRuQYjFhpmubuwx-w8X9...
It’s vendor agnostic, so HLSL instead of CUDA or Triton. Here’s the compute shaders implementing inference of Mistral-7B model: https://github.com/Const-me/Cgml/tree/master/Mistral/Mistral...
Step 2: Figure out how to set up the FFI bindings if required for your project's language.
Step 3: Read this article to learn kernel syntax, block/thread/stride management etc: https://developer.nvidia.com/blog/even-easier-introduction-c...
Step 4: Ask ChatGPT to translate your code into modern C++, or perhaps even directly into Kernels
Don't bother with Vulkan compute and shaders etc. It works, but is high friction compared to CUDA.
I would say ML concepts and algorithms are way more complicated than GPU programming per se. The fast.ai lectures were pretty understandable when I watched some of them a few years ago, but attention wasn't yet invented, and it was pretty obvious that it would take a fair amount of trial and error to become skilful at writing simple recognizers.