nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at r-updates 95 lines 2.8 kB view raw
1{ 2 _cuda, 3 cudaPackages, 4 fetchurl, 5 lib, 6 stdenvNoCC, 7}: 8 9stdenvNoCC.mkDerivation (finalAttrs: { 10 # NOTE: The version used should match the version Warp requires: 11 # https://github.com/NVIDIA/warp/blob/${version}/deps/libmathdx-deps.packman.xml 12 pname = "libmathdx"; 13 version = "0.2.3"; 14 15 outputs = [ 16 "out" 17 "static" 18 ]; 19 20 src = 21 let 22 baseURL = "https://developer.nvidia.com/downloads/compute/cublasdx/redist/cublasdx"; 23 cudaMajorVersion = cudaPackages.cudaMajorVersion; # only 12, 13 supported 24 cudaVersion = "${cudaMajorVersion}.0"; # URL example: ${baseURL}/cuda12/${name}-${version}-cuda12.0.zip 25 name = lib.concatStringsSep "-" [ 26 finalAttrs.pname 27 "Linux" 28 stdenvNoCC.hostPlatform.parsed.cpu.name 29 finalAttrs.version 30 "cuda${cudaVersion}" 31 ]; 32 33 # nix-hash --type sha256 --to-sri $(nix-prefetch-url "https://...") 34 hashes = { 35 "12" = { 36 aarch64-linux = "sha256-d/aBC+zU2ciaw3isv33iuviXYaLGLdVDdzynGk9SFck="; 37 x86_64-linux = "sha256-CHIH0s4SnA67COtHBkwVCajW/3f0VxNBmuDLXy4LFIg="; 38 }; 39 "13" = { 40 aarch64-linux = "sha256-TetJbMts8tpmj5PV4+jpnUHMcooDrXUEKL3aGWqilKI="; 41 x86_64-linux = "sha256-wLJLbRpQWa6QEm8ibm1gxt3mXvkWvu0vEzpnqTIvE1M="; 42 }; 43 }; 44 in 45 lib.mapNullable ( 46 hash: 47 fetchurl { 48 inherit hash name; 49 url = "${baseURL}/cuda${cudaMajorVersion}/${name}.tar.gz"; 50 } 51 ) (hashes.${cudaMajorVersion}.${stdenvNoCC.hostPlatform.system} or null); 52 53 dontUnpack = true; 54 dontConfigure = true; 55 dontBuild = true; 56 57 installPhase = '' 58 runHook preInstall 59 60 mkdir -p "$out" 61 tar -xzf "$src" -C "$out" 62 63 mkdir -p "$static" 64 moveToOutput "lib/libmathdx_static.a" "$static" 65 66 runHook postInstall 67 ''; 68 69 meta = { 70 description = "Library used to integrate cuBLASDx and cuFFTDx into Warp"; 71 homepage = "https://developer.nvidia.com/cublasdx-downloads"; 72 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 73 license = with lib.licenses; [ 74 # By downloading and using the software, you agree to fully 75 # comply with the terms and conditions of the NVIDIA Software 76 # License Agreement. 77 _cuda.lib.licenses.math_sdk_sla 78 79 # Some of the libmathdx routines were written by or derived 80 # from code written by Meta Platforms, Inc. and affiliates and 81 # are subject to the BSD License. 82 bsd3 83 84 # Some of the libmathdx routines were written by or derived from 85 # code written by Victor Zverovich and are subject to the following 86 # license: 87 mit 88 ]; 89 platforms = [ 90 "aarch64-linux" 91 "x86_64-linux" 92 ]; 93 maintainers = with lib.maintainers; [ yzx9 ]; 94 }; 95})