Getting RocM working on Fedora Core 31

Put your Vanilla code here

Getting RocM working on Fedora Core 31

Postby hbyte » Tue Oct 25, 2022 3:49 pm

RocM is really hard to get working. But here is a nice guide to follow if you have Fedora or can spare some space on your drive. Its well worth it as RocM being AMD's answer to CUDA can be used to run:

PlaidML through OpenCL (Really fast!!!)

Pytorch using RocM on your GPU

And you can compile and run HIP code which is almost the same as CUDA.

Also recent versions of RocM 5.2 onwards are compatable with the NAVI graphics cards albeit without the support of MIOPEN (An optimizer for RoCM for each GPU)

Ok start by installing Fedora 31.

Boot in then run an update using

Code: Select all
sudo dnf update


This should upgrade your kernel from 5.3 to 5.8 (Ok reboot now with your new kernel)

Code: Select all
sudo reboot


Ok now I gleemed this online from various sources because the Fedora install and the amd install methods all break.

Use instead either the Redhat EL8 repos or the Centos8 repos by doing the following(I used Centos):

Code: Select all
sudo tee /etc/yum.repos.d/ROCm.repo <<EOF
  [ROCm]
  name=ROCm
  baseurl=http://repo.radeon.com/rocm/centos8/rpm
  enabled=1
  gpgcheck=1
  gpgkey=http://repo.radeon.com/rocm/rocm.gpg.key
  EOF


Ok and here are the installs for rocm you need to edit the rocm_agent_enumerator
to work with fedoras python.

This will do that and install everything you need.

Code: Select all
sudo dnf install rocm-device-libs hsakmt-roct hip-samples hipify-clang
   
   dnf repoquery --location rocminfo
   
   sudo rpm -Uvh --nodeps http://repo.radeon.com/rocm/centos8/rpm/rocminfo-1.0.0.50200-65.el8.x86_64.rpm
   
   sudo sed -i 's/^#!.*/#!\/usr\/bin\/python/' /opt/rocm-5.2.0/bin/rocm_agent_enumerator
 
   sudo dnf install hsa-amd-aqlprofile
 
   sudo dnf install rocm-opencl rocm-opencl-devel

   sudo dnf hip-runtime-amd5.2.0.x86_64 



Also and I nearly forgot to mention if you are using a NAVI gpu card like mine is RX 5500 XT or something similar it will say NAVI 10 when you do
Code: Select all
lspci


Then you should do this so that ROCM works in pytorch:

Install Pytorch with ROCM

Code: Select all
pip install torch torchvision --extra-index-url https://download.pytorch.org/whl/rocm5.1.1


And for NAVI cards,

Code: Select all
export HSA_OVERRIDE_GFX_VERSION=10.3.0


This should make RoCM work on your machine!!

Now follow these instructions to run StableDiffusion in a WebGui on your AMD gpu under Fedora:

https://github.com/AUTOMATIC1111/stable ... n-AMD-GPUs
hbyte
Site Admin
 
Posts: 80
Joined: Thu Aug 13, 2020 6:11 pm

Return to Python and ML

Who is online

Users browsing this forum: No registered users and 46 guests

cron