2022-04-03 11:19:04 +02:00
|
|
|
{ lib
|
|
|
|
, pkgs
|
|
|
|
, cudaVersion
|
|
|
|
}:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
scope = makeScope pkgs.newScope (final: {
|
|
|
|
# Here we put package set configuration and utility functions.
|
|
|
|
inherit cudaVersion;
|
|
|
|
cudaMajorVersion = versions.major final.cudaVersion;
|
|
|
|
cudaMajorMinorVersion = lib.versions.majorMinor final.cudaVersion;
|
|
|
|
inherit lib pkgs;
|
|
|
|
|
|
|
|
addBuildInputs = drv: buildInputs: drv.overrideAttrs (oldAttrs: {
|
|
|
|
buildInputs = (oldAttrs.buildInputs or []) ++ buildInputs;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
cutensorExtension = final: prev: let
|
|
|
|
### CuTensor
|
|
|
|
|
|
|
|
buildCuTensorPackage = final.callPackage ../development/libraries/science/math/cutensor/generic.nix;
|
|
|
|
|
2023-11-27 18:36:26 +01:00
|
|
|
# FIXME: Include non-x86_64 platforms
|
2022-04-03 11:19:04 +02:00
|
|
|
cuTensorVersions = {
|
|
|
|
"1.2.2.5" = {
|
|
|
|
hash = "sha256-lU7iK4DWuC/U3s1Ct/rq2Gr3w4F2U7RYYgpmF05bibY=";
|
|
|
|
};
|
2022-10-22 04:45:15 +02:00
|
|
|
"1.5.0.3" = {
|
|
|
|
hash = "sha256-T96+lPC6OTOkIs/z3QWg73oYVSyidN0SVkBWmT9VRx0=";
|
2022-04-03 11:19:04 +02:00
|
|
|
};
|
2023-11-27 18:36:26 +01:00
|
|
|
"2.0.0.7" = {
|
|
|
|
hash = "sha256-32M4rtGOW2rgxJUhBT0WBtKkHhh9f17M+RgK9rvE72g=";
|
|
|
|
};
|
2022-04-03 11:19:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
inherit (final) cudaMajorMinorVersion cudaMajorVersion;
|
|
|
|
|
2023-11-27 18:36:26 +01:00
|
|
|
cudaToCutensor = {
|
|
|
|
"10" = "1.2.25";
|
|
|
|
"11" = "1.5.0.3";
|
|
|
|
"12" = "2.0.0.7";
|
|
|
|
};
|
|
|
|
|
|
|
|
versionNewer = lib.flip lib.versionOlder;
|
|
|
|
latestVersion = (builtins.head (lib.sort versionNewer (builtins.attrNames cuTensorVersions)));
|
|
|
|
|
2022-04-03 11:19:04 +02:00
|
|
|
cutensor = buildCuTensorPackage rec {
|
2023-11-27 18:36:26 +01:00
|
|
|
version = cudaToCutensor.${cudaMajorVersion} or latestVersion;
|
2022-04-03 11:19:04 +02:00
|
|
|
inherit (cuTensorVersions.${version}) hash;
|
|
|
|
# This can go into generic.nix
|
|
|
|
libPath = "lib/${if cudaMajorVersion == "10" then cudaMajorMinorVersion else cudaMajorVersion}";
|
|
|
|
};
|
|
|
|
in { inherit cutensor; };
|
|
|
|
|
|
|
|
extraPackagesExtension = final: prev: {
|
|
|
|
|
|
|
|
nccl = final.callPackage ../development/libraries/science/math/nccl { };
|
|
|
|
|
2023-06-27 00:45:56 +02:00
|
|
|
nccl-tests = final.callPackage ../development/libraries/science/math/nccl/tests.nix { };
|
|
|
|
|
2022-04-03 11:19:04 +02:00
|
|
|
autoAddOpenGLRunpathHook = final.callPackage ( { makeSetupHook, addOpenGLRunpath }:
|
|
|
|
makeSetupHook {
|
|
|
|
name = "auto-add-opengl-runpath-hook";
|
2023-01-01 21:10:24 +01:00
|
|
|
propagatedBuildInputs = [
|
2022-04-03 11:19:04 +02:00
|
|
|
addOpenGLRunpath
|
|
|
|
];
|
|
|
|
} ../development/compilers/cudatoolkit/auto-add-opengl-runpath-hook.sh
|
|
|
|
) {};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2022-06-21 05:36:41 +02:00
|
|
|
composedExtension = composeManyExtensions ([
|
2022-04-03 11:19:04 +02:00
|
|
|
extraPackagesExtension
|
|
|
|
(import ../development/compilers/cudatoolkit/extension.nix)
|
|
|
|
(import ../development/compilers/cudatoolkit/redist/extension.nix)
|
|
|
|
(import ../development/compilers/cudatoolkit/redist/overrides.nix)
|
|
|
|
(import ../development/libraries/science/math/cudnn/extension.nix)
|
2022-07-01 23:53:27 +02:00
|
|
|
(import ../development/libraries/science/math/tensorrt/extension.nix)
|
2022-04-03 11:19:04 +02:00
|
|
|
(import ../test/cuda/cuda-samples/extension.nix)
|
|
|
|
(import ../test/cuda/cuda-library-samples/extension.nix)
|
|
|
|
cutensorExtension
|
2022-07-01 23:53:27 +02:00
|
|
|
]);
|
2022-04-03 11:19:04 +02:00
|
|
|
|
2023-08-14 07:21:26 +02:00
|
|
|
in (scope.overrideScope composedExtension)
|