AMD GPU: Difference between revisions

From NixOS Wiki
imported>Jiehong
No edit summary
imported>Jiehong
No edit summary
Line 23: Line 23:
== OpenCL ==
== OpenCL ==


For any AMD GCN graphics card, add this to your hardware-configuration.nix:
Add this to your hardware-configuration.nix:


<syntaxhighlight lang="nix">
<syntaxhighlight lang="nix">
hardware.opengl.extraPackages = with pkgs; [
hardware.opengl.extraPackages = with pkgs; [
   rocm-opencl-icd  # NixOS Unstable
   rocm-opencl-icd  # NixOS Unstable
   amdappsdk  # NixOS 20.03
   amdappsdk  # NixOS 20.03, uses the CPU, not the GPU
];
];
</syntaxhighlight>
</syntaxhighlight>


You should also install the clinfo package to verify that Open CL is correctly setup (or check in the program you use to see if it is now available, such as in Darktable).
You should also install the clinfo package to verify that Open CL is correctly setup (or check in the program you use to see if it is now available, such as in Darktable).

Revision as of 12:09, 20 September 2020


This guide is about setting up NixOS to correctly use your Amd Graphics card if it is relatively new (aka, after the GCN architecture).

Make the kernel use the correct driver early

The kernel can load the correct driver right away (in hardware-configuration.nix):

boot.initrd.kernelModules = [ "amdgpu" ];

XServer

Make sure Xserver uses the `amdgpu` driver in your configuration.nix:

services.xserver.enable = true;
services.xserver.videoDrivers = [ "amdgpu" ];


OpenCL

Add this to your hardware-configuration.nix:

hardware.opengl.extraPackages = with pkgs; [
   rocm-opencl-icd  # NixOS Unstable
   amdappsdk  # NixOS 20.03, uses the CPU, not the GPU
];

You should also install the clinfo package to verify that Open CL is correctly setup (or check in the program you use to see if it is now available, such as in Darktable).