From 810599277409a7d564c159983f3bb4a51aed1ea3 Mon Sep 17 00:00:00 2001 From: Someone Serge Date: Sat, 9 Dec 2023 00:50:05 +0000 Subject: [PATCH 1/2] cudaPackages.cudatoolkit: propagate the hook to nativeBuildInputs correctly --- pkgs/development/cuda-modules/cudatoolkit/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/cuda-modules/cudatoolkit/default.nix b/pkgs/development/cuda-modules/cudatoolkit/default.nix index e0868e2b1c2c..57070493eb6d 100644 --- a/pkgs/development/cuda-modules/cudatoolkit/default.nix +++ b/pkgs/development/cuda-modules/cudatoolkit/default.nix @@ -80,7 +80,7 @@ backendStdenv.mkDerivation rec { ] ++ lib.optionals (lib.versionOlder version "11") [libsForQt5.wrapQtAppsHook] ++ lib.optionals (lib.versionAtLeast version "11.8") [qt6Packages.wrapQtAppsHook]; - depsTargetTargetPropagated = [setupCudaHook]; + propagatedBuildInputs = [setupCudaHook]; buildInputs = lib.optionals (lib.versionOlder version "11") [ libsForQt5.qt5.qtwebengine From 7c97d5f5c441cce6ad717a85676eec7c7ff1b27e Mon Sep 17 00:00:00 2001 From: Someone Serge Date: Sat, 9 Dec 2023 00:53:08 +0000 Subject: [PATCH 2/2] suitesparse: migrate to redist cuda also fix the incompatible gcc error by adding cuda_nvcc to nativeBuildInputs (cudaPackages.cudatoolkit in buildInputs is insufficient because that doesn't propagate the hook) --- .../science/math/suitesparse/default.nix | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/pkgs/development/libraries/science/math/suitesparse/default.nix b/pkgs/development/libraries/science/math/suitesparse/default.nix index dd2eb9478f7f..abc2ff9a3701 100644 --- a/pkgs/development/libraries/science/math/suitesparse/default.nix +++ b/pkgs/development/libraries/science/math/suitesparse/default.nix @@ -8,7 +8,7 @@ , mpfr , config , enableCuda ? config.cudaSupport -, cudatoolkit +, cudaPackages }: stdenv.mkDerivation rec { @@ -25,7 +25,11 @@ stdenv.mkDerivation rec { }; nativeBuildInputs = [ - ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; + ] ++ lib.optionals stdenv.isDarwin [ + fixDarwinDylibNames + ] ++ lib.optionals enableCuda [ + cudaPackages.cuda_nvcc + ]; # Use compatible indexing for lapack and blas used buildInputs = assert (blas.isILP64 == lapack.isILP64); [ @@ -34,7 +38,12 @@ stdenv.mkDerivation rec { gfortran.cc.lib gmp mpfr - ] ++ lib.optional enableCuda cudatoolkit; + ] ++ lib.optionals enableCuda [ + cudaPackages.cuda_cudart.dev + cudaPackages.cuda_cudart.lib + cudaPackages.libcublas.dev + cudaPackages.libcublas.lib + ]; preConfigure = '' # Mongoose and GraphBLAS are packaged separately @@ -49,9 +58,9 @@ stdenv.mkDerivation rec { ] ++ lib.optionals blas.isILP64 [ "CFLAGS=-DBLAS64" ] ++ lib.optionals enableCuda [ - "CUDA_PATH=${cudatoolkit}" - "CUDART_LIB=${cudatoolkit.lib}/lib/libcudart.so" - "CUBLAS_LIB=${cudatoolkit}/lib/libcublas.so" + "CUDA_PATH=${cudaPackages.cuda_nvcc}" + "CUDART_LIB=${cudaPackages.cuda_cudart.lib}/lib/libcudart.so" + "CUBLAS_LIB=${cudaPackages.libcublas.lib}/lib/libcublas.so" ] ++ lib.optionals stdenv.isDarwin [ # Unless these are set, the build will attempt to use `Accelerate` on darwin, see: # https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/v5.13.0/SuiteSparse_config/SuiteSparse_config.mk#L368