!fXpAvneDgyJuYMZSwO:nixos.org

Nix Data Science

275 Members
57 Servers

Load older messages


SenderMessageTime
16 Apr 2022
@lihram:jnh.ems.hostHilmar (he/him) joined the room.23:12:40
17 Apr 2022
@yuu:matrix.orgYuu Yin joined the room.04:23:53
@yuu:matrix.orgYuu Yinanyone who has a flake for pytorch + cuda development? or it could be a shell.nix too06:30:27
@yuu:matrix.orgYuu Yin
{
  description = "Pytorch and stuff";

  # Specifies other flakes that this flake depends on.
  inputs = {
    devshell.url = "github:numtide/devshell";
    utils.url = "github:numtide/flake-utils";
    nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
  };

  # Function that produces an attribute set.
  # Its function arguments are the flakes specified in inputs.
  # The self argument denotes this flake.
  outputs = inputs@{ self, nixpkgs, utils, ... }:
    (utils.lib.eachSystem [ "x86_64-linux" ] (system:
      let
        pkgs = (import nixpkgs {
          inherit system;
          config = {
            # For CUDA.
            allowUnfree = true;
            # Enables CUDA support in packages that support it.
            cudaSupport = true;
          };
        });
      in rec {
        # Executed by `nix build .#<name>`
        # Ignore this, it was just for testing.
        packages = utils.lib.flattenTree {
          hello = pkgs.hello;
        };

        # Executed by `nix build .`
        defaultPackage = packages.hello;
        # defaultPackage = pkgs.callPackage ./default.nix { };

        # Executed by `nix develop`
        devShell = with pkgs; mkShell {
          buildInputs = [
            python39 # numba-0.54.1 not supported for interpreter python3.10
          ] ++ (with python39.pkgs; [
            inflect
            librosa
            pip
            pytorch-bin
            unidecode
          ]) ++ (with cudaPackages; [
            cudatoolkit
          ]);

          shellHook = ''
            export CUDA_PATH=${pkgs.cudatoolkit}
          '';
        };
      }
    ));
}
14:52:09
@glepage:matrix.orgGaétan Lepage joined the room.22:00:17
@lepageg:ensimag.frGaétan Lepage left the room.22:02:06
18 Apr 2022
@ss:someonex.netSomeoneSerge (UTC+U[-12,12])
In reply to @yuu:matrix.org
anyone who has a flake for pytorch + cuda development? or it could be a shell.nix too
Do you mean pytorch extensions?
14:03:22
@ss:someonex.netSomeoneSerge (UTC+U[-12,12])
In reply to @yuu:matrix.org
{
  description = "Pytorch and stuff";

  # Specifies other flakes that this flake depends on.
  inputs = {
    devshell.url = "github:numtide/devshell";
    utils.url = "github:numtide/flake-utils";
    nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
  };

  # Function that produces an attribute set.
  # Its function arguments are the flakes specified in inputs.
  # The self argument denotes this flake.
  outputs = inputs@{ self, nixpkgs, utils, ... }:
    (utils.lib.eachSystem [ "x86_64-linux" ] (system:
      let
        pkgs = (import nixpkgs {
          inherit system;
          config = {
            # For CUDA.
            allowUnfree = true;
            # Enables CUDA support in packages that support it.
            cudaSupport = true;
          };
        });
      in rec {
        # Executed by `nix build .#<name>`
        # Ignore this, it was just for testing.
        packages = utils.lib.flattenTree {
          hello = pkgs.hello;
        };

        # Executed by `nix build .`
        defaultPackage = packages.hello;
        # defaultPackage = pkgs.callPackage ./default.nix { };

        # Executed by `nix develop`
        devShell = with pkgs; mkShell {
          buildInputs = [
            python39 # numba-0.54.1 not supported for interpreter python3.10
          ] ++ (with python39.pkgs; [
            inflect
            librosa
            pip
            pytorch-bin
            unidecode
          ]) ++ (with cudaPackages; [
            cudatoolkit
          ]);

          shellHook = ''
            export CUDA_PATH=${pkgs.cudatoolkit}
          '';
        };
      }
    ));
}
Is there something pytorchWithCuda currently fails to do that you manage to accomplish with pytorch-bin?
14:04:00
@ss:someonex.netSomeoneSerge (UTC+U[-12,12])...and: hello there:)14:04:06
@yuu:matrix.orgYuu Yin

Someone S: hi there ^-^ i just wanted a minimal flake.nix with pytorch and cuda enabled. i did it with that flake

{
  description = "Pytorch and stuff";

  # Specifies other flakes that this flake depends on.
  inputs = {
    devshell.url = "github:numtide/devshell";
    utils.url = "github:numtide/flake-utils";
    nixpkgs.url = "github:nixos/nixpkgs/nixos-21.11";
  };

  # Function that produces an attribute set.
  # Its function arguments are the flakes specified in inputs.
  # The self argument denotes this flake.
  outputs = inputs@{ self, nixpkgs, utils, ... }:
    (utils.lib.eachSystem [ "x86_64-linux" ] (system:
      let
        pkgs = (import nixpkgs {
          inherit system;
          config = {
            # For CUDA.
            allowUnfree = true;
            # Enables CUDA support in packages that support it.
            cudaSupport = true;
          };
        });
      in rec {
        # Executed by `nix build .#<name>`
        # Ignore this, it was just for testing.
        packages = utils.lib.flattenTree {
          hello = pkgs.hello;
        };

        # Executed by `nix build .`
        defaultPackage = packages.hello;
        # defaultPackage = pkgs.callPackage ./default.nix { };

        # Executed by `nix develop`
        devShell = with pkgs; mkShell {
          buildInputs = [
            python39 # numba-0.54.1 not supported for interpreter python3.10
          ] ++ (with python39.pkgs; [
            inflect
            librosa
            pip
            pytorch-bin
            unidecode
          ]) ++ (with cudaPackages; [
            cudatoolkit
          ]);

          shellHook = ''
            export CUDA_PATH=${pkgs.cudatoolkit}
          '';
        };
      }
    ));
}

and direnv + nix-direnv .envrc

use flake

18:52:01
@ss:someonex.netSomeoneSerge (UTC+U[-12,12])

👍️

I'll try to send some of the shells that I use a little later.
But meanwhile a few links you might find useful, if you haven't seen them yet:

  • zimbatm's nixpkgs-unfree: https://discourse.nixos.org/t/announcing-nixpkgs-unfree/17505
    The idea is to use inputs.nixpkgs.url = github:numtide/nixpkgs-unfree/$branch as input, which exposes nixpkgs with the unfree already enabled and tracks NixOS/nixpkgs automatically. I'm using smth like this for the flake registry in my configuration.nix, so that nixpkgs#python3Packages.pytorch resolves into the pre-cached unfree and cuda-enabled pytorch for me, instead of throwing an error about NIXPKGS_ALLOW_UNFREE=1
  • It's somewhat experimental, but there's now cachix with prebuilt cuda-enabled sci-comp packages, you can find more at https://nixos.wiki/wiki/CUDA. The cache is populated automatically for the last release, unstable, and master, much like nixpkgs-unfree does it. There's a slight delay between a branch update and the cache, but probably not more than a day
  • I prefer using source-based pytorch instead of the wheel-based pytorch-bin. The way I use cuda-enabled packages is essentially just importing nixpkgs with { config = { allowUnfree = true; cudaSupport = true; }; } and using directly pytorch, jax, blender, etc. And I'd rather consume nixpkgs-unfree as a flake input, than import it myself in a project.
19:13:04
@yuu:matrix.orgYuu Yin Someone S: that's definitively useful info! I'm going to implement your tips. thank you so much! by "And I'd rather consume nixpkgs-unfree as a flake input, than import it myself in a project.", you mean nixpkgs-unfree as an input to the project's repotory's flake.nix, right? 21:19:16
@ss:someonex.netSomeoneSerge (UTC+U[-12,12])Yes so!21:37:36
20 Apr 2022
@ahsmha:matrix.orgahmed joined the room.23:33:06
21 Apr 2022
@wybpip:matrix.orgAn exploring bot joined the room.00:49:27
@wybpip:matrix.orgAn exploring bot left the room.00:49:28
24 Apr 2022
@ebeem:matrix.orgebeem-sama joined the room.19:50:58
26 Apr 2022
@johnwanyekz:matrix.orgKi joined the room.10:35:08
29 Apr 2022
@hedgemage:freehold.earthHedgeMage joined the room.17:17:27
4 May 2022
@wybpip:matrix.orgAn exploring bot joined the room.15:02:17
@wybpip:matrix.orgAn exploring bot left the room.15:02:18
8 May 2022
@kraftnix:matrix.orgkraftnix set a profile picture.17:46:13
9 May 2022
@box1:matrix.orgSuwon Park joined the room.13:22:54
20 May 2022
@gullf:matrix.orggullf joined the room.22:43:49
@gullf:matrix.orggullf left the room.22:45:26
25 May 2022
@dev.hell:matrix.orgdevhell joined the room.09:39:17
@dev.hell:matrix.orgdevhellHello :) Has anyone here tried to run 'namd' on NixOS?09:39:50
@dev.hell:matrix.orgdevhellI can set up a VM and pass the tesla through to the VM (which runs Arch), but I would prefer it if I could run namd bare-metal on the NixOS host09:40:35
1 Jun 2022
@tinybronca:sibnsk.netunderpantsgnome joined the room.09:06:32
9 Jun 2022
@dev.hell:matrix.orgdevhellI suppose singularity containers is the way to go08:12:13

Show newer messages


Back to Room ListRoom Version: 6