From 2ea3d6fc9b7f439c233caddf51a1109054601c96 Mon Sep 17 00:00:00 2001 From: Connor Baker Date: Fri, 15 Mar 2024 19:56:02 +0000 Subject: [PATCH 1/2] magma: copy test libraries to output regardless of static or dynamic build --- pkgs/development/libraries/science/math/magma/generic.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/science/math/magma/generic.nix b/pkgs/development/libraries/science/math/magma/generic.nix index 1c63fa8a908c..bf71e8d5455b 100644 --- a/pkgs/development/libraries/science/math/magma/generic.nix +++ b/pkgs/development/libraries/science/math/magma/generic.nix @@ -182,7 +182,7 @@ stdenv.mkDerivation { # because it has no files to install. + '' install -Dm755 ./testing/testing_* ./sparse/testing/testing_* -t "$test/bin/" - install -Dm755 ./lib/libtester.so ./lib/liblapacktest.so -t "$test/lib/" + install -Dm755 ./lib/lib*test*.* -t "$test/lib/" '' # All of the test executables and libraries will have a reference to the build directory in their RPATH, which we # must remove. We do this by shrinking the RPATH to only include the Nix store. The autoPatchelfHook will take care From bdfe55c4a8fe1ef303dbc90a366f5035f1ba6e90 Mon Sep 17 00:00:00 2001 From: Connor Baker Date: Sat, 16 Mar 2024 00:18:24 +0000 Subject: [PATCH 2/2] magma: only 2.7.1+ support CUDA 12 --- .../libraries/science/math/magma/generic.nix | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/pkgs/development/libraries/science/math/magma/generic.nix b/pkgs/development/libraries/science/math/magma/generic.nix index bf71e8d5455b..a2ccc2e1c5b5 100644 --- a/pkgs/development/libraries/science/math/magma/generic.nix +++ b/pkgs/development/libraries/science/math/magma/generic.nix @@ -8,11 +8,11 @@ { autoPatchelfHook , blas , cmake +, cudaPackages_11 ? null , cudaPackages , cudaSupport ? config.cudaSupport , fetchurl , gfortran -, cudaCapabilities ? cudaPackages.cudaFlags.cudaCapabilities , gpuTargets ? [ ] # Non-CUDA targets, that is HIP , rocmPackages , lapack @@ -32,9 +32,18 @@ let inherit (lib) lists strings trivial; - inherit (cudaPackages) cudaAtLeast cudaFlags cudaOlder; inherit (magmaRelease) version hash supportedGpuTargets; + # Per https://icl.utk.edu/magma/downloads, support for CUDA 12 wasn't added until 2.7.1. + # If we're building a version prior to that, use the latest release of the 11.x series. + effectiveCudaPackages = + if strings.versionOlder version "2.7.1" + then cudaPackages_11 + else cudaPackages; + + inherit (effectiveCudaPackages) cudaAtLeast cudaFlags cudaOlder; + inherit (cudaFlags) cudaCapabilities; + # NOTE: The lists.subtractLists function is perhaps a bit unintuitive. It subtracts the elements # of the first list *from* the second list. That means: # lists.subtractLists a b = b - a @@ -115,7 +124,7 @@ stdenv.mkDerivation { ninja gfortran ] ++ lists.optionals cudaSupport [ - cudaPackages.cuda_nvcc + effectiveCudaPackages.cuda_nvcc ]; buildInputs = [ @@ -123,7 +132,7 @@ stdenv.mkDerivation { lapack blas python3 - ] ++ lists.optionals cudaSupport (with cudaPackages; [ + ] ++ lists.optionals cudaSupport (with effectiveCudaPackages; [ cuda_cudart.dev # cuda_runtime.h cuda_cudart.lib # cudart cuda_cudart.static # cudart_static @@ -173,6 +182,7 @@ stdenv.mkDerivation { # TODO(@connorbaker): This should be handled by having CMakeLists.txt install them, but such a patch is # out of the scope of the PR which introduces the `test` output: https://github.com/NixOS/nixpkgs/pull/283777. # See https://github.com/NixOS/nixpkgs/pull/283777#discussion_r1482125034 for more information. + # Such work is tracked by https://github.com/NixOS/nixpkgs/issues/296286. '' install -Dm755 ../testing/run_{tests,summarize}.py -t "$test/bin/" '' @@ -196,7 +206,8 @@ stdenv.mkDerivation { ''; passthru = { - inherit cudaPackages cudaSupport rocmSupport gpuTargets; + inherit cudaSupport rocmSupport gpuTargets; + cudaPackages = effectiveCudaPackages; }; meta = with lib; { @@ -210,6 +221,7 @@ stdenv.mkDerivation { broken = !(cudaSupport || rocmSupport) # At least one back-end enabled || (cudaSupport && rocmSupport) # Mutually exclusive - || (cudaSupport && cudaOlder "9.0"); + || (cudaSupport && cudaOlder "9.0") + || (cudaSupport && strings.versionOlder version "2.7.1" && cudaPackages_11 == null); }; }