| 18 Mar 2023 |
SomeoneSerge (matrix works sometimes) |
does it work without specifying cudaSupport
You mean (import <nixpkgs> { config.cudaSupport = true; }).python3Packages.torch? Sure
| 00:34:39 |
mjlbach | FYI it doesn't work for me without overriding pytorch specifically | 00:40:04 |
SomeoneSerge (matrix works sometimes) | This doesn't sound right o_0 | 00:40:25 |
mjlbach | 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 |
mjlbach | Feel free to try the above flake | 00:42:58 |
SomeoneSerge (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 |
SomeoneSerge (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 |
SomeoneSerge (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 |
mjlbach | No debugging necessary, cudaSupport was the issue :) | 00:53:33 |
mjlbach | What are the default capabilities/cudaForewardCompat options being built and pushed to cachix? | 00:53:55 |
mjlbach | Would be good to document them | 00:53:59 |
SomeoneSerge (matrix works sometimes) | Waaait, but you do override cudaSupport in pytorch? | 00:54:00 |
SomeoneSerge (matrix works sometimes) | That should've been sufficient | 00:54:07 |
mjlbach | {
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 |
mjlbach | * {
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 |
mjlbach | That works | 00:54:17 |
mjlbach | It worked when I overrode cuda support in pytorch | 00:54:30 |
SomeoneSerge (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 |
SomeoneSerge (matrix works sometimes) | But yes, you're right | 00:54:42 |
mjlbach | Ah 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 |
SomeoneSerge (matrix works sometimes) | I see | 00:55:06 |
mjlbach | * 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 |
SomeoneSerge (matrix works sometimes) | Btw, CUDA_PATH etc usually aren't needed | 00:55:14 |
mjlbach | I'm planning on compiling some stuff out of tree haha | 00:55:27 |
SomeoneSerge (matrix works sometimes) | I mean, depends on how exotic is the stuff you're trying to build | 00:55:28 |
mjlbach | very | 00:55:32 |
mjlbach | 🏖️ | 00:55:38 |
mjlbach | * 🌴🏖️🍍 | 00:55:51 |
SomeoneSerge (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 |
mjlbach | Oh really? It will find cuda libraries? | 00:56:22 |