CUDA: Difference between revisions

Aos (talk | contribs)
No edit summary
Replace nix-community binary cache with cache.nixos-cuda.org
 
Line 1: Line 1:
NixOS supports using NVIDIA GPUs for pure computing purposes, not just for graphics. For example, many users rely on NixOS for machine learning both locally and on cloud instances. These use cases are supported by the [https://github.com/orgs/NixOS/teams/cuda-maintainers @NixOS/cuda-maintainers team] on GitHub ([https://github.com/orgs/NixOS/projects/27 project board]). If you have an issue using your NVIDIA GPU for computing purposes [https://github.com/NixOS/nixpkgs/issues/new/choose open an issue] on GitHub and tag <code>@NixOS/cuda-maintainers</code>.
NixOS supports using NVIDIA GPUs for pure computing purposes, not just for graphics. For example, many users rely on NixOS for machine learning both locally and on cloud instances. These use cases are supported by the [https://github.com/orgs/NixOS/teams/cuda-maintainers @NixOS/cuda-maintainers team] on GitHub ([https://github.com/orgs/NixOS/projects/27 project board]). If you have an issue using your NVIDIA GPU for computing purposes [https://github.com/NixOS/nixpkgs/issues/new/choose open an issue] on GitHub and tag <code>@NixOS/cuda-maintainers</code>.


{{tip|1='''Cache''': Using the [https://app.cachix.org/cache/nix-community nix-community cache] is recommended! It will save you valuable time and electrons. Getting set up should be as simple as <code>cachix use nix-community</code>. Click [[#Setting up CUDA Binary Cache|here]] for more details.}}
{{tip|1='''Cache''': Using the binary cache is recommended! It will save you valuable time and electrons. Click [[#Setting up CUDA Binary Cache|here]] for more details.}}


{{tip|1='''Data center GPUs''': Note that you may need to adjust your driver version to use "data center" GPUs like V100/A100s. See [https://discourse.nixos.org/t/how-to-use-nvidia-v100-a100-gpus/17754 this thread] for more info.}}
{{tip|1='''Data center GPUs''': Note that you may need to adjust your driver version to use "data center" GPUs like V100/A100s. See [https://discourse.nixos.org/t/how-to-use-nvidia-v100-a100-gpus/17754 this thread] for more info.}}
Line 144: Line 144:
== Setting up CUDA Binary Cache ==
== Setting up CUDA Binary Cache ==


The [https://nix-community.org/cache/ Nix-community cache] contains pre-built CUDA packages. By adding it to your system, Nix will fetch these packages instead of building them, saving valuable time and processing power.
The binary cache contains pre-built CUDA packages. By adding it to your system, Nix will fetch these packages instead of building them, saving valuable time and processing power.


For more information, refer to the [[Binary Cache#Using a binary cache Using a binary cache|Using a binary cache]] page.
For more information, refer to the [[Binary Cache#Using a binary cache Using a binary cache|Using a binary cache]] page.
Line 153: Line 153:
Add the cache to <code>substituters</code> and <code>trusted-public-keys</code> inside your system configuration:
Add the cache to <code>substituters</code> and <code>trusted-public-keys</code> inside your system configuration:


{{file|/etc/nixos/configuration.nix|nix|<nowiki>
{{file|3=<nowiki>
nix.settings = {
nix.settings = {
   substituters = [
   substituters = [
     "https://nix-community.cachix.org"
     "https://cache.nixos-cuda.org"
   ];
   ];
   trusted-public-keys = [
   trusted-public-keys = [
     "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
     "cache.nixos-cuda.org:74DUi4Ye579gUqzH4ziL9IyiJBlDpMRn9MBN8oNan9M="
   ];
   ];
};
};
</nowiki>}}
</nowiki>|name=/etc/nixos/configuration.nix|lang=nix}}


=== Non-NixOS ===
=== Non-NixOS ===


If you have [https://www.cachix.org cachix] installed and set up, all you need to do is run:
You have to add <code>substituters</code> and <code>trusted-public-keys</code> to <code>/etc/nix/nix.conf</code>:


<syntaxHighlight lang="console">
{{file|3=<nowiki>
$ cachix use nix-community
trusted-public-keys = cache.nixos-cuda.org:74DUi4Ye579gUqzH4ziL9IyiJBlDpMRn9MBN8oNan9M=
</syntaxHighlight>
trusted-substituters = https://cache.nixos-cuda.org
 
Else, you have to add <code>substituters</code> and <code>trusted-public-keys</code> to <code>/etc/nix/nix.conf</code>:
 
{{file|/etc/nix/nix.conf|nix|<nowiki>
trusted-public-keys = nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=
trusted-substituters = https://nix-community.cachix.org
trusted-users = root @wheel
trusted-users = root @wheel
</nowiki>}}
</nowiki>|name=/etc/nix/nix.conf|lang=nix}}


If your user is in <code>trusted-users</code>, you can also add the cache in your home directory:
If your user is in <code>trusted-users</code>, you can also add the cache in your home directory:


{{file|~/.config/nix/nix.conf|nix|<nowiki>
{{file|3=<nowiki>
substituters = https://nix-community.cachix.org
trusted-public-keys = cache.nixos-cuda.org:74DUi4Ye579gUqzH4ziL9IyiJBlDpMRn9MBN8oNan9M=
</nowiki>}}
trusted-substituters = https://cache.nixos-cuda.org
</nowiki>|name=~/.config/nix/nix.conf|lang=nix}}


== Some things to keep in mind when setting up CUDA in NixOS ==
== Some things to keep in mind when setting up CUDA in NixOS ==