guilt/ROCM-Programming-Masterclass
Udemy's CUDA programming Masterclass with Examples in ROCM/HIP.
ROCM/HIP Programming Masterclass
What is It?
CUDA Examples but ported to work with ROCM/HIP.
Installation
This repository requires an AMD GPU and preferably ROCM 5.4.x or higher toolchain
to run. See ROCM Documentation on how to get started.
Legacy Method for Docker Installation
When I tried installing it on some distributions, AMD ROCM's Installer was giving me
a hard time. To that goal, I had simplified some of the steps required to launch this
on any Linux Distribution, worked with AMD's ROCM Examples
and supplied patches to make it easy to anybody to build and run it.
This documentation was written before AMD created official Docker Images.
Follow the Documentation on the Docker Hub or ROCM Documentation Instead. This method is
for those who have the penchant for more pain:
-
Ensure you have the
amdgpudriver and the card running on your Linux Distribution. Verify
that it shows up in thelsmodcommand. You will need all theGPU Firmwareto be in/lib/firmware
in order for the whole shebang to run well. -
Install Docker on your Linux Distribution.
-
Scroll down to the steps found in this GitHub Gist. Use the
Scripts given to get your Docker running. -
Download the scripts from the Gist and build the
rocm-examplescontainer. -
Git clone this repository on your computer. From within this directory, run:
./Scripts/launch-hipmc.sh-
You will be in a Docker Container named
hip-examplesand with everything
ready to go. You will see this Git repository mounted/workspace/hip-examples
and this README within it. -
Now you can get to work, follow the course.
Compiling
For most programs, you just run hipcc. The invocation is very
similar to nvcc.
cd 01-Hello
hipcc -o 01-Hello.out 01-Hello.hip \
-I ../Common ../Common/*.cpp ../Common/*.hip
./01-Hello.outThings like rocprof are there to profile those applications, but do not have the
same amount of robustness as nvprof.
For most CUDA API calls, most things are cu or cuda replaced by hip. I've
ported the cudaCommon.cu[h] to hipCommon.hip[h] in the Common/ directory.
Why all this Effort?
I currently do not have a CUDA compatible card. During the pandemic, the
NVIDIA card prices were insane due to the miners. I ended up getting a
RX 6900XT at sale price (wasn't cheap either). Hence, I decided to
make the best of this course.
The next thing is that in order to really learn something, typing the
whole thing out by hand helps. Despite the best efforts needed to run
most CUDA code as-is on HIP, doing it manually is indeed helping me
learn most calls well.
So if you are taking that course, you need to ideally create your own
repo. In case you do get stuck, this one will be your reference.
Thank You and Feedback
This code is in no way perfect or bug-free. Pull requests
welcome.
Reach out to me for any feedback.
Now Enjoy!
- Author: Karthik Kumar Viswanathan
- Web : https://karthikkumar.org
- Email : me@karthikkumar.org