cudaPackages_12.cutensor: init and fix

This commit is contained in:
Someone Serge 2023-11-27 17:36:26 +00:00
parent 6c63202052
commit 0dc161b2f8
No known key found for this signature in database
GPG Key ID: 7B0E3B1390D61DA4
2 changed files with 36 additions and 8 deletions

View File

@ -1,7 +1,11 @@
{ stdenv
, lib
, libPath
, cuda_cudart
, cudaMajorVersion
, cuda_nvcc
, cudatoolkit
, libcublas
, fetchurl
, autoPatchelfHook
, addOpenGLRunpath
@ -17,7 +21,7 @@ let
in
stdenv.mkDerivation {
pname = "cudatoolkit-${cudatoolkit.majorVersion}-cutensor";
pname = "cutensor-cu${cudaMajorVersion}";
inherit version;
src = fetchurl {
@ -32,20 +36,27 @@ stdenv.mkDerivation {
nativeBuildInputs = [
autoPatchelfHook
addOpenGLRunpath
cuda_nvcc
];
buildInputs = [
stdenv.cc.cc.lib
];
propagatedBuildInputs = [
cudatoolkit
cuda_cudart
libcublas
];
# Set RUNPATH so that libcuda in /run/opengl-driver(-32)/lib can be found.
# See the explanation in addOpenGLRunpath.
installPhase = ''
mkdir -p "$out" "$dev"
if [[ ! -d "${libPath}" ]] ; then
echo "Cutensor: ${libPath} does not exist, only found:" >&2
find "$(dirname ${libPath})"/ -maxdepth 1 >&2
echo "This cutensor release might not support your cudatoolkit version" >&2
exit 1
fi
mv include "$dev"
mv ${libPath} "$out/lib"
@ -58,7 +69,7 @@ stdenv.mkDerivation {
'';
passthru = {
inherit cudatoolkit;
cudatoolkit = lib.warn "cutensor.passthru: cudaPackages.cudatoolkit is deprecated" cudatoolkit;
majorVersion = lib.versions.major version;
};
@ -66,7 +77,11 @@ stdenv.mkDerivation {
description = "cuTENSOR: A High-Performance CUDA Library For Tensor Primitives";
homepage = "https://developer.nvidia.com/cutensor";
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
license = licenses.unfree;
license = licenses.unfreeRedistributable // {
shortName = "cuTENSOR EULA";
name = "cuTENSOR SUPPLEMENT TO SOFTWARE LICENSE AGREEMENT FOR NVIDIA SOFTWARE DEVELOPMENT KITS";
url = "https://docs.nvidia.com/cuda/cutensor/license.html";
};
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ obsidian-systems-maintenance ];
};

View File

@ -24,6 +24,7 @@ let
buildCuTensorPackage = final.callPackage ../development/libraries/science/math/cutensor/generic.nix;
# FIXME: Include non-x86_64 platforms
cuTensorVersions = {
"1.2.2.5" = {
hash = "sha256-lU7iK4DWuC/U3s1Ct/rq2Gr3w4F2U7RYYgpmF05bibY=";
@ -31,12 +32,24 @@ let
"1.5.0.3" = {
hash = "sha256-T96+lPC6OTOkIs/z3QWg73oYVSyidN0SVkBWmT9VRx0=";
};
"2.0.0.7" = {
hash = "sha256-32M4rtGOW2rgxJUhBT0WBtKkHhh9f17M+RgK9rvE72g=";
};
};
inherit (final) cudaMajorMinorVersion cudaMajorVersion;
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)));
cutensor = buildCuTensorPackage rec {
version = if cudaMajorMinorVersion == "10.1" then "1.2.2.5" else "1.5.0.3";
version = cudaToCutensor.${cudaMajorVersion} or latestVersion;
inherit (cuTensorVersions.${version}) hash;
# This can go into generic.nix
libPath = "lib/${if cudaMajorVersion == "10" then cudaMajorMinorVersion else cudaMajorVersion}";