From 1d63f89caaf140ac33f1796dc0aaeb20f4ac4e55 Mon Sep 17 00:00:00 2001 From: Frederik Rietdijk Date: Sun, 3 Apr 2022 11:19:04 +0200 Subject: cudaPackages: overhaul of how we package cuda packages There are many different versions of the `cudatoolkit` and related cuda packages, and it can be tricky to ensure they remain compatible. - `cudaPackages` is now a package set with `cudatoolkit`, `cudnn`, `cutensor`, `nccl`, as well as `cudatoolkit` split into smaller packages ("redist"); - expressions should now use `cudaPackages` as parameter instead of the individual cuda packages; - `makeScope` is now used, so it is possible to use `.overrideScope'` to set e.g. a different `cudnn` version; - `release-cuda.nix` is introduced to easily evaluate cuda packages using hydra. --- doc/languages-frameworks/cuda.section.md | 34 ++++++++++++++++++++++++++++++++ doc/languages-frameworks/index.xml | 1 + 2 files changed, 35 insertions(+) create mode 100644 doc/languages-frameworks/cuda.section.md (limited to 'doc') diff --git a/doc/languages-frameworks/cuda.section.md b/doc/languages-frameworks/cuda.section.md new file mode 100644 index 00000000000..fccf66bf79d --- /dev/null +++ b/doc/languages-frameworks/cuda.section.md @@ -0,0 +1,34 @@ +# CUDA {#cuda} + +CUDA-only packages are stored in the `cudaPackages` packages set. This set +includes the `cudatoolkit`, portions of the toolkit in separate derivations, +`cudnn`, `cutensor` and `nccl`. + +A package set is available for each CUDA version, so for example +`cudaPackages_11_6`. Within each set is a matching version of the above listed +packages. Additionally, other versions of the packages that are packaged and +compatible are available as well. For example, there can be a +`cudaPackages.cudnn_8_3_2` package. + +To use one or more CUDA packages in an expression, give the expression a `cudaPackages` parameter, and in case CUDA is optional +```nix +cudaSupport ? false +cudaPackages ? {} +``` + +When using `callPackage`, you can choose to pass in a different variant, e.g. +when a different version of the toolkit suffices +```nix +mypkg = callPackage { cudaPackages = cudaPackages_11_5; } +``` + +If another version of say `cudnn` or `cutensor` is needed, you can override the +package set to make it the default. This guarantees you get a consistent package +set. +```nix +mypkg = let + cudaPackages = cudaPackages_11_5.overrideScope' (final: prev { + cudnn = prev.cudnn_8_3_2; + }}); +in callPackage { inherit cudaPackages; }; +``` diff --git a/doc/languages-frameworks/index.xml b/doc/languages-frameworks/index.xml index f221693e764..144fa96bac1 100644 --- a/doc/languages-frameworks/index.xml +++ b/doc/languages-frameworks/index.xml @@ -11,6 +11,7 @@ + -- cgit 1.4.1