From 510e2ccd97f7fe392ebfc80212d4e78fcfdd06d1 Mon Sep 17 00:00:00 2001 From: Connor Baker Date: Sat, 18 Feb 2023 12:12:08 -0500 Subject: [PATCH] cudnn: init 8.8.0; rewrite to assist maintainability --- .../science/math/cudnn/extension.nix | 307 ++++-------------- .../libraries/science/math/cudnn/generic.nix | 191 ++++++----- .../libraries/science/math/cudnn/releases.nix | 170 ++++++++++ 3 files changed, 342 insertions(+), 326 deletions(-) create mode 100644 pkgs/development/libraries/science/math/cudnn/releases.nix diff --git a/pkgs/development/libraries/science/math/cudnn/extension.nix b/pkgs/development/libraries/science/math/cudnn/extension.nix index dc538411211b..81e4b76f21c6 100644 --- a/pkgs/development/libraries/science/math/cudnn/extension.nix +++ b/pkgs/development/libraries/science/math/cudnn/extension.nix @@ -1,249 +1,80 @@ +# Support matrix can be found at +# https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-880/support-matrix/index.html +# Type aliases +# Release = { +# version: String, +# minCudaVersion: String, +# maxCudaVersion: String, +# url: String, +# hash: String, +# } final: prev: let - inherit (final) callPackage; - inherit (prev) cudatoolkit cudaVersion lib pkgs; - inherit (prev.lib.versions) major; + inherit (prev) cudaVersion; + inherit (prev.lib) attrsets lists versions strings trivial; - ### CuDNN + # Utilities + # majorMinorPatch :: String -> String + majorMinorPatch = (trivial.flip trivial.pipe) [ + (versions.splitVersion) + (lists.take 3) + (strings.concatStringsSep ".") + ]; - buildCuDnnPackage = args: - let - useCudatoolkitRunfile = lib.versionOlder cudaVersion "11.3.999"; - in - callPackage ./generic.nix { inherit useCudatoolkitRunfile; } args; + # Compute versioned attribute name to be used in this package set + # computeName :: String -> String + computeName = version: "cudnn_${strings.replaceStrings ["."] ["_"] (majorMinorPatch version)}"; - toUnderscore = str: lib.replaceStrings ["."] ["_"] str; + # Check whether a CUDNN release supports our CUDA version + # Thankfully we're able to do lexicographic comparison on the version strings + # isSupported :: Release -> Bool + isSupported = release: + strings.versionAtLeast cudaVersion release.minCudaVersion + && strings.versionAtLeast release.maxCudaVersion cudaVersion; - majorMinorPatch = str: lib.concatStringsSep "." (lib.take 3 (lib.splitVersion str)); + # useCudatoolkitRunfile :: Bool + useCudatoolkitRunfile = strings.versionOlder cudaVersion "11.3.999"; - cuDnnPackages = with lib; let - # Check whether a file is supported for our cuda version - isSupported = fileData: elem cudaVersion fileData.supportedCudaVersions; - # Return the first file that is supported. In practice there should only ever be one anyway. - supportedFile = files: findFirst isSupported null files; - # Supported versions with versions as keys and file as value - supportedVersions = filterAttrs (version: file: file !=null ) (mapAttrs (version: files: supportedFile files) cuDnnVersions); - # Compute versioned attribute name to be used in this package set - computeName = version: "cudnn_${toUnderscore version}"; - # Add all supported builds as attributes - allBuilds = mapAttrs' (version: file: nameValuePair (computeName version) (buildCuDnnPackage (removeAttrs file ["fileVersion"]))) supportedVersions; - # Set the default attributes, e.g. cudnn = cudnn_8_3_1; - defaultBuild = { "cudnn" = if allBuilds ? ${computeName cuDnnDefaultVersion} - then allBuilds.${computeName cuDnnDefaultVersion} - else throw "cudnn-${cuDnnDefaultVersion} does not support your cuda version ${cudaVersion}"; }; - in allBuilds // defaultBuild; + # buildCuDnnPackage :: Release -> Derivation + buildCuDnnPackage = callPackage ./generic.nix {inherit useCudatoolkitRunfile;}; - cuDnnVersions = let - urlPrefix = "https://developer.download.nvidia.com/compute/redist/cudnn"; - in { - "7.4.2" = [ - rec { - fileVersion = "10.0"; - fullVersion = "7.4.2.24"; - hash = "sha256-Lt/IagK1DRfojEeJVaMy5qHoF05+U6NFi06lH68C2qM="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/cudnn-10.0-linux-x64-v${fullVersion}.tgz"; - supportedCudaVersions = [ "10.0" ]; - } - ]; - "7.6.5" = [ - rec { - fileVersion = "10.0"; - fullVersion = "7.6.5.32"; - hash = "sha256-KDVeOV8LK5OsLIO2E2CzW6bNA3fkTni+GXtrYbS0kro="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/cudnn-${cudatoolkit.majorVersion}-linux-x64-v${fullVersion}.tgz"; - supportedCudaVersions = [ "10.0" ]; - } - rec { - fileVersion = "10.1"; - fullVersion = "7.6.5.32"; - hash = "sha256-fq7IA5osMKsLx1jTA1iHZ2k972v0myJIWiwAvy4TbLM="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/cudnn-${cudatoolkit.majorVersion}-linux-x64-v${fullVersion}.tgz"; - supportedCudaVersions = [ "10.1" ]; - } - rec { - fileVersion = "10.2"; - fullVersion = "7.6.5.32"; - hash = "sha256-fq7IA5osMKsLx1jTA1iHZ2k972v0myJIWiwAvy4TbLN="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/cudnn-${cudatoolkit.majorVersion}-linux-x64-v${fullVersion}.tgz"; - supportedCudaVersions = [ "10.2" ]; - } - ]; - "8.0.5" = [ - rec { - fileVersion = "10.1"; - fullVersion = "8.0.5.39"; - hash = "sha256-kJCElSmIlrM6qVBjo0cfk8NmJ9esAcF9w211xl7qSgA="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/cudnn-${fileVersion}-linux-x64-v${fullVersion}.tgz"; - # https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-805/support-matrix/index.html - supportedCudaVersions = [ "10.1" ]; - } - rec { - fileVersion = "10.2"; - fullVersion = "8.0.5.39"; - hash = "sha256-IfhMBcZ78eyFnnfDjM1b8VSWT6HDCPRJlZvkw1bjgvM="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/cudnn-${fileVersion}-linux-x64-v${fullVersion}.tgz"; - # https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-805/support-matrix/index.html - supportedCudaVersions = [ "10.2" ]; - } - rec { - fileVersion = "11.0"; - fullVersion = "8.0.5.39"; - hash = "sha256-ThbueJXetKixwZS4ErpJWG730mkCBRQB03F1EYmKm3M="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/cudnn-${fileVersion}-linux-x64-v${fullVersion}.tgz"; - # https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-805/support-matrix/index.html - supportedCudaVersions = [ "11.0" ]; - } - rec { - fileVersion = "11.1"; - fullVersion = "8.0.5.39"; - hash = "sha256-HQRr+nk5navMb2yxUHkYdUQ5RC6gyp4Pvs3URvmwDM4="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/cudnn-${fileVersion}-linux-x64-v${fullVersion}.tgz"; - # https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-805/support-matrix/index.html - supportedCudaVersions = [ "11.1" ]; - } - ]; - "8.1.1" = [ - rec { - fileVersion = "10.2"; - fullVersion = "8.1.1.33"; - hash = "sha256-Kkp7mabpv6aQ6xm7QeSVU/KnpJGls6v8rpAOFmxbbr0="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/cudnn-${fileVersion}-linux-x64-v${fullVersion}.tgz"; - # https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-811/support-matrix/index.html#cudnn-versions-810-811 - supportedCudaVersions = [ "10.2" ]; - } - rec { - fileVersion = "11.2"; - fullVersion = "8.1.1.33"; - hash = "sha256-mKh4TpKGLyABjSDCgbMNSgzZUfk2lPZDPM9K6cUCumo="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/cudnn-${fileVersion}-linux-x64-v${fullVersion}.tgz"; - # https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-811/support-matrix/index.html#cudnn-versions-810-811 - supportedCudaVersions = [ "11.0" "11.1" "11.2" ]; - } - ]; - "8.2.4" = [ - rec { - fileVersion = "10.2"; - fullVersion = "8.2.4.15"; - hash = "sha256-0jyUoxFaHHcRamwSfZF1+/WfcjNkN08mo0aZB18yIvE="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/cudnn-${fileVersion}-linux-x64-v${fullVersion}.tgz"; - # https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-824/support-matrix/index.html - supportedCudaVersions = [ "10.2" ]; - } - rec { - fileVersion = "11.4"; - fullVersion = "8.2.4.15"; - hash = "sha256-Dl0t+JC5ln76ZhnaQhMQ2XMjVlp58FoajLm3Fluq0Nc="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/cudnn-${fileVersion}-linux-x64-v${fullVersion}.tgz"; - # https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-824/support-matrix/index.html - supportedCudaVersions = [ "11.0" "11.1" "11.2" "11.3" "11.4" ]; - } - ]; - "8.3.3" = [ - rec { - fileVersion = "10.2"; - fullVersion = "8.3.3.40"; - hash = "sha256-2FVPKzLmKV1fyPOsJeaPlAWLAYyAHaucFD42gS+JJqs="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/local_installers/${fileVersion}/cudnn-linux-x86_64-${fullVersion}_cuda${fileVersion}-archive.tar.xz"; - # https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-833/support-matrix/index.html - supportedCudaVersions = [ "10.2" ]; - } - rec { - fileVersion = "11.5"; - fullVersion = "8.3.3.40"; - hash = "sha256-6r6Wx1zwPqT1N5iU2RTx+K4UzqsSGYnoSwg22Sf7dzE="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/local_installers/${fileVersion}/cudnn-linux-x86_64-${fullVersion}_cuda${fileVersion}-archive.tar.xz"; - # https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-833/support-matrix/index.html - supportedCudaVersions = [ "11.0" "11.1" "11.2" "11.3" "11.4" "11.5" "11.6" ]; - } - ]; - "8.4.1" = [ - rec { - fileVersion = "10.2"; - fullVersion = "8.4.1.50"; - hash = "sha256-I88qMmU6lIiLVmaPuX7TTbisgTav839mssxUo3lQNjg="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/local_installers/${fileVersion}/cudnn-linux-x86_64-${fullVersion}_cuda${fileVersion}-archive.tar.xz"; - # https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-841/support-matrix/index.html - supportedCudaVersions = [ "10.2" ]; - } - rec { - fileVersion = "11.6"; - fullVersion = "8.4.1.50"; - hash = "sha256-7JbSN22B/KQr3T1MPXBambKaBlurV/kgVhx2PinGfQE="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/local_installers/${fileVersion}/cudnn-linux-x86_64-${fullVersion}_cuda${fileVersion}-archive.tar.xz"; - # https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-841/support-matrix/index.html - supportedCudaVersions = [ "11.0" "11.1" "11.2" "11.3" "11.4" "11.5" "11.6" "11.7" ]; - } - ]; - "8.5.0" = [ - rec { - fileVersion = "10.2"; - fullVersion = "8.5.0.96"; - hash = "sha256-1mzhbbzR40WKkHnQLtJHhg0vYgf7G8a0OBcCwIOkJjM="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/local_installers/${fileVersion}/cudnn-linux-x86_64-${fullVersion}_cuda${major fileVersion}-archive.tar.xz"; - # https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-850/support-matrix/index.html - supportedCudaVersions = [ "10.2" ]; - } - rec { - fileVersion = "11.7"; - fullVersion = "8.5.0.96"; - hash = "sha256-VFSm/ZTwCHKMqumtrZk8ToXvNjAuJrzkO+p9RYpee20="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/local_installers/${fileVersion}/cudnn-linux-x86_64-${fullVersion}_cuda${major fileVersion}-archive.tar.xz"; - # https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-850/support-matrix/index.html - supportedCudaVersions = [ "11.0" "11.1" "11.2" "11.3" "11.4" "11.5" "11.6" "11.7" ]; - } - ]; - "8.6.0" = [ - rec { - fileVersion = "10.2"; - fullVersion = "8.6.0.163"; - hash = "sha256-t4sr/GrFqqdxu2VhaJQk5K1Xm/0lU4chXG8hVL09R9k="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/local_installers/${fileVersion}/cudnn-linux-x86_64-${fullVersion}_cuda${major fileVersion}-archive.tar.xz"; - # https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-860/support-matrix/index.html - supportedCudaVersions = [ "10.2" ]; - } - rec { - fileVersion = "11.8"; - fullVersion = "8.6.0.163"; - hash = "sha256-u8OW30cpTGV+3AnGAGdNYIyxv8gLgtz0VHBgwhcRFZ4="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/local_installers/${fileVersion}/cudnn-linux-x86_64-${fullVersion}_cuda${major fileVersion}-archive.tar.xz"; - # https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-860/support-matrix/index.html - supportedCudaVersions = [ "11.0" "11.1" "11.2" "11.3" "11.4" "11.5" "11.6" "11.7" "11.8" ]; - } - ]; - "8.7.0" = [ - rec { - fileVersion = "10.2"; - fullVersion = "8.7.0.84"; - hash = "sha256-bZhaqc8+GbPV2FQvvbbufd8VnEJgvfkICc2N3/gitRg="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/local_installers/${fileVersion}/cudnn-linux-x86_64-${fullVersion}_cuda${major fileVersion}-archive.tar.xz"; - # https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-870/support-matrix/index.html - supportedCudaVersions = [ "10.2" ]; - } - rec { - fileVersion = "11.8"; - fullVersion = "8.7.0.84"; - hash = "sha256-l2xMunIzyXrnQAavq1Fyl2MAukD1slCiH4z3H1nJ920="; - url = "${urlPrefix}/v${majorMinorPatch fullVersion}/local_installers/${fileVersion}/cudnn-linux-x86_64-${fullVersion}_cuda${major fileVersion}-archive.tar.xz"; - # https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-870/support-matrix/index.html - supportedCudaVersions = [ "11.0" "11.1" "11.2" "11.3" "11.4" "11.5" "11.6" "11.7" "11.8" ]; - } - ]; + # Reverse the list to have the latest release first + # cudnnReleases :: List Release + cudnnReleases = lists.reverseList (builtins.import ./releases.nix); + + # Check whether a CUDNN release supports our CUDA version + # supportedReleases :: NonEmptyList Release + supportedReleases = let + filtered = builtins.filter isSupported cudnnReleases; + nonEmptyFiltered = + trivial.throwIf (filtered == []) + '' + CUDNN does not support your cuda version ${cudaVersion} + '' + filtered; + in + nonEmptyFiltered; + + # The latest release is the first element of the list and will be our default choice + # latestReleaseName :: String + latestReleaseName = computeName (builtins.head supportedReleases).version; + + # Function to transform our releases into build attributes + # toBuildAttrs :: Release -> { name: String, value: Derivation } + toBuildAttrs = release: { + name = computeName release.version; + value = buildCuDnnPackage release; }; - # Default attributes - cuDnnDefaultVersion = { - "10.0" = "7.4.2"; - "10.1" = "8.0.5"; - "10.2" = "8.7.0"; - "11.0" = "8.7.0"; - "11.1" = "8.7.0"; - "11.2" = "8.7.0"; - "11.3" = "8.7.0"; - "11.4" = "8.7.0"; - "11.5" = "8.7.0"; - "11.6" = "8.7.0"; - "11.7" = "8.7.0"; - "11.8" = "8.7.0"; - }.${cudaVersion} or "8.7.0"; + # Add all supported builds as attributes + # allBuilds :: AttrSet String Derivation + allBuilds = builtins.listToAttrs (builtins.map toBuildAttrs supportedReleases); -in cuDnnPackages + # The latest release will be our default build + # defaultBuild :: AttrSet String Derivation + defaultBuild.cudnn = allBuilds.${latestReleaseName}; + + # builds :: AttrSet String Derivation + builds = allBuilds // defaultBuild; +in + builds diff --git a/pkgs/development/libraries/science/math/cudnn/generic.nix b/pkgs/development/libraries/science/math/cudnn/generic.nix index 773d130ba735..d4e1f641a956 100644 --- a/pkgs/development/libraries/science/math/cudnn/generic.nix +++ b/pkgs/development/libraries/science/math/cudnn/generic.nix @@ -1,113 +1,128 @@ -{ stdenv -, lib -, zlib -, useCudatoolkitRunfile ? false -, cudaVersion -, cudaMajorVersion -, cudatoolkit # if cuda>=11: only used for .cc -, libcublas ? null # cuda <11 doesn't ship redist packages -, autoPatchelfHook -, autoAddOpenGLRunpathHook -, fetchurl -, # The distributed version of CUDNN includes both dynamically liked .so files, +{ + stdenv, + lib, + zlib, + useCudatoolkitRunfile ? false, + cudaVersion, + cudaMajorVersion, + cudatoolkit, # if cuda>=11: only used for .cc + libcublas ? null, # cuda <11 doesn't ship redist packages + autoPatchelfHook, + autoAddOpenGLRunpathHook, + fetchurl, + # The distributed version of CUDNN includes both dynamically liked .so files, # as well as statically linked .a files. However, CUDNN is quite large # (multiple gigabytes), so you can save some space in your nix store by # removing the statically linked libraries if you are not using them. # # Setting this to true removes the statically linked .a files. # Setting this to false keeps these statically linked .a files. - removeStatic ? false + removeStatic ? false, +}: { + version, + url, + hash, + minCudaVersion, + maxCudaVersion, }: - -{ fullVersion -, url -, hash -, supportedCudaVersions ? [ ] -}: - -assert useCudatoolkitRunfile || (libcublas != null); - -let +assert useCudatoolkitRunfile || (libcublas != null); let inherit (cudatoolkit) cc; + inherit (lib) lists strings trivial versions; - majorMinorPatch = version: lib.concatStringsSep "." (lib.take 3 (lib.splitVersion version)); - version = majorMinorPatch fullVersion; + # majorMinorPatch :: String -> String + majorMinorPatch = (trivial.flip trivial.pipe) [ + (versions.splitVersion) + (lists.take 3) + (strings.concatStringsSep ".") + ]; + # versionTriple :: String + # Version with three components: major.minor.patch + versionTriple = majorMinorPatch version; + + # cudatoolkit_root :: Derivation cudatoolkit_root = if useCudatoolkitRunfile then cudatoolkit else libcublas; in -stdenv.mkDerivation { - pname = "cudatoolkit-${cudaMajorVersion}-cudnn"; - inherit version; + stdenv.mkDerivation { + pname = "cudatoolkit-${cudaMajorVersion}-cudnn"; + version = versionTriple; - src = fetchurl { - inherit url hash; - }; + src = fetchurl { + inherit url hash; + }; - # Check and normalize Runpath against DT_NEEDED using autoPatchelf. - # Prepend /run/opengl-driver/lib using addOpenGLRunpath for dlopen("libcudacuda.so") - nativeBuildInputs = [ - autoPatchelfHook - autoAddOpenGLRunpathHook - ]; + # Check and normalize Runpath against DT_NEEDED using autoPatchelf. + # Prepend /run/opengl-driver/lib using addOpenGLRunpath for dlopen("libcudacuda.so") + nativeBuildInputs = [ + autoPatchelfHook + autoAddOpenGLRunpathHook + ]; - # Used by autoPatchelfHook - buildInputs = [ - cc.cc.lib # libstdc++ - zlib - cudatoolkit_root - ]; + # Used by autoPatchelfHook + buildInputs = [ + cc.cc.lib # libstdc++ + zlib + cudatoolkit_root + ]; - # We used to patch Runpath here, but now we use autoPatchelfHook - # - # Note also that version <=8.3.0 contained a subdirectory "lib64/" but in - # version 8.3.2 it seems to have been renamed to simply "lib/". - installPhase = '' - runHook preInstall + # We used to patch Runpath here, but now we use autoPatchelfHook + # + # Note also that version <=8.3.0 contained a subdirectory "lib64/" but in + # version 8.3.2 it seems to have been renamed to simply "lib/". + installPhase = + '' + runHook preInstall - mkdir -p $out - cp -a include $out/include - [ -d "lib/" ] && cp -a lib $out/lib - [ -d "lib64/" ] && cp -a lib64 $out/lib64 - '' + lib.optionalString removeStatic '' - rm -f $out/lib/*.a - rm -f $out/lib64/*.a - '' + '' - runHook postInstall - ''; + mkdir -p $out + cp -a include $out/include + [ -d "lib/" ] && cp -a lib $out/lib + [ -d "lib64/" ] && cp -a lib64 $out/lib64 + '' + + strings.optionalString removeStatic '' + rm -f $out/lib/*.a + rm -f $out/lib64/*.a + '' + + '' + runHook postInstall + ''; - # Without --add-needed autoPatchelf forgets $ORIGIN on cuda>=8.0.5. - postFixup = lib.optionalString (lib.versionAtLeast fullVersion "8.0.5") '' - patchelf $out/lib/libcudnn.so --add-needed libcudnn_cnn_infer.so - ''; + # Without --add-needed autoPatchelf forgets $ORIGIN on cuda>=8.0.5. + postFixup = strings.optionalString (strings.versionAtLeast versionTriple "8.0.5") '' + patchelf $out/lib/libcudnn.so --add-needed libcudnn_cnn_infer.so + ''; - passthru = { - inherit useCudatoolkitRunfile; + passthru = { + inherit useCudatoolkitRunfile; - cudatoolkit = lib.warn '' - cudnn.cudatoolkit passthru attribute is deprecated; - if your derivation uses cudnn directly, it should probably consume cudaPackages instead - '' - cudatoolkit; + cudatoolkit = + trivial.warn + '' + cudnn.cudatoolkit passthru attribute is deprecated; + if your derivation uses cudnn directly, it should probably consume cudaPackages instead + '' + cudatoolkit; - majorVersion = lib.versions.major version; - }; + majorVersion = versions.major versionTriple; + }; - meta = with lib; { - # Check that the cudatoolkit version satisfies our min/max constraints (both - # inclusive). We mark the package as broken if it fails to satisfies the - # official version constraints (as recorded in default.nix). In some cases - # you _may_ be able to smudge version constraints, just know that you're - # embarking into unknown and unsupported territory when doing so. - broken = !(elem cudaVersion supportedCudaVersions); - description = "NVIDIA CUDA Deep Neural Network library (cuDNN)"; - homepage = "https://developer.nvidia.com/cudnn"; - sourceProvenance = with sourceTypes; [ binaryNativeCode ]; - # TODO: consider marking unfreRedistributable when not using runfile - license = licenses.unfree; - platforms = [ "x86_64-linux" ]; - maintainers = with maintainers; [ mdaiter samuela ]; - }; -} + meta = with lib; { + # Check that the cudatoolkit version satisfies our min/max constraints (both + # inclusive). We mark the package as broken if it fails to satisfies the + # official version constraints (as recorded in default.nix). In some cases + # you _may_ be able to smudge version constraints, just know that you're + # embarking into unknown and unsupported territory when doing so. + broken = + strings.versionOlder cudaVersion minCudaVersion + || strings.versionOlder maxCudaVersion cudaVersion; + description = "NVIDIA CUDA Deep Neural Network library (cuDNN)"; + homepage = "https://developer.nvidia.com/cudnn"; + sourceProvenance = with sourceTypes; [binaryNativeCode]; + # TODO: consider marking unfreRedistributable when not using runfile + license = licenses.unfree; + platforms = ["x86_64-linux"]; + maintainers = with maintainers; [mdaiter samuela]; + }; + } diff --git a/pkgs/development/libraries/science/math/cudnn/releases.nix b/pkgs/development/libraries/science/math/cudnn/releases.nix new file mode 100644 index 000000000000..9255ea9c2409 --- /dev/null +++ b/pkgs/development/libraries/science/math/cudnn/releases.nix @@ -0,0 +1,170 @@ +[ + { + version = "7.4.2.24"; + minCudaVersion = "10.0"; + maxCudaVersion = "10.0"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v7.4.2/cudnn-10.0-linux-x64-v7.4.2.24.tgz"; + hash = "sha256-Lt/IagK1DRfojEeJVaMy5qHoF05+U6NFi06lH68C2qM="; + } + { + version = "7.6.5.32"; + minCudaVersion = "10.0"; + maxCudaVersion = "10.0"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v7.6.5/cudnn-10.0-linux-x64-v7.6.5.32.tgz"; + hash = "sha256-KDVeOV8LK5OsLIO2E2CzW6bNA3fkTni+GXtrYbS0kro="; + } + { + version = "7.6.5.32"; + minCudaVersion = "10.1"; + maxCudaVersion = "10.1"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v7.6.5/cudnn-10.1-linux-x64-v7.6.5.32.tgz"; + hash = "sha256-fq7IA5osMKsLx1jTA1iHZ2k972v0myJIWiwAvy4TbLM="; + } + { + version = "7.6.5.32"; + minCudaVersion = "10.2"; + maxCudaVersion = "10.2"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v7.6.5/cudnn-10.2-linux-x64-v7.6.5.32.tgz"; + hash = "sha256-fq7IA5osMKsLx1jTA1iHZ2k972v0myJIWiwAvy4TbLN="; + } + { + version = "8.0.5.39"; + minCudaVersion = "10.1"; + maxCudaVersion = "10.1"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v8.0.5/cudnn-10.1-linux-x64-v8.0.5.39.tgz"; + hash = "sha256-kJCElSmIlrM6qVBjo0cfk8NmJ9esAcF9w211xl7qSgA="; + } + { + version = "8.0.5.39"; + minCudaVersion = "10.2"; + maxCudaVersion = "10.2"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v8.0.5/cudnn-10.2-linux-x64-v8.0.5.39.tgz"; + hash = "sha256-IfhMBcZ78eyFnnfDjM1b8VSWT6HDCPRJlZvkw1bjgvM="; + } + { + version = "8.0.5.39"; + minCudaVersion = "11.0"; + maxCudaVersion = "11.0"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v8.0.5/cudnn-11.0-linux-x64-v8.0.5.39.tgz"; + hash = "sha256-ThbueJXetKixwZS4ErpJWG730mkCBRQB03F1EYmKm3M="; + } + { + version = "8.0.5.39"; + minCudaVersion = "11.1"; + maxCudaVersion = "11.1"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v8.0.5/cudnn-11.1-linux-x64-v8.0.5.39.tgz"; + hash = "sha256-HQRr+nk5navMb2yxUHkYdUQ5RC6gyp4Pvs3URvmwDM4="; + } + { + version = "8.1.1.33"; + minCudaVersion = "10.2"; + maxCudaVersion = "10.2"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v8.1.1/cudnn-10.2-linux-x64-v8.1.1.33.tgz"; + hash = "sha256-Kkp7mabpv6aQ6xm7QeSVU/KnpJGls6v8rpAOFmxbbr0="; + } + { + version = "8.1.1.33"; + minCudaVersion = "11.0"; + maxCudaVersion = "11.2"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v8.1.1/cudnn-11.2-linux-x64-v8.1.1.33.tgz"; + hash = "sha256-mKh4TpKGLyABjSDCgbMNSgzZUfk2lPZDPM9K6cUCumo="; + } + { + version = "8.2.4.15"; + minCudaVersion = "10.2"; + maxCudaVersion = "10.2"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v8.2.4/cudnn-10.2-linux-x64-v8.2.4.15.tgz"; + hash = "sha256-0jyUoxFaHHcRamwSfZF1+/WfcjNkN08mo0aZB18yIvE="; + } + { + version = "8.2.4.15"; + minCudaVersion = "11.0"; + maxCudaVersion = "11.4"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v8.2.4/cudnn-11.4-linux-x64-v8.2.4.15.tgz"; + hash = "sha256-Dl0t+JC5ln76ZhnaQhMQ2XMjVlp58FoajLm3Fluq0Nc="; + } + { + version = "8.3.3.40"; + minCudaVersion = "10.2"; + maxCudaVersion = "10.2"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v8.3.3/local_installers/10.2/cudnn-linux-x86_64-8.3.3.40_cuda10.2-archive.tar.xz"; + hash = "sha256-2FVPKzLmKV1fyPOsJeaPlAWLAYyAHaucFD42gS+JJqs="; + } + { + version = "8.3.3.40"; + minCudaVersion = "11.0"; + maxCudaVersion = "11.6"; + url = "https://developer.download.nvidia.com/compute/redist/cudnn/v8.3.3/local_installers/11.5/cudnn-linux-x86_64-8.3.3.40_cuda11.5-archive.tar.xz"; + hash = "sha256-6r6Wx1zwPqT1N5iU2RTx+K4UzqsSGYnoSwg22Sf7dzE="; + } + { + version = "8.4.1.50"; + minCudaVersion = "10.2"; + maxCudaVersion = "10.2"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.4.1.50_cuda10.2-archive.tar.xz"; + hash = "sha256-I88qMmU6lIiLVmaPuX7TTbisgTav839mssxUo3lQNjg="; + } + { + version = "8.4.1.50"; + minCudaVersion = "11.0"; + maxCudaVersion = "11.7"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.4.1.50_cuda11.6-archive.tar.xz"; + hash = "sha256-7JbSN22B/KQr3T1MPXBambKaBlurV/kgVhx2PinGfQE="; + } + { + version = "8.5.0.96"; + minCudaVersion = "10.2"; + maxCudaVersion = "10.2"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.5.0.96_cuda10-archive.tar.xz"; + hash = "sha256-1mzhbbzR40WKkHnQLtJHhg0vYgf7G8a0OBcCwIOkJjM="; + } + { + version = "8.5.0.96"; + minCudaVersion = "11.0"; + maxCudaVersion = "11.7"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.5.0.96_cuda11-archive.tar.xz"; + hash = "sha256-VFSm/ZTwCHKMqumtrZk8ToXvNjAuJrzkO+p9RYpee20="; + } + { + version = "8.6.0.163"; + minCudaVersion = "10.2"; + maxCudaVersion = "10.2"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.6.0.163_cuda10-archive.tar.xz"; + hash = "sha256-t4sr/GrFqqdxu2VhaJQk5K1Xm/0lU4chXG8hVL09R9k="; + } + { + version = "8.6.0.163"; + minCudaVersion = "11.0"; + maxCudaVersion = "11.8"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.6.0.163_cuda11-archive.tar.xz"; + hash = "sha256-u8OW30cpTGV+3AnGAGdNYIyxv8gLgtz0VHBgwhcRFZ4="; + } + { + version = "8.7.0.84"; + minCudaVersion = "10.2"; + maxCudaVersion = "10.2"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.7.0.84_cuda10-archive.tar.xz"; + hash = "sha256-bZhaqc8+GbPV2FQvvbbufd8VnEJgvfkICc2N3/gitRg="; + } + { + version = "8.7.0.84"; + minCudaVersion = "11.0"; + maxCudaVersion = "11.8"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.7.0.84_cuda11-archive.tar.xz"; + hash = "sha256-l2xMunIzyXrnQAavq1Fyl2MAukD1slCiH4z3H1nJ920="; + } + { + version = "8.8.0.121"; + minCudaVersion = "11.0"; + maxCudaVersion = "11.8"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.8.0.121_cuda11-archive.tar.xz"; + hash = "sha256-YgRkdgdtG0VfsT+3izjTSWusr7/bsElPszkiQKBEZuo="; + } + { + version = "8.8.0.121"; + minCudaVersion = "12.0"; + maxCudaVersion = "12.0"; + url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.8.0.121_cuda12-archive.tar.xz"; + hash = "sha256-oHkrZmyq9ZOp3UEwl5V4/Tp4Iw9EB2RcKVcA7456qvI="; + } +]