1# CUDA {#cuda} 2 3CUDA-only packages are stored in the `cudaPackages` packages set. This set 4includes the `cudatoolkit`, portions of the toolkit in separate derivations, 5`cudnn`, `cutensor` and `nccl`. 6 7A package set is available for each CUDA version, so for example 8`cudaPackages_11_6`. Within each set is a matching version of the above listed 9packages. Additionally, other versions of the packages that are packaged and 10compatible are available as well. For example, there can be a 11`cudaPackages.cudnn_8_3_2` package. 12 13To use one or more CUDA packages in an expression, give the expression a `cudaPackages` parameter, and in case CUDA is optional 14```nix 15cudaSupport ? false 16cudaPackages ? {} 17``` 18 19When using `callPackage`, you can choose to pass in a different variant, e.g. 20when a different version of the toolkit suffices 21```nix 22mypkg = callPackage { cudaPackages = cudaPackages_11_5; } 23``` 24 25If another version of say `cudnn` or `cutensor` is needed, you can override the 26package set to make it the default. This guarantees you get a consistent package 27set. 28```nix 29mypkg = let 30 cudaPackages = cudaPackages_11_5.overrideScope' (final: prev { 31 cudnn = prev.cudnn_8_3_2; 32 }}); 33in callPackage { inherit cudaPackages; }; 34```