Loading maintainers/maintainer-list.nix +6 −0 Original line number Diff line number Diff line Loading @@ -21609,6 +21609,12 @@ githubId = 529649; name = "Raffael Mancini"; }; sepiabrown = { email = "bboxone@gmail.com"; github = "sepiabrown"; githubId = 35622998; name = "Suwon Park"; }; seppeljordan = { email = "sebastian.jordan.mail@googlemail.com"; github = "seppeljordan"; Loading pkgs/development/cuda-modules/cuda-library-samples/generic.nix +61 −2 Original line number Diff line number Diff line Loading @@ -4,17 +4,30 @@ fetchFromGitHub, cmake, addDriverRunpath, autoAddDriverRunpath, cudatoolkit, cutensor, cusparselt, cudaPackages, setupCudaHook, autoPatchelfHook, }: let rev = "5aab680905d853bce0dbad4c488e4f7e9f7b2302"; inherit (cudaPackages) cuda_cccl cuda_cudart cuda_nvcc libcusparse cudaAtLeast cudaOlder ; rev = "e57b9c483c5384b7b97b7d129457e5a9bdcdb5e1"; src = fetchFromGitHub { owner = "NVIDIA"; repo = "CUDALibrarySamples"; inherit rev; sha256 = "0gwgbkq05ygrfgg5hk07lmap7n7ampxv0ha1axrv8qb748ph81xs"; sha256 = "0g17afsmb8am0darxchqgjz1lmkaihmnn7k1x4ahg5gllcmw8k3l"; }; commonAttrs = { version = lib.strings.substring 0 7 rev + "-" + lib.versions.majorMinor cudatoolkit.version; Loading Loading @@ -83,4 +96,50 @@ in CUTENSOR_ROOT = cutensor; } ); cusparselt = backendStdenv.mkDerivation ( commonAttrs // { pname = "cuda-library-samples-cusparselt"; src = "${src}/cuSPARSELt"; sourceRoot = "cuSPARSELt/matmul"; buildInputs = lib.optionals (cudaOlder "11.4") [ cudatoolkit ]; nativeBuildInputs = [ cmake addDriverRunpath (lib.getDev cusparselt) (lib.getDev libcusparse) ] ++ lib.optionals (cudaOlder "11.4") [ cudatoolkit ] ++ lib.optionals (cudaAtLeast "11.4") [ cuda_nvcc (lib.getDev cuda_cudart) # <cuda_runtime_api.h> ] ++ lib.optionals (cudaAtLeast "12.0") [ cuda_cccl # <nv/target> ]; postPatch = '' substituteInPlace CMakeLists.txt \ --replace-fail "''${CUSPARSELT_ROOT}/lib64/libcusparseLt.so" "${lib.getLib cusparselt}/lib/libcusparseLt.so" \ --replace-fail "''${CUSPARSELT_ROOT}/lib64/libcusparseLt_static.a" "${lib.getStatic cusparselt}/lib/libcusparseLt_static.a" ''; installPhase = '' runHook preInstall mkdir -p $out/bin cp matmul_example $out/bin/ cp matmul_example_static $out/bin/ runHook postInstall ''; CUDA_TOOLKIT_PATH = lib.getLib cudatoolkit; CUSPARSELT_PATH = lib.getLib cusparselt; } ); } pkgs/development/cuda-modules/cusparselt/extension.nix 0 → 100644 +144 −0 Original line number Diff line number Diff line # Support matrix can be found at # https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-880/support-matrix/index.html { lib, stdenv, cudaVersion, flags, mkVersionedPackageName, }: let inherit (lib) attrsets lists modules versions strings trivial ; inherit (stdenv) hostPlatform; redistName = "cusparselt"; pname = "libcusparse_lt"; cusparseltVersions = [ "0.7.1" ]; # Manifests :: { redistrib, feature } # Each release of cusparselt gets mapped to an evaluated module for that release. # From there, we can get the min/max CUDA versions supported by that release. # listOfManifests :: List Manifests listOfManifests = let configEvaluator = fullCusparseltVersion: modules.evalModules { modules = [ ../modules # We need to nest the manifests in a config.cusparselt.manifests attribute so the # module system can evaluate them. { cusparselt.manifests = { redistrib = trivial.importJSON (./manifests + "/redistrib_${fullCusparseltVersion}.json"); feature = trivial.importJSON (./manifests + "/feature_${fullCusparseltVersion}.json"); }; } ]; }; # Un-nest the manifests attribute set. releaseGrabber = evaluatedModules: evaluatedModules.config.cusparselt.manifests; in lists.map (trivial.flip trivial.pipe [ configEvaluator releaseGrabber ]) cusparseltVersions; # Our cudaVersion tells us which version of CUDA we're building against. # The subdirectories in lib/ tell us which versions of CUDA are supported. # Typically the names will look like this: # # - 10.2 # - 11 # - 11.0 # - 12 # libPath :: String libPath = let cudaMajorMinor = versions.majorMinor cudaVersion; cudaMajor = versions.major cudaVersion; in if cudaMajorMinor == "10.2" then cudaMajorMinor else cudaMajor; # A release is supported if it has a libPath that matches our CUDA version for our platform. # LibPath are not constant across the same release -- one platform may support fewer # CUDA versions than another. # redistArch :: String redistArch = flags.getRedistArch hostPlatform.system; # platformIsSupported :: Manifests -> Boolean platformIsSupported = { feature, redistrib, ... }: (attrsets.attrByPath [ pname redistArch ] null feature) != null; # TODO(@connorbaker): With an auxiliary file keeping track of the CUDA versions each release supports, # we could filter out releases that don't support our CUDA version. # However, we don't have that currently, so we make a best-effort to try to build TensorRT with whatever # libPath corresponds to our CUDA version. # supportedManifests :: List Manifests supportedManifests = builtins.filter platformIsSupported listOfManifests; # Compute versioned attribute name to be used in this package set # Patch version changes should not break the build, so we only use major and minor # computeName :: RedistribRelease -> String computeName = { version, ... }: mkVersionedPackageName redistName version; in final: _: let # buildCusparseltPackage :: Manifests -> AttrSet Derivation buildCusparseltPackage = { redistrib, feature }: let drv = final.callPackage ../generic-builders/manifest.nix { inherit pname redistName; redistribRelease = redistrib.${pname}; featureRelease = feature.${pname}; }; fixedDrv = drv.overrideAttrs (prevAttrs: { buildInputs = prevAttrs.buildInputs ++ lists.optionals (strings.versionOlder cudaVersion "11.4") [ final.cudatoolkit ] ++ lists.optionals (strings.versionAtLeast cudaVersion "11.4") ( [ final.libcublas.lib ] # For some reason, the 1.4.x release of cusparselt requires the cudart library. ++ lists.optionals (strings.hasPrefix "1.4" redistrib.${pname}.version) [ final.cuda_cudart.lib ] ); meta = prevAttrs.meta // { description = "cuSPARSELt: A High-Performance CUDA Library for Sparse Matrix-Matrix Multiplication"; homepage = "https://developer.nvidia.com/cusparselt-downloads"; maintainers = prevAttrs.meta.maintainers ++ [ lib.maintainers.sepiabrown ]; license = lib.licenses.unfreeRedistributable // { shortName = "cuSPARSELt EULA"; fullName = "cuSPARSELt SUPPLEMENT TO SOFTWARE LICENSE AGREEMENT FOR NVIDIA SOFTWARE DEVELOPMENT KITS"; url = "https://docs.nvidia.com/cuda/cusparselt/license.html"; }; }; }); in attrsets.nameValuePair (computeName redistrib.${pname}) fixedDrv; extension = let nameOfNewest = computeName (lists.last supportedManifests).redistrib.${pname}; drvs = builtins.listToAttrs (lists.map buildCusparseltPackage supportedManifests); containsDefault = attrsets.optionalAttrs (drvs != { }) { cusparselt = drvs.${nameOfNewest}; }; in drvs // containsDefault; in extension pkgs/development/cuda-modules/cusparselt/manifests/feature_0.7.1.json 0 → 100644 +44 −0 Original line number Diff line number Diff line { "libcusparse_lt": { "linux-aarch64": { "outputs": { "bin": false, "dev": true, "doc": false, "lib": true, "sample": false, "static": true } }, "linux-sbsa": { "outputs": { "bin": false, "dev": true, "doc": false, "lib": true, "sample": false, "static": true } }, "linux-x86_64": { "outputs": { "bin": false, "dev": true, "doc": false, "lib": true, "sample": false, "static": true } }, "windows-x86_64": { "outputs": { "bin": false, "dev": true, "doc": false, "lib": false, "sample": false, "static": false } } } } pkgs/development/cuda-modules/cusparselt/manifests/redistrib_0.7.1.json 0 → 100644 +35 −0 Original line number Diff line number Diff line { "release_date": "2025-02-25", "release_label": "0.7.1", "release_product": "cusparselt", "libcusparse_lt": { "name": "NVIDIA cuSPARSELt", "license": "cuSPARSELt", "license_path": "libcusparse_lt/LICENSE.txt", "version": "0.7.1.0", "linux-x86_64": { "relative_path": "libcusparse_lt/linux-x86_64/libcusparse_lt-linux-x86_64-0.7.1.0-archive.tar.xz", "sha256": "a0d885837887c73e466a31b4e86aaae2b7d0cc9c5de0d40921dbe2a15dbd6a88", "md5": "b2e5f3c9b9d69e1e0b55b16de33fdc6e", "size": "353151840" }, "linux-sbsa": { "relative_path": "libcusparse_lt/linux-sbsa/libcusparse_lt-linux-sbsa-0.7.1.0-archive.tar.xz", "sha256": "4a131d0a54728e53ba536b50bb65380603456f1656e7df8ee52e285618a0b57c", "md5": "612a712c7da6e801ee773687e99af87e", "size": "352406784" }, "windows-x86_64": { "relative_path": "libcusparse_lt/windows-x86_64/libcusparse_lt-windows-x86_64-0.7.1.0-archive.zip", "sha256": "004bcb1b700c24ca8d60a8ddd2124640f61138a6c29914d2afaa0bfa0d0e3cf2", "md5": "a1d8df8dc8ff4b3bd0e859f992f8f392", "size": "268594665" }, "linux-aarch64": { "relative_path": "libcusparse_lt/linux-aarch64/libcusparse_lt-linux-aarch64-0.7.1.0-archive.tar.xz", "sha256": "d3b0a660fd552e0bd9a4491b15299d968674833483d5f164cfea35e70646136c", "md5": "54e3f3b28c94118991ce54ec38f531fb", "size": "5494380" } } } Loading
maintainers/maintainer-list.nix +6 −0 Original line number Diff line number Diff line Loading @@ -21609,6 +21609,12 @@ githubId = 529649; name = "Raffael Mancini"; }; sepiabrown = { email = "bboxone@gmail.com"; github = "sepiabrown"; githubId = 35622998; name = "Suwon Park"; }; seppeljordan = { email = "sebastian.jordan.mail@googlemail.com"; github = "seppeljordan"; Loading
pkgs/development/cuda-modules/cuda-library-samples/generic.nix +61 −2 Original line number Diff line number Diff line Loading @@ -4,17 +4,30 @@ fetchFromGitHub, cmake, addDriverRunpath, autoAddDriverRunpath, cudatoolkit, cutensor, cusparselt, cudaPackages, setupCudaHook, autoPatchelfHook, }: let rev = "5aab680905d853bce0dbad4c488e4f7e9f7b2302"; inherit (cudaPackages) cuda_cccl cuda_cudart cuda_nvcc libcusparse cudaAtLeast cudaOlder ; rev = "e57b9c483c5384b7b97b7d129457e5a9bdcdb5e1"; src = fetchFromGitHub { owner = "NVIDIA"; repo = "CUDALibrarySamples"; inherit rev; sha256 = "0gwgbkq05ygrfgg5hk07lmap7n7ampxv0ha1axrv8qb748ph81xs"; sha256 = "0g17afsmb8am0darxchqgjz1lmkaihmnn7k1x4ahg5gllcmw8k3l"; }; commonAttrs = { version = lib.strings.substring 0 7 rev + "-" + lib.versions.majorMinor cudatoolkit.version; Loading Loading @@ -83,4 +96,50 @@ in CUTENSOR_ROOT = cutensor; } ); cusparselt = backendStdenv.mkDerivation ( commonAttrs // { pname = "cuda-library-samples-cusparselt"; src = "${src}/cuSPARSELt"; sourceRoot = "cuSPARSELt/matmul"; buildInputs = lib.optionals (cudaOlder "11.4") [ cudatoolkit ]; nativeBuildInputs = [ cmake addDriverRunpath (lib.getDev cusparselt) (lib.getDev libcusparse) ] ++ lib.optionals (cudaOlder "11.4") [ cudatoolkit ] ++ lib.optionals (cudaAtLeast "11.4") [ cuda_nvcc (lib.getDev cuda_cudart) # <cuda_runtime_api.h> ] ++ lib.optionals (cudaAtLeast "12.0") [ cuda_cccl # <nv/target> ]; postPatch = '' substituteInPlace CMakeLists.txt \ --replace-fail "''${CUSPARSELT_ROOT}/lib64/libcusparseLt.so" "${lib.getLib cusparselt}/lib/libcusparseLt.so" \ --replace-fail "''${CUSPARSELT_ROOT}/lib64/libcusparseLt_static.a" "${lib.getStatic cusparselt}/lib/libcusparseLt_static.a" ''; installPhase = '' runHook preInstall mkdir -p $out/bin cp matmul_example $out/bin/ cp matmul_example_static $out/bin/ runHook postInstall ''; CUDA_TOOLKIT_PATH = lib.getLib cudatoolkit; CUSPARSELT_PATH = lib.getLib cusparselt; } ); }
pkgs/development/cuda-modules/cusparselt/extension.nix 0 → 100644 +144 −0 Original line number Diff line number Diff line # Support matrix can be found at # https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-880/support-matrix/index.html { lib, stdenv, cudaVersion, flags, mkVersionedPackageName, }: let inherit (lib) attrsets lists modules versions strings trivial ; inherit (stdenv) hostPlatform; redistName = "cusparselt"; pname = "libcusparse_lt"; cusparseltVersions = [ "0.7.1" ]; # Manifests :: { redistrib, feature } # Each release of cusparselt gets mapped to an evaluated module for that release. # From there, we can get the min/max CUDA versions supported by that release. # listOfManifests :: List Manifests listOfManifests = let configEvaluator = fullCusparseltVersion: modules.evalModules { modules = [ ../modules # We need to nest the manifests in a config.cusparselt.manifests attribute so the # module system can evaluate them. { cusparselt.manifests = { redistrib = trivial.importJSON (./manifests + "/redistrib_${fullCusparseltVersion}.json"); feature = trivial.importJSON (./manifests + "/feature_${fullCusparseltVersion}.json"); }; } ]; }; # Un-nest the manifests attribute set. releaseGrabber = evaluatedModules: evaluatedModules.config.cusparselt.manifests; in lists.map (trivial.flip trivial.pipe [ configEvaluator releaseGrabber ]) cusparseltVersions; # Our cudaVersion tells us which version of CUDA we're building against. # The subdirectories in lib/ tell us which versions of CUDA are supported. # Typically the names will look like this: # # - 10.2 # - 11 # - 11.0 # - 12 # libPath :: String libPath = let cudaMajorMinor = versions.majorMinor cudaVersion; cudaMajor = versions.major cudaVersion; in if cudaMajorMinor == "10.2" then cudaMajorMinor else cudaMajor; # A release is supported if it has a libPath that matches our CUDA version for our platform. # LibPath are not constant across the same release -- one platform may support fewer # CUDA versions than another. # redistArch :: String redistArch = flags.getRedistArch hostPlatform.system; # platformIsSupported :: Manifests -> Boolean platformIsSupported = { feature, redistrib, ... }: (attrsets.attrByPath [ pname redistArch ] null feature) != null; # TODO(@connorbaker): With an auxiliary file keeping track of the CUDA versions each release supports, # we could filter out releases that don't support our CUDA version. # However, we don't have that currently, so we make a best-effort to try to build TensorRT with whatever # libPath corresponds to our CUDA version. # supportedManifests :: List Manifests supportedManifests = builtins.filter platformIsSupported listOfManifests; # Compute versioned attribute name to be used in this package set # Patch version changes should not break the build, so we only use major and minor # computeName :: RedistribRelease -> String computeName = { version, ... }: mkVersionedPackageName redistName version; in final: _: let # buildCusparseltPackage :: Manifests -> AttrSet Derivation buildCusparseltPackage = { redistrib, feature }: let drv = final.callPackage ../generic-builders/manifest.nix { inherit pname redistName; redistribRelease = redistrib.${pname}; featureRelease = feature.${pname}; }; fixedDrv = drv.overrideAttrs (prevAttrs: { buildInputs = prevAttrs.buildInputs ++ lists.optionals (strings.versionOlder cudaVersion "11.4") [ final.cudatoolkit ] ++ lists.optionals (strings.versionAtLeast cudaVersion "11.4") ( [ final.libcublas.lib ] # For some reason, the 1.4.x release of cusparselt requires the cudart library. ++ lists.optionals (strings.hasPrefix "1.4" redistrib.${pname}.version) [ final.cuda_cudart.lib ] ); meta = prevAttrs.meta // { description = "cuSPARSELt: A High-Performance CUDA Library for Sparse Matrix-Matrix Multiplication"; homepage = "https://developer.nvidia.com/cusparselt-downloads"; maintainers = prevAttrs.meta.maintainers ++ [ lib.maintainers.sepiabrown ]; license = lib.licenses.unfreeRedistributable // { shortName = "cuSPARSELt EULA"; fullName = "cuSPARSELt SUPPLEMENT TO SOFTWARE LICENSE AGREEMENT FOR NVIDIA SOFTWARE DEVELOPMENT KITS"; url = "https://docs.nvidia.com/cuda/cusparselt/license.html"; }; }; }); in attrsets.nameValuePair (computeName redistrib.${pname}) fixedDrv; extension = let nameOfNewest = computeName (lists.last supportedManifests).redistrib.${pname}; drvs = builtins.listToAttrs (lists.map buildCusparseltPackage supportedManifests); containsDefault = attrsets.optionalAttrs (drvs != { }) { cusparselt = drvs.${nameOfNewest}; }; in drvs // containsDefault; in extension
pkgs/development/cuda-modules/cusparselt/manifests/feature_0.7.1.json 0 → 100644 +44 −0 Original line number Diff line number Diff line { "libcusparse_lt": { "linux-aarch64": { "outputs": { "bin": false, "dev": true, "doc": false, "lib": true, "sample": false, "static": true } }, "linux-sbsa": { "outputs": { "bin": false, "dev": true, "doc": false, "lib": true, "sample": false, "static": true } }, "linux-x86_64": { "outputs": { "bin": false, "dev": true, "doc": false, "lib": true, "sample": false, "static": true } }, "windows-x86_64": { "outputs": { "bin": false, "dev": true, "doc": false, "lib": false, "sample": false, "static": false } } } }
pkgs/development/cuda-modules/cusparselt/manifests/redistrib_0.7.1.json 0 → 100644 +35 −0 Original line number Diff line number Diff line { "release_date": "2025-02-25", "release_label": "0.7.1", "release_product": "cusparselt", "libcusparse_lt": { "name": "NVIDIA cuSPARSELt", "license": "cuSPARSELt", "license_path": "libcusparse_lt/LICENSE.txt", "version": "0.7.1.0", "linux-x86_64": { "relative_path": "libcusparse_lt/linux-x86_64/libcusparse_lt-linux-x86_64-0.7.1.0-archive.tar.xz", "sha256": "a0d885837887c73e466a31b4e86aaae2b7d0cc9c5de0d40921dbe2a15dbd6a88", "md5": "b2e5f3c9b9d69e1e0b55b16de33fdc6e", "size": "353151840" }, "linux-sbsa": { "relative_path": "libcusparse_lt/linux-sbsa/libcusparse_lt-linux-sbsa-0.7.1.0-archive.tar.xz", "sha256": "4a131d0a54728e53ba536b50bb65380603456f1656e7df8ee52e285618a0b57c", "md5": "612a712c7da6e801ee773687e99af87e", "size": "352406784" }, "windows-x86_64": { "relative_path": "libcusparse_lt/windows-x86_64/libcusparse_lt-windows-x86_64-0.7.1.0-archive.zip", "sha256": "004bcb1b700c24ca8d60a8ddd2124640f61138a6c29914d2afaa0bfa0d0e3cf2", "md5": "a1d8df8dc8ff4b3bd0e859f992f8f392", "size": "268594665" }, "linux-aarch64": { "relative_path": "libcusparse_lt/linux-aarch64/libcusparse_lt-linux-aarch64-0.7.1.0-archive.tar.xz", "sha256": "d3b0a660fd552e0bd9a4491b15299d968674833483d5f164cfea35e70646136c", "md5": "54e3f3b28c94118991ce54ec38f531fb", "size": "5494380" } } }