NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.27k stars 13.52k forks source link

CUDA-Team: migrate from `cudatoolkit` to `cudaPackages` #232501

Open ConnorBaker opened 1 year ago

ConnorBaker commented 1 year ago

Where possible, migrate tree-wide from use of cudatoolkit to cudaPackages (aka "cuda-redist") to reduce closure size and ease maintenance.

A quick grep of Nixpkgs reveals the inclusion in following packages (barring definitions). They should be changed, or a comment added describing why such a change is incorrect or impractical.

nixos-discourse commented 1 year ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/cuda-team-roadmap-and-call-for-sponsors/29495/1

nixos-discourse commented 8 months ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/on-nixpkgs-and-the-ai-follow-up-to-2023-nix-developer-dialogues/37087/2

SomeoneSerge commented 8 months ago

We can test whether a package depends on cudatoolkit by excluding the latter from allowUnfreePredicate:

❯ nix build -f '<nixpkgs>' --arg config '{ cudaSupport = true; cudaCapabilities = [ "8.6" ]; cudaEnableForwardCompat = false; allowUnfreePredicate = pkg: pkg.pname != "cudatoolkit"; }' -L --print-out-paths blender opensubdiv ucc ucx openmpi gromacs suitesparse python3Packages.torch{,audio,vision} pcl
/nix/store/8fk6jhrakqprhyhpbdlhlm3xyz022pnz-blender-4.0.2
/nix/store/a315rzndn0fha733cvpqhkh2rkqp2zc0-opensubdiv-3.5.1
/nix/store/f6vssnwxpyd91rrnj4k1ixq21jwaqr8j-ucc-1.2.0
/nix/store/5lz1mqljgnjycfl1zgnvrxyys9i0yhxb-ucx-1.15.0
/nix/store/9r73bikxh291x94lgfnh52czapjrgh70-openmpi-4.1.6-man
/nix/store/d6hvaylyhmnpvxgkfxnwk8cc840fj550-openmpi-4.1.6
/nix/store/babjwpqzdipwyayqhk747zdsmd3k12jz-gromacs-2023.3-man
/nix/store/0r0dc1aki2w80wn97b0qc5jgygmbm01v-gromacs-2023.3
/nix/store/biqip82zinwdiibdf2s9w96l0vpvi3vn-suitesparse-5.13.0
/nix/store/zs2vkbc2vnsp375qr54zngdqkqnvpmwx-python3.11-torch-2.1.2
/nix/store/c8ldm2yk35vcj046c3gbf7jr38i6l6y9-python3.11-torchaudio-2.1.2
/nix/store/x658qmxz7qi7bynabfx89mgqfw3g00wc-python3.11-torchvision-0.16.2
/nix/store/figxdv6szmfrbyadack59nb6pj677gcr-pcl-1.13.0
❯ nix build -f '<nixpkgs>' --arg config '{ cudaSupport = true; cudaCapabilities = [ "8.6" ]; cudaEnableForwardCompat = false; allowUnfreePredicate = pkg: pkg.pname != "cudatoolkit"; }' -L --print-out-paths python3Packages.tensorflow
...
       error: Package ‘cudatoolkit-11.8.0’ in /nix/store/fn4i255gjsbqhza45ih8mgxgx47zan8i-source/pkgs/development/cuda-modules/cudatoolkit/default.nix:397 has an unfree license (‘CUDA EULA’), refusing to evaluate.
...

...or by building it for aarch64/jetson