====== Ubuntu - GPU - AMD GPU - Setup - Setup using the AMD Installer Script ====== The AMD Installer Script method automates the installation process for the AMDGPU stack. * The installer script handles the complete installation process, including setting up the repository, cleaning the system, updating, and installing the desired drivers and meta-packages. * This supports even the very latest navi 31 GPUs, such as the Radeon RX 7900 xtx. ---- ===== Download the AMD Installer Script ===== **NOTE:** Check the latest version number of the Installer Script by checking the .deb file link from https://www.amd.com/en/support/linux-drivers. sudo apt update wget https://repo.radeon.com/amdgpu-install/22.40.5/ubuntu/jammy/amdgpu-install_5.4.50405-1_all.deb **NOTE:** The installer package is updated periodically to resolve known issues and add new features. * The links for each Linux distribution always point to the latest available build. ---- ===== Uninstall the previous AMDGPU Stack (optional) ===== [[Ubuntu:GPU:AMD GPU:Setup:Uninstall the AMDGPU stack|Uninstall the AMDGPU stack]]. **NOTE:** This is recommended. ---- ===== Install the AMD Installer Script ===== sudo apt install ./amdgpu-install_5.4.50405-1_all.deb **NOTE:** Check the latest version number of the Installer Script by checking the .deb file link from https://www.amd.com/en/support/linux-drivers. ---- ===== Install the AMDGPU Stack ===== amdgpu-install --usecase=graphics,opencl --vulkan=amdvlk --opencl=rocr --no-dkms **NOTE:** This chooses to install various optional elements, such as opencl with rocr and vulkan. * See: https://amdgpu-install.readthedocs.io/en/latest/index.html * The **pro** option, used with **vulkan** requires AMD EULA to be accepted. * If this is not wanted, then remove this **pro** choice, which will use the Community version. * amdgpu-install --usecase=graphics,opencl --vulkan=amdvlk,pro --opencl=rocr * Various options can be selected. * See [[Ubuntu:GPU:AMD GPU:Setup:Setup using the AMD Installer Script:Install options|Install options]]. * See [[Ubuntu:GPU:AMD GPU:Setup:Setup using the AMD Installer Script:Use case options|Use case options]]. * **--no-dkms**: To turn of dkms, as this sometimes causes problems. Optionally keep dkms by removing this option. ---- ===== Enable the AMD Kernel Module ===== Ensure there is no modprobe blacklist for amdgpu. sudo rm /etc/modprobe.d/blacklist-amdgpu.conf ---- ===== Configure Group Access ===== Add the user to the **video** group usermod -a -G video username Add the user to the **render** group usermod -a -G render username **NOTE:** This is an alternative method to configure group access: sudo usermod -a -G render,video $LOGNAME ---- ===== Optionally, install fresh firmware files ===== Grab the latest firmware from https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git. Drop these firmware files into **/lib/firmware/amdgpu/** and rebuild any initramfs: wget https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/snapshot/linux-firmware-20230515.tar.gz tar -xf linux-firmware-20230515.tar.gz sudo cp linux-firmware-20230515/amdgpu/* /lib/firmware/amdgpu/ sudo update-initramfs -uk 'all' **NOTE:** The latest firmware files should probably provide support for newer GPUs. ---- ===== Check that the GPU is being picked up ===== sudo apt update sudo apt install mesa-utils glxinfo | grep OpenGL returns: OpenGL vendor string: AMD OpenGL renderer string: Radeon RX 7900 XTX (gfx1100, LLVM 15.0.3, DRM 3.48, 5.19.0-43-generic) OpenGL core profile version string: 4.6 (Core Profile) Mesa 22.3.0-devel OpenGL core profile shading language version string: 4.60 OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile OpenGL core profile extensions: OpenGL version string: 4.6 (Compatibility Profile) Mesa 22.3.0-devel OpenGL shading language version string: 4.60 OpenGL context flags: (none) OpenGL profile mask: compatibility profile OpenGL extensions: OpenGL ES profile version string: OpenGL ES 3.2 Mesa 22.3.0-devel OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20 OpenGL ES profile extensions: **NOTE:** This should show useful info on the GPU. * Mesa is the open source implementations of OpenGL and Vulkan that AMD GPU users typically use. ---- ===== Test the GPU ===== glxgears -info **NOTE:** This should show some gears spinning around, together with frames per second. ---- ===== Optionally, Purge nvidia drivers ===== Remove the Nvidia packages and any Nvidia related kernel arguments you might have (DRM Kernel Mode Setting or whatever). sudo dpkg -P $(dpkg -l | grep nvidia-driver | awk '{print $2}') **NOTE:** The Nvidia drivers will not load if there is no Nvidia card installed. * Leaving the NVIDIA stack installed ensures that it is ready if you ever need to switch to a backup GPU in a hurry. ---- ===== Optionally, setup environment variables for hardware acceleration ===== # For VDPAU export VDPAU_DRIVER=radeonsi # For VA-API export LIBVA_DRIVER_NAME=radeonsi # For GPU Vulkan Support, if the non-pro driver is used. export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/radeon_icd.x86_64.json:/usr/share/vulkan/icd.d/radeon_icd.i686.json # For GPU Vulkan Support, if the pro driver is used. export VK_ICD_FILENAMES=/opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd64.json **NOTE:** These are only needed if these processes do not function correctly. * To allow these to be there permanently, upon boot, place into **~/.bashrc** or **~/.profile**. ---- ===== Optionally, Xorg configuration ===== If using Xorg. Xorg will automatically load the driver and it will use the monitors EDID to set the native resolution. * Configuration is only required for tuning the driver. * If you want manual configuration, create **/etc/X11/xorg.conf.d/20-amdgpu.conf**, and add the following: Section "OutputClass" Identifier "AMD" MatchDriver "amdgpu" Driver "amdgpu" EndSection ---- ===== References ===== https://repo.radeon.com/amdgpu-install/ https://www.amd.com/en/support/linux-drivers https://amdgpu-install.readthedocs.io/en/latest/ https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git https://rocm.docs.amd.com/en/latest/index.html https://wiki.archlinux.org/title/AMDGPU