!eWOErHSaiddIbsUNsJ:nixos.org

NixOS CUDA

312 Members
CUDA packages maintenance and support in nixpkgs | https://github.com/orgs/NixOS/projects/27/ | https://nixos.org/manual/nixpkgs/unstable/#cuda61 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
28 Jun 2024
@titus-von-koeller:matrix.orgTitus *

Hey! I just started using NixOS and I love it but have a MAJOR blocker, as I'm maintaining a FOSS deep learning package and can't get CUDA to work :( I would really love to continue on this journey and also eventually contribute to this community here, but right now it feels like I just shot myself in the foot badly, as I've spent the last days exclusively configuring NixOS only to reach a point which is seemingly unsurmountable for me.. The issue seems to be that PyTorch doesn't find the CUDA driver and what's also weird is that nvidia-smi seems to work fine, but shows CUDA Version: ERR!

The thing is that in order to work with my collaborators, I need to work in a non NixOS way, in my case I would like to use pixi which is very much like conda/micromamba, just better.. Therefore, I'm trying to get things working in an FHS shell. Does one of you have an idea? Am I doing anything obvious wrong?

from my configuration.nix

  hardware.opengl = {
    enable = true;
    driSupport = true;
    driSupport32Bit = true;
  };


  # Allow unfree packages
  nixpkgs.config.allowUnfree = true;
  services.xserver.videoDrivers = ["nvidia"];

  hardware.nvidia = {
    modesetting.enable = true;
    powerManagement.enable = false;
    powerManagement.finegrained = false;
    open = false;
    package = config.boot.kernelPackages.nvidiaPackages.beta;
  };

pixi-fhs.nix


{ pkgs, unstable }:

let
cudatoolkit = pkgs.cudaPackages.cudatoolkit\_12\_1;
nvidia\_x11 = pkgs.nvidia\_x11;
in
pkgs.buildFHSUserEnv {
name = "pixi-env";
targetPkgs = pkgs: with pkgs; \[
unstable.pixi
cudatoolkit
nvidia\_x11
# bashInteractive
# bash-completion
# complete-alias
\];
runScript = "bash";
profile = ''
export NVIDIA\_DRIVER\_CAPABILITIES=compute,utility
export XDG\_CONFIG\_DIRS=${nvidia\_x11}/share/X11/xorg.conf.d''${XDG\_CONFIG\_DIRS:+:}$XDG\_CONFIG\_DIRS
export XDG\_DATA\_DIRS=${nvidia\_x11}/share''${XDG\_DATA\_DIRS:+:}$XDG\_DATA\_DIRS

export LD_LIBRARY_PATH=${cudatoolkit}/lib:${cudatoolkit}/lib64:${cudatoolkit}/lib64/stubs''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH
export CUDA_PATH=${cudatoolkit}
export PATH=${cudatoolkit}/bin:$PATH
export LIBRARY_PATH=${cudatoolkit}/lib:${cudatoolkit}/lib64:$LIBRARY_PATH

export CPLUS_INCLUDE_PATH="${cudatoolkit}/include''${CPLUS_INCLUDE_PATH:+:$CPLUS_INCLUDE_PATH}"
export C_INCLUDE_PATH="${cudatoolkit}/include''${C_INCLUDE_PATH:+:$C_INCLUDE_PATH}"

Pixi completion -- not working yet, due to missing complete command

eval "$(pixi completion --shell bash 2>/dev/null)"

echo "*** Pixi environment activated, using $(which pixi). ***"


'';
}

Thanks in advance <3

13:00:55
@titus-von-koeller:matrix.orgTitus
  File "/home/titus/src/bnb/bitsandbytes/diagnostics/main.py", line 66, in main
    sanity_check()
  File "/home/titus/src/bnb/bitsandbytes/diagnostics/main.py", line 33, in sanity_check
    p = torch.nn.Parameter(torch.rand(10, 10).cuda())
  File "/home/titus/src/bnb/.pixi/envs/default/lib/python3.8/site-packages/torch/cuda/__init__.py", line 293, in _lazy_init
    torch._C._cuda_init()
13:06:53

Show newer messages


Back to Room ListRoom Version: 9