3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/compilers/cudatoolkit/redist/extension.nix
Frederik Rietdijk 1d63f89caa 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.
2022-04-09 08:50:22 +02:00

33 lines
1.2 KiB
Nix

final: prev: let
inherit (final) callPackage;
inherit (prev) cudaVersion lib pkgs;
### Cuda Toolkit Redist
# Manifest files for redist cudatoolkit. These can be found at
# https://developer.download.nvidia.com/compute/cuda/redist/
cudaToolkitRedistManifests = {
"11.4" = ./manifests/redistrib_11.4.4.json;
"11.5" = ./manifests/redistrib_11.5.2.json;
"11.6" = ./manifests/redistrib_11.6.2.json;
};
# Function to build a single cudatoolkit redist package
buildCudaToolkitRedistPackage = callPackage ./build-cuda-redist-package.nix { };
# Function that builds all cudatoolkit redist packages given a cuda version and manifest file
buildCudaToolkitRedistPackages = { version, manifest }: let
attrs = lib.filterAttrs (key: value: key != "release_date") (lib.importJSON manifest);
in lib.mapAttrs buildCudaToolkitRedistPackage attrs;
redistExists = cudaToolkitRedistManifests ? "${cudaVersion}";
# All cudatoolkit redist packages for the current cuda version
cudaToolkitRedistPackages = if
lib.hasAttr cudaVersion cudaToolkitRedistManifests
then buildCudaToolkitRedistPackages { version = cudaVersion; manifest = cudaToolkitRedistManifests.${cudaVersion}; }
else {};
in cudaToolkitRedistPackages