Skip to content

Instantly share code, notes, and snippets.

@tonykero
Created October 28, 2020 23:37
Show Gist options
  • Save tonykero/8ceb62868378ee11e36b07f975731d26 to your computer and use it in GitHub Desktop.
Save tonykero/8ceb62868378ee11e36b07f975731d26 to your computer and use it in GitHub Desktop.
## Will successfully install amdgpu drivers and rocm,
## but pointless as there is no gpu device attached to WSL2 (only CUDA and DirectML is supported, not /dev/kfd or amd gpus)
## ROCM/HIP
sudo apt update
sudo apt dist-upgrade
sudo apt install libnuma-dev
wget -q -O - http://repo.radeon.com/rocm/rocm.gpg.key | sudo apt-key add -
echo 'deb [arch=amd64] http://repo.radeon.com/rocm/apt/debian/ xenial main' | sudo tee /etc/apt/sources.list.d/rocm.list
sudo apt update
sudo apt install rocm-dkms
sudo usermod -a -G video $LOGNAME
sudo usermod -a -G render $LOGNAME
## TEST
/opt/rocm/bin/rocminfo
/opt/rocm/opencl/bin/clinfo
## AMDGPU DRIVER
#http://cofal.work/2019/09/27/Ubuntu%E4%B8%8B%E5%AE%89%E8%A3%85ROCm%E8%BF%87%E7%A8%8B/
#https://askubuntu.com/questions/1097030/cant-install-amdgpu-pro-18-40-on-ubuntu-server-18-04-01
sudo apt update && sudo apt install -y build-essential clang clang-format clang-tidy cmake cmake-qt-gui ssh curl apt-utils pkg-config g++-multilib git libunwind-dev libfftw3-dev libelf-dev libncurses5-dev libpthread-stubs0-dev vim gfortran libboost-program-options-dev libssl-dev libboost-dev libboost-system-dev libboost-filesystem-dev rpm build-essential cdbs dh-make dkms execstack dh-modaliases
sudo apt-get install linux-headers-4.15.0-20-generic
sudo apt-add-repository universe
sudo dpkg --add-architecture i386
sudo ./amdgpu-install --opencl=legacy --no-dkms
sudo apt-get -o Dpkg::Options::="--force-overwrite" install amdgpu-dkms
# for amdgpu-pro-install (use previously downloaded files in cache)
amdgpu-uninstall
sudo ./amdgpu-pro-install --opencl=legacy
#https://askubuntu.com/questions/1040474/warning-amdgpu-dkms-failed-for-running-kernel-on-both-16-04-18-04
apt install amdgpu-dkms libdrm-amdgpu-amdgpu1 libdrm-amdgpu1 libdrm2-amdgpu
# ---
sudo apt-get -o Dpkg::Options::="--force-overwrite" dist-upgrade
## TEST
/opt/rocm/bin/rocminfo
/opt/rocm/opencl/bin/clinfo
@tonykero
Copy link
Author

tonykero commented Jul 25, 2023

@NickDeBeenSAE I am really super sorry, I should probably hide or delete this gist, I did not think that someone would actually try my gist.

I did this 3 years ago and never clicked on it again, basically it installs but cannot do anything because as you mentioned it simply just does not work.

My use case at the time was for gpu accelerated machine learning on Windows, with an AMD GPU, but thanks to [PyTorch-DirectML] I don't need it anymore (https://learn.microsoft.com/en-us/windows/ai/directml/gpu-pytorch-windows)

But for SYCL with ROCm platform I think this is still blocking under Windows. (EDIT: actually this may have been my initial use case)

May I ask why are you trying to use ROCm for ?

Again really sorry for your loss of time, try to send a message under a gist to ask if it still works or something....

@NickDeBeenSAE
Copy link

I was unaware that PyTorch-DirectML existed 🤔🤔🤔 hmmmmm. I might try that.

Also, the use case for me when it comes to ROCm and CuDNN/Cuda Tookit would be Game Development and Remastering games via harnessing the full power of my GPU.

@tonykero
Copy link
Author

@NickDeBeenSAE

pytorch_directml is actually very cool: it's how stable diffusion project works on AMD GPUs: https://github.com/search?q=repo%3Alshqqytiger%2Fstable-diffusion-webui-directml%20torch_directml&type=code
(in a fork though)

For Game Development I feel like you could exploit Vulkan Compute Shaders, depends on the flexibility you need for GPGPU programming.

Otherwise, another portable solution with SYCL is DPC++ https://oneapi-src.github.io/oneDNN/v2.5/dev_guide_dpcpp_backends.html, they seem to have an OpenCL backend, didn't test though.

Then apart from that, I'm convinced that nothing is mature, or not fully portable, having to fight with ROCm or CUDA seems a bother to me...
personal preference

I can mention https://github.com/halide/Halide also, which is C++ Centric, but supports a load of backend.

Hope you get what you searched for.

@JavenLiPl
Copy link

ROCm support seems avialable for windows already last month. There might be more people wondering this topic(like me :)), just like nvidia provide a WSL2 based solution for a long time.

BTW, does ROCm windows release make any difference on this topic? I'm totally new to ML and just want to learn.

@timmyz
Copy link

timmyz commented Aug 11, 2023

same here, stuck at the accessing to /dev/kdf

@NickDeBeenSAE
Copy link

same here, stuck at the accessing to /dev/kdf

How the hell did you manage to install the drivers?

@yhd9487
Copy link

yhd9487 commented Nov 15, 2023

ROCm support seems avialable for windows already last month. There might be more people wondering this topic(like me :)), just like nvidia provide a WSL2 based solution for a long time.

BTW, does ROCm windows release make any difference on this topic? I'm totally new to ML and just want to learn.

pytorch and tenserflow did not release any distribution that supports ROCm on Windows right now, ROCm comes to windows is just "come", it did not have any actual support from DL&ML models, I think it still a long way to go.

@Headcrabed
Copy link

Seems amd is working on that wsl2 support now. In rocm 6.0.6 installer, there is a usecase option for wsl2, but I haven't tried that yet.

@codevladimir
Copy link

Seems amd is working on that wsl2 support now. In rocm 6.0.6 installer, there is a usecase option for wsl2, but I haven't tried that yet.

Where did you find 6.0.6 installer? I only see 6.0.2. I would like to test that out and see if it works

@Headcrabed
Copy link

Seems amd is working on that wsl2 support now. In rocm 6.0.6 installer, there is a usecase option for wsl2, but I haven't tried that yet.

Where did you find 6.0.6 installer? I only see 6.0.2. I would like to test that out and see if it works

https://rocm.docs.amd.com/projects/install-on-linux/en/latest/tutorial/quick-start.html

However apt reports can't locate hsa-runtime-rocr4wsl-amdgpu, so I think it is not opened to public now. Maybe we could see it working in rocm 6.1?

@yzsshen
Copy link

yzsshen commented Apr 4, 2024

I'm getting the same issue, is there a way to list all --usecase options?
sudo amdgpu-install --list-usecase has an option for wsl:

wsl             (for using ROCm in a WSL context)
  - ROCr WSL runtime library (Ubuntu 22.04 only)

sudo amdgpu-install --usecase=wsl gives me this:

Hit:1 https://repo.radeon.com/amdgpu/6.0.2/ubuntu jammy InRelease
Hit:2 http://archive.ubuntu.com/ubuntu jammy InRelease              
Hit:3 http://security.ubuntu.com/ubuntu jammy-security InRelease    
Get:4 https://dl.modular.com/public/installer/deb/ubuntu jammy InRelease [3672 B]
Hit:5 https://repo.radeon.com/rocm/apt/6.0.2 jammy InRelease                   
Hit:6 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:7 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Fetched 3672 B in 0s (8270 B/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package hsa-runtime-rocr4wsl-amdgpu

So the wsl option seems to be mapped to hsa-runtime-rocr4wsl-amdgpu. Do you think there's an error in the package name it's mapped to?

@Headcrabed
Copy link

I'm getting the same issue, is there a way to list all --usecase options? sudo amdgpu-install --list-usecase has an option for wsl:

wsl             (for using ROCm in a WSL context)
  - ROCr WSL runtime library (Ubuntu 22.04 only)

sudo amdgpu-install --usecase=wsl gives me this:

Hit:1 https://repo.radeon.com/amdgpu/6.0.2/ubuntu jammy InRelease
Hit:2 http://archive.ubuntu.com/ubuntu jammy InRelease              
Hit:3 http://security.ubuntu.com/ubuntu jammy-security InRelease    
Get:4 https://dl.modular.com/public/installer/deb/ubuntu jammy InRelease [3672 B]
Hit:5 https://repo.radeon.com/rocm/apt/6.0.2 jammy InRelease                   
Hit:6 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:7 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Fetched 3672 B in 0s (8270 B/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package hsa-runtime-rocr4wsl-amdgpu

So the wsl option seems to be mapped to hsa-runtime-rocr4wsl-amdgpu. Do you think there's an error in the package name it's mapped to?

Maybe it is just not ready for wsl yet, and will release in future versions?

@incense
Copy link

incense commented Apr 22, 2024

Same error with ROCm 6.1.
Opened an issue here: https://github.com/ROCm/ROCm/issues/3051

@unclemusclez
Copy link

where is this damn mythical hsa-runtime-rocr4wsl-amdgpu ???

@Headcrabed
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment