# GPU Linux

## About GPU Linux

GPU Linux is a documentation project designed to simplify the installation, configuration, and optimization of GPU drivers on Linux, providing essential information in an easily accessible format. It serves as a reliable resource for gaming, video editing, and high-performance computing. This documentation is a free, collaborative, and open project, continuously enhanced through contributions from the community. All ideas, suggestions, corrections, and improvements are welcome. To contribute to the project, join the Telegram group: <https://t.me/+bRjQVsxdB-dhZWFh>. Document: <https://gpulinux.gitbook.io/gpulinux/>

## AMD

### Drivers Resume

| Driver |                 AMD                |                 Open Source                 |
| :----: | :--------------------------------: | :-----------------------------------------: |
| OpenGL |    AMD PRO OpenGL Driver (OGLP)    |              Mesa OpenGL Driver             |
| OpenCL | ROCr (Radeon Open Compute Runtime) | Mesa OpenCL ICD (Installable Client Driver) |
| Vulkan |            AMDVLK / PRO            |                     RADV                    |

### AMD Drivers

Access <https://www.amd.com/en/support/download/linux-drivers.html>, download and install the  *amdgpu-install* package.

Usage:\
amdgpu-install --usecase=\<options> --opengl=\<options> --opencl=\<options> --vulkan=\<options>

For more information: $amdgpu-install --help

If --usecase option is not present, the default selection is "dkms,graphics,opencl,hip".

| --usecase=   | Description                                                                                                                                                                                 | Application                                                          |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
| dkms         | <ul><li>Kernel mode driver (included in all usecases)</li></ul>                                                                                                                             | to only install the kernel mode driver                               |
| graphics     | <ul><li>Open source Mesa 3D graphics and multimedia libraries</li></ul>                                                                                                                     | for users of graphics applications                                   |
| multimedia   | <ul><li>Open source Mesa 3D multimedia libraries</li></ul>                                                                                                                                  | for users of open source multimedia                                  |
| workstation  | <ul><li>Open source multimedia libraries</li><li>Closed source (legacy) OpenGL</li></ul>                                                                                                    | for users of legacy WS applications                                  |
| rocm         | <ul><li>OpenCL (ROCr/KFD based) runtime</li><li>HIP runtimes</li><li>Machine learning framework</li><li>All ROCm libraries and applications</li></ul>                                       | for users and developers requiring full ROCm stack                   |
| wsl          | <ul><li>ROCr WSL runtime library (Ubuntu 22.04 only)</li></ul>                                                                                                                              | for using ROCm in a WSL context                                      |
| rocmdev      | <p></p><ul><li>HIP runtimes</li><li>OpenCL runtime</li><li>Profiler, Tracer and Debugger tools</li></ul>                                                                                    | for developers requiring ROCm runtime and profiling/debugging tools  |
| rocmdevtools | <ul><li>Profiler, Tracer and Debugger tools</li></ul>                                                                                                                                       | for developers requiring ROCm profiling/debugging tools              |
| amf          | <ul><li>AMF closed source multimedia library</li></ul>                                                                                                                                      | for users of AMF based multimedia                                    |
| lrt          | <ul><li>ROCm Compiler and device libraries</li><li>ROCr runtime and thunk</li></ul>                                                                                                         | for users of applications requiring ROCm runtime                     |
| opencl       | <ul><li>ROCr based OpenCL</li><li>ROCm Language runtime</li></ul>                                                                                                                           | for users of applications requiring OpenCL on Vega or later products |
| openclsdk    | <ul><li>ROCr based OpenCL</li><li>ROCm Language runtime</li><li>Development and SDK files for ROCr based OpenCL</li></ul>                                                                   | for application developers requiring ROCr based OpenCL               |
| hip          | <ul><li>HIP runtimes</li></ul>                                                                                                                                                              | for users of HIP runtime on AMD products                             |
| hiplibsdk    | <ul><li>HIP runtimes</li><li>ROCm math libraries</li><li>HIP development libraries</li></ul>                                                                                                | for application developers requiring HIP on AMD products             |
| openmpsdk    | <ul><li>OpenMP runtime and devel packages</li></ul>                                                                                                                                         | for users of openmp/flang on AMD products                            |
| mllib        | <ul><li>MIOpen hip/tensile libraries</li><li>Clang OpenCL</li><li>MIOpen kernels</li></ul>                                                                                                  | for users executing machine learning workloads                       |
| mlsdk        | <ul><li>MIOpen development libraries</li><li>Clang OpenCL development libraries</li><li>MIOpen kernels</li></ul>                                                                            | for developers executing machine learning workloads                  |
| asan         | <p></p><ul><li>ASAN enabled OpenCL (ROCr/KFD based) runtime</li><li>ASAN enabled HIP runtimes</li><li>ASAN enabled Machine learning framework</li><li>ASAN enabled ROCm libraries</li></ul> | for users of ASAN enabled ROCm packages                              |

| --opengl= | Description                                                                                | Compatibility                                                                                                                                                                                                                                                   |
| --------- | ------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| mesa      | <ul><li>Installs the open-source Mesa 3D driver, widely used for OpenGL support.</li></ul> | <ul><li>It is recommended for users who want stable and reliable performance in desktop applications and games, especially on modern Linux systems.</li><li>Suitable for most modern AMD GPUs.</li></ul>                                                        |
| oglp      | <ul><li>An OpenGL driver intended for cloud or other specific applications. </li></ul>     | <ul><li>Used in specific configurations for cloud computing or other needs that require a customized OpenGL implementation.</li><li>It is available only for Ubuntu 20.04. Not recommended or needed for general users or for Ubuntu 24.04 or higher.</li></ul> |

| --opencl= | Description                      | Compatibility                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| --------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| rocr      | <p>ROCr/KFD based OpenCL<br></p> | Modern GPUs: For GPUs based on GCN 3.0 (Fiji) architectures or later (such as Polaris, Vega, RDNA, etc.).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| legacy    | DEPRECATED                       | <p>This option should be used for GPUs based on the following architectures:</p><ul><li><p><strong>Southern Islands (SI)</strong>:</p><ul><li>Radeon HD 7000 Series.</li><li>GPUs such as HD 7750, HD 7770, HD 7850, HD 7870, HD 7950, HD 7970.</li></ul></li><li><p><strong>Sea Islands (CI)</strong>:</p><ul><li>Radeon HD 8000 Series.</li><li>GPUs such as HD 8350, HD 8490, HD 8570, HD 8770, HD 8870.</li></ul></li><li><p><strong>APUs and GPUs prior to full ROCr support</strong>:</p><ul><li>AMD APUs based on Kaveri, Kabini, or older architectures.</li><li>Integrated GPUs such as Radeon R5/R7 prior to the Vega series.</li></ul></li></ul> |

| --vulkan= | Description                                                                                                                                                                                                                                                                                                                                                  | Compatibility                                                                                                                                                                                                                                                                                                                                    |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| amdvlk    | <p>AMD open source implementation</p><ul><li>Installs the AMD open-source Vulkan implementation.</li><li>Suitable for users who prefer open-source drivers and compatibility with Vulkan-based applications and games.</li><li>Recommended for most use cases on Linux where AMD Vulkan drivers are needed and open-source stability is preferred.</li></ul> | <ul><li>AMD Radeon™ RX 7000</li><li>AMD Radeon™ RX 6000</li><li>AMD Radeon™ VII AMD</li><li>Radeon™ RX 5000 AMD</li><li>Radeon™ RX Vega AMD</li><li>Radeon™ RX 500 AMD</li><li>Radeon™ RX 400 AMD</li><li>Radeon™ R9 Fury / Fury X / Nano</li><li>AMD Radeon™ R9 360 / 380 / 380X / 390 / 390X</li><li>AMD Radeon™ R9 285 / 290 / 290X</li></ul> |
| pro       | <p>AMD closed source implementation</p><ul><li>Installs the AMD closed-source Vulkan implementation.</li><li>Provides optimized Vulkan performance for specific applications and workloads.</li><li>Typically used in professional or enterprise contexts where performance is a critical factor and the closed-source driver is better supported.</li></ul> | <ul><li>AMD Radeon™ PRO W7000</li><li>AMD Radeon™ PRO W6000</li><li>AMD Radeon™ PRO VII</li><li>AMD Radeon™ PRO W5000</li><li>Radeon™ PRO WX x200</li><li>Radeon™ PRO WX x100</li><li>Radeon™ PRO AMD</li><li>Radeon™ Pro Duo</li><li>FirePro™ Wx100</li><li>FirePro™ Wx000</li></ul>                                                            |

### Open Source Drivers

* OpenGL\
  $sudo apt install mesa-va-drivers libgl1-mesa-dri libgbm1 mesa-utils
* OpenCL\
  $sudo apt install mesa-opencl-icd ocl-icd-libopencl1 clinfo
* Vulkan\
  $sudo apt install mesa-vulkan-drivers vulkan-tools

### Examples

* For video editing:\
  $sudo amdgpu-install --usecase=graphics,multimedia,opencl,amf,hip,rocm --opengl=mesa --opencl=rocr --vulkan=amdvlk\
  $sudo apt install mesa-utils clinfo vulkan-tools
* For gaming:\
  $sudo amdgpu-install --usecase=graphics --opengl=mesa\
  $sudo apt install mesa-va-drivers libgl1-mesa-dri libgbm1 mesa-utils\
  $sudo apt install mesa-opencl-icd ocl-icd-libopencl1 clinfo\
  $sudo apt install mesa-vulkan-drivers vulkan-tools

### Settings

* Add permission for Render/Video\
  $sudo usermod -a -G render,video $LOGNAME
* Include in \~/.bashrc\
  export LD\_LIBRARY\_PATH=/opt/amdgpu/lib/x86\_64-linux-gnu:$LD\_LIBRARY\_PATH\
  export PATH=/opt/amdgpu/bin:$PATH

### Utilities

* Check OpenGL: $glxinfo | grep OpenGL
* Check OpenGL: $xeglgears
* Check OpenCL: $clinfo
* Check Vulkan: $vulkaninfo | grep "GPU"

### References

* Linux® Drivers for AMD Radeon™ and Radeon PRO™ Graphics\
  <https://www.amd.com/en/support/download/linux-drivers.html>&#x20;
* Radeon™ Software for Linux® Installation\
  <https://amdgpu-install.readthedocs.io/en/latest/preamble.html>

## Intel

\<missing>

## NVIDIA

\<missing>

## Video Editing

### Codecs & Plugins

$sudo apt install lsp-plugins alsa-utils lmms libxine2-plugins gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav libvdpau-va-gl1 libx264-dev libx265-dev libavcodec-extra ffmpeg ubuntu-restricted-extras

### DaVinci Resolve

* This repo allows you to package DaVinci Resolve as a Flatpak for use on Linux Flatpak based systems, especially e.g. Fedora Silverblue where there aren't easier installation options.\
  <https://github.com/pobthebuilder/resolve-flatpak>
* Install DaVinci Resolve or DaVinci Resolve Studio on Debian (convert .run in .deb)\
  <https://www.danieltufvesson.com/makeresolvedeb>
* DaVinci Resolve on Linux (Debian) - with media tips\
  <https://github.com/flolu/davinci-resolve-linux>

### Kdenlive

\<missing>

### Blender

* ZLUDA is a drop-in replacement for CUDA on non-NVIDIA GPU. ZLUDA allows to run unmodified CUDA applications using non-NVIDIA GPUs with near-native performance.\
  <https://github.com/vosen/ZLUDA>

## Updates

\[2024.12.24] Shaba Piffer: First Version; About, AMD, Video Editing, Updates.

\[YYYY.MM.DD] Name: Updates.
