Hello, I was attempting to enable CUDA rendering in Blender and was told that no compatible GPU’s could be found. To verify whether my GPU was being used at all I installed and attempted to use nvtop (nvtop
from nixpkgs), and it tells me that there is no GPU to monitor.
lspci | grep VGA
verifies that the GPU does exist:
lspci | grep VGA
0a:00.0 VGA compatible controller: NVIDIA Corporation TU104 [GeForce RTX 2080 SUPER] (rev a1)
Elsewhere it is explained that Blender uses CUDA toolkit to access the GPU, and perhaps the same is true for nvtop, I have installed cudatoolkit
in my config with:
{ config, lib, pkgs, ... }: {
environment.systemPackages = with pkgs.cudaPackages; [ cudatoolkit cudnn ];
}
Per the wiki I have the following configuration for my GPU:
{ config, lib, pkgs, ... }:
{
# See https://nixos.wiki/wiki/Nvidia
services.xserver.videoDrivers = [
"nvidia" # https://github.com/NixOS/nixpkgs/issues/80936#issuecomment-1003784682
];
hardware = {
opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
nvidia = {
# Modesetting is needed for most wayland compositors
modesetting.enable = true;
# Use the open source version of the kernel module
open = true;
# Enable the nvidia settings menu
nvidiaSettings = true;
# Optionally, you may need to select the appropriate driver version for your specific GPU.
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
};
}
I had services.xserver.videoDrivers = [ "nouveau" ]
swapped to [ "nvidia" ]
to no change. I also tried commenting out the hardware.nvidia.open
and it also had no change.
I have tried the following three configurations for the blender
package:
{ config, lib, pkgs, ... }: {
environment.systemPackages = with pkgs; [ blender ];
}
{ config, lib, pkgs, ... }: {
environment.systemPackages = with pkgs; [ blender ];
# https://github.com/NixOS/nixpkgs/issues/7582
nixpkgs.config.packageOverrides = self: rec {
blender = self.blender.override { cudaSupport = true; };
};
}
{ config, lib, pkgs, ... }: {
environment.systemPackages = with pkgs; [ blender ];
# https://discourse.nixos.org/t/how-to-get-cuda-working-in-blender/5918/3
nixpkgs = {
overlays = [
(final: prev: {
blender = prev.blender.override { cudaSupport = true; };
})
];
};
}
None of which have worked. edolstra suggests using the blender-bin
flake, but I do not understand his answer. If I switch the above listed configuration to the code he suggests it errors, which indicates to me that I am misunderstanding how he is intending his solution to be implemented.
The reason I post this here, as against posting an issue on nixpkgs, is that this seems to not be contained to a single package, such as Blender, I have had problems in the past with using my GPU for tensorflow via python.
For completeness here is my neofetch output (if it is of use):
neofetch
▗▄▄▄ ▗▄▄▄▄ ▄▄▄▖ liquidzulu@NixOS
▜███▙ ▜███▙ ▟███▛ ----------------
▜███▙ ▜███▙▟███▛ OS: NixOS 23.05.20230619.ad157fe (Stoat) x86_64
▜███▙ ▜██████▛ Host: ASUSTeK COMPUTER INC. CROSSHAIR VI HERO
▟█████████████████▙ ▜████▛ ▟▙ Kernel: 6.1.34
▟███████████████████▙ ▜███▙ ▟██▙ Uptime: 28 mins
▄▄▄▄▖ ▜███▙ ▟███▛ Packages: 2264 (nix-system), 5518 (nix-user), 16 (flatpak)
▟███▛ ▜██▛ ▟███▛ Shell: fish 3.6.1
▟███▛ ▜▛ ▟███▛ Resolution: 2560x1080, 1920x1080
▟███████████▛ ▟██████████▙ DE: Plasma
▜██████████▛ ▟███████████▛ WM: KWin
▟███▛ ▟▙ ▟███▛ Icons: breeze-dark [GTK2/3]
▟███▛ ▟██▙ ▟███▛ Terminal: kitty
▟███▛ ▜███▙ ▝▀▀▀▀ Terminal Font: monospace 14.0
▜██▛ ▜███▙ ▜██████████████████▛ CPU: AMD Ryzen 5 1500X (8) @ 3.500GHz
▜▛ ▟████▙ ▜████████████████▛ GPU: NVIDIA GeForce RTX 2080 SUPER
▟██████▙ ▜███▙ Memory: 4311MiB / 64243MiB
▟███▛▜███▙ ▜███▙
▟███▛ ▜███▙ ▜███▙
▝▀▀▀ ▀▀▀▀▘ ▀▀▀▘