!eWOErHSaiddIbsUNsJ:nixos.org

NixOS CUDA

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

Load older messages


SenderMessageTime
18 Mar 2023
@ss:someonex.netSomeoneSerge (matrix works sometimes)

does it work without specifying cudaSupport

You mean (import <nixpkgs> { config.cudaSupport = true; }).python3Packages.torch? Sure

00:34:39
@atrius:matrix.orgmjlbachFYI it doesn't work for me without overriding pytorch specifically00:40:04
@ss:someonex.netSomeoneSerge (matrix works sometimes)This doesn't sound right o_000:40:25
@atrius:matrix.orgmjlbach
warning: Git tree '/home/michael/Repositories/nix-tests/nix-shell' is dirty
(nix:nix-shell-env) [michael@fedora nix-shell]$ python
Python 3.10.10 (main, Feb  7 2023, 12:19:31) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.is_available()
False
>>>
00:41:05
@atrius:matrix.orgmjlbachFeel free to try the above flake00:42:58
@ss:someonex.netSomeoneSerge (matrix works sometimes)
In reply to @atrius:matrix.org
I run fedora too, but it worked with that above flake for me
Ah, right, that's why you set LD_LIBRARY_PATH
00:50:22
@ss:someonex.netSomeoneSerge (matrix works sometimes)
In reply to @atrius:matrix.org
{
  description = "A very basic for pytorch support";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  };

  nixConfig = {
    # Add the CUDA maintainer's cache
    extra-substituters = [
      "https://nix-community.cachix.org"
      "https://cuda-maintainers.cachix.org"
    ];
    extra-trusted-public-keys = [
      "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
      "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
    ];
  };

  outputs = { self, nixpkgs, nixgl }:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs {
        inherit system;
        config = {
          allowUnfree = true;
          cudaEnabled = true;
          cudaCapabilities = [ "8.6" ];
          cudaForwardCompat = true;
        };
      };
      my-python-packages = p: with p; [
        (pytorch.override { cudaSupport = true; })
      ];
    in
    {
      devShell.${system} = pkgs.mkShell {
        packages = with pkgs; [
          (python310.withPackages my-python-packages)
        ];

       shellHook = ''
          export CUDA_PATH=${pkgs.cudatoolkit}
          export LD_LIBRARY_PATH=${pkgs.linuxPackages.nvidia_x11}/lib
          export EXTRA_LDFLAGS="-L/lib -L${pkgs.linuxPackages.nvidia_x11}/lib"
          export EXTRA_CCFLAGS="-I/usr/include"
       '';
      };
    };
}

It's cudaSupport in config, btw. But beside the point
00:50:57
@ss:someonex.netSomeoneSerge (matrix works sometimes)
In reply to @atrius:matrix.org
warning: Git tree '/home/michael/Repositories/nix-tests/nix-shell' is dirty
(nix:nix-shell-env) [michael@fedora nix-shell]$ python
Python 3.10.10 (main, Feb  7 2023, 12:19:31) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.cuda.is_available()
False
>>>
Hmm, how about LD_DEBUG=libs python -c "import torch; torch.cuda.is_available()" | gh gist create -?
00:52:20
@atrius:matrix.orgmjlbachNo debugging necessary, cudaSupport was the issue :) 00:53:33
@atrius:matrix.orgmjlbachWhat are the default capabilities/cudaForewardCompat options being built and pushed to cachix?00:53:55
@atrius:matrix.orgmjlbachWould be good to document them00:53:59
@ss:someonex.netSomeoneSerge (matrix works sometimes) Waaait, but you do override cudaSupport in pytorch? 00:54:00
@ss:someonex.netSomeoneSerge (matrix works sometimes)That should've been sufficient00:54:07
@atrius:matrix.orgmjlbach
{
  description = "A very basic flake for pytorch support";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  };

  nixConfig = {
    # Add the CUDA maintainer's cache
    extra-substituters = [
      "https://nix-community.cachix.org"
      "https://cuda-maintainers.cachix.org"
    ];
    extra-trusted-public-keys = [
      "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
      "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
    ];
  };

  outputs = { self, nixpkgs }:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs {
        inherit system;
        config = {
          allowUnfree = true;
          cudaSupport = true;
          # cudaCapabilities = [ "8.6" ];
          cudaForwardCompat = true;
        };
      };
      my-python-packages = p: with p; [
        torch
      ];
    in
    {
      devShell.${system} = pkgs.mkShell {
        packages = with pkgs; [
          (python310.withPackages my-python-packages)
        ];

       shellHook = ''
          export CUDA_PATH=${pkgs.cudatoolkit}
          export LD_LIBRARY_PATH=${pkgs.linuxPackages.nvidia_x11}/lib
          export EXTRA_LDFLAGS="-L/lib -L${pkgs.linuxPackages.nvidia_x11}/lib"
          export EXTRA_CCFLAGS="-I/usr/include"
       '';
      };
    };
}

00:54:11
@atrius:matrix.orgmjlbach *
{
  description = "A very basic flake for pytorch support";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
  };

  nixConfig = {
    # Add the CUDA maintainer's cache
    extra-substituters = [
      "https://nix-community.cachix.org"
      "https://cuda-maintainers.cachix.org"
    ];
    extra-trusted-public-keys = [
      "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
      "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
    ];
  };

  outputs = { self, nixpkgs }:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs {
        inherit system;
        config = {
          allowUnfree = true;
          cudaSupport = true;
          # cudaCapabilities = [ "8.6" ];
          cudaForwardCompat = true;
        };
      };
      my-python-packages = p: with p; [
        torch
      ];
    in
    {
      devShell.${system} = pkgs.mkShell {
        packages = with pkgs; [
          (python310.withPackages my-python-packages)
        ];

       shellHook = ''
          export CUDA_PATH=${pkgs.cudatoolkit}
          export LD_LIBRARY_PATH=${pkgs.linuxPackages.nvidia_x11}/lib
          export EXTRA_LDFLAGS="-L/lib -L${pkgs.linuxPackages.nvidia_x11}/lib"
          export EXTRA_CCFLAGS="-I/usr/include"
       '';
      };
    };
}

00:54:16
@atrius:matrix.orgmjlbachThat works00:54:17
@atrius:matrix.orgmjlbachIt worked when I overrode cuda support in pytorch00:54:30
@ss:someonex.netSomeoneSerge (matrix works sometimes)
In reply to @atrius:matrix.org
What are the default capabilities/cudaForewardCompat options being built and pushed to cachix?
They're kind of a new thing and it was my fault that default capabilities' cache got out of date...
00:54:35
@ss:someonex.netSomeoneSerge (matrix works sometimes)But yes, you're right00:54:42
@atrius:matrix.orgmjlbachAh ok, so in general we should use the default's and not override them if we expect to hit the cachix cahce?00:55:06
@ss:someonex.netSomeoneSerge (matrix works sometimes)I see00:55:06
@atrius:matrix.orgmjlbach * Ah ok, so in general we should use the default's and not override them if we expect to hit the cachix cache? 00:55:09
@ss:someonex.netSomeoneSerge (matrix works sometimes) Btw, CUDA_PATH etc usually aren't needed 00:55:14
@atrius:matrix.orgmjlbachI'm planning on compiling some stuff out of tree haha00:55:27
@ss:someonex.netSomeoneSerge (matrix works sometimes)I mean, depends on how exotic is the stuff you're trying to build00:55:28
@atrius:matrix.orgmjlbachvery00:55:32
@atrius:matrix.orgmjlbach🏖️00:55:38
@atrius:matrix.orgmjlbach * 🌴🏖️🍍 00:55:51
@ss:someonex.netSomeoneSerge (matrix works sometimes) But if it's anything reasonable (cmake, lmao, am I really saying this) then just having pkg-config and cmake in shell's packages suffices 00:56:04
@atrius:matrix.orgmjlbachOh really? It will find cuda libraries?00:56:22

Show newer messages


Back to Room ListRoom Version: 9