CUDA: Difference between revisions

Eljamm (talk | contribs)
m Wrap important information in tip/warning blocks for better readability
Eljamm (talk | contribs)
 
(2 intermediate revisions by the same user not shown)
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/projects/27 @NixOS/cuda-maintainers team] on GitHub. If you have an issue using your NVIDIA GPU for computing purposes [https://github.com/nixos/nixpkgs/issues/new open an issue] on GitHub and tag @NixOS/cuda-maintainers.
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/projects/27 @NixOS/cuda-maintainers team] on GitHub. If you have an issue using your NVIDIA GPU for computing purposes [https://github.com/nixos/nixpkgs/issues/new open an issue] on GitHub and tag @NixOS/cuda-maintainers.


{{tip|1='''Cache''': Using the [https://app.cachix.org/cache/cuda-maintainers#pull cuda-maintainers cache] is recommended! It will save you valuable time and electrons. Getting set up should be as simple as <code>cachix use cuda-maintainers</code>.}}
{{tip|1='''Cache''': Using the [https://app.cachix.org/cache/cuda-maintainers#pull cuda-maintainers cache] is recommended! It will save you valuable time and electrons. Getting set up should be as simple as <code>cachix use cuda-maintainers</code>. 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 79: Line 79:
   '';           
   '';           
}
}
</nowiki>}}
== Setting up CUDA Binary Cache ==
The [https://app.cachix.org/cache/cuda-maintainers cuda-maintainers] 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.
{{warning|1=You need to rebuild your system at least once after adding the cache, before it can be used.}}
=== NixOS ===
Add the cache to <code>substituters</code> and <code>trusted-public-keys</code> inside your system configuration:
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
nix.settings = {
  substituters = [
    "https://cuda-maintainers.cachix.org"
  ];
  trusted-public-keys = [
    "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E="
  ];
};
</nowiki>}}
=== Non-NixOS ===
If you have [https://www.cachix.org cachix] installed and set up, all you need to do is run:
<syntaxHighlight lang="console">
$ cachix use cuda-maintainers
</syntaxHighlight>
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 = cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=
trusted-substituters = https://cuda-maintainers.cachix.org
trusted-users = root @wheel
</nowiki>}}
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>
substituters = https://cuda-maintainers.cachix.org
</nowiki>}}
</nowiki>}}