lol

magma: fix CUDA 11 build

By default, MAGMA builds against compute capability 3.0 (among other
capabilities). However, support for this capability was dropped in
CUDA 11. This change fixes CUDA 11 support by excluding 3.0.

While at it, this change also adds support for newer compute
capabilities that are not enabled by MAGMA by default (to support
older CUDA versions).

+36 -2
+36 -2
pkgs/development/libraries/science/math/magma/default.nix
··· 1 1 { lib, stdenv, fetchurl, cmake, gfortran, ninja, cudatoolkit, libpthreadstubs, lapack, blas }: 2 2 3 - with lib; 3 + assert let majorIs = lib.versions.major cudatoolkit.version; 4 + in majorIs == "9" || majorIs == "10" || majorIs == "11"; 4 5 5 - let version = "2.5.4"; 6 + let 7 + version = "2.5.4"; 8 + 9 + # We define a specific set of CUDA compute capabilities here, 10 + # because CUDA 11 does not support compute capability 3.0. Also, 11 + # we use it to enable newer capabilities that are not enabled 12 + # by magma by default. The list of supported architectures 13 + # can be found in magma's top-level CMakeLists.txt. 14 + cudaCapabilities = rec { 15 + cuda9 = [ 16 + "Kepler" # 3.0, 3.5 17 + "Maxwell" # 5.0 18 + "Pascal" # 6.0 19 + "Volta" # 7.0 20 + ]; 21 + 22 + cuda10 = [ 23 + "Turing" # 7.5 24 + ] ++ cuda9; 25 + 26 + cuda11 = [ 27 + "sm_35" # sm_30 is not supported by CUDA 11 28 + "Maxwell" # 5.0 29 + "Pascal" # 6.0 30 + "Volta" # 7.0 31 + "Turing" # 7.5 32 + "Ampere" # 8.0 33 + ]; 34 + }; 35 + 36 + capabilityString = lib.strings.concatStringsSep "," 37 + cudaCapabilities."cuda${lib.versions.major cudatoolkit.version}"; 6 38 7 39 in stdenv.mkDerivation { 8 40 pname = "magma"; ··· 16 48 nativeBuildInputs = [ gfortran cmake ninja ]; 17 49 18 50 buildInputs = [ cudatoolkit libpthreadstubs lapack blas ]; 51 + 52 + cmakeFlags = [ "-DGPU_TARGET=${capabilityString}" ]; 19 53 20 54 doCheck = false; 21 55