8 min read
3 days ago
--
I spent about three weeks last year trying to get a PyTorch model to train on an AMD GPU. I had the hardware, I had the code, I had the data. What I didn’t have was a working ROCm setup that didn’t randomly crash every four hours. I got it working eventually, but the whole experience taught me more about how GPU compute actually works than any tutorial ever did.
Access without a medium partner here: AMD ROCm vs Nvidia CUDA
Press enter or click to view image in full size
So here’s what I wish someone had explained to me before I started what CUDA and ROCm are, why they exist, how they’re different, and when you should care about one versus the other.
What’s Actually Happening When a GPU Does AI Work
Before I get into the two platforms, let me explain the basic idea. When you train a neural network or run inference on one — you’re doing a massive number of matrix multiplications. Like, billions of them. Your CPU can do this, but it’s slow because a CPU has maybe 16 or 32 cores that do things one after another. A GPU has thousands of smaller cores that can do lots of things at the same time.
But the GPU doesn’t just magically know how to run your Python code. You need a layer of software sitting between your PyTorch or TensorFlow code and the actual GPU hardware…
