nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 131 lines 2.8 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 rocmUpdateScript, 6 cmake, 7 rocm-cmake, 8 clr, 9 gfortran, 10 hipblas-common, 11 rocblas, 12 rocsolver, 13 rocsparse, 14 rocprim, 15 gtest, 16 lapack-reference, 17 buildTests ? false, 18 buildBenchmarks ? false, 19 buildSamples ? false, 20 # for passthru.tests 21 hipblas, 22}: 23 24# Can also use cuBLAS 25stdenv.mkDerivation (finalAttrs: { 26 pname = "hipblas"; 27 version = "7.1.1"; 28 29 outputs = [ 30 "out" 31 ] 32 ++ lib.optionals buildTests [ 33 "test" 34 ] 35 ++ lib.optionals buildBenchmarks [ 36 "benchmark" 37 ] 38 ++ lib.optionals buildSamples [ 39 "sample" 40 ]; 41 42 src = fetchFromGitHub { 43 owner = "ROCm"; 44 repo = "hipBLAS"; 45 rev = "rocm-${finalAttrs.version}"; 46 hash = "sha256-2wDnYZapJ4fU/JZpy6qOf5+DYuatWmCw/hA8WO5x2T0="; 47 }; 48 49 postPatch = '' 50 substituteInPlace library/CMakeLists.txt \ 51 --replace-fail "find_package(Git REQUIRED)" "" 52 ''; 53 54 nativeBuildInputs = [ 55 cmake 56 rocm-cmake 57 clr 58 gfortran 59 ]; 60 61 propagatedBuildInputs = [ hipblas-common ]; 62 63 buildInputs = [ 64 rocblas 65 rocprim 66 rocsparse 67 rocsolver 68 ] 69 ++ lib.optionals buildTests [ 70 gtest 71 ] 72 ++ lib.optionals (buildTests || buildBenchmarks) [ 73 lapack-reference 74 ]; 75 76 cmakeFlags = [ 77 "-DCMAKE_CXX_COMPILER=${lib.getExe' clr "amdclang++"}" 78 # Manually define CMAKE_INSTALL_<DIR> 79 # See: https://github.com/NixOS/nixpkgs/pull/197838 80 "-DCMAKE_INSTALL_BINDIR=bin" 81 "-DCMAKE_INSTALL_LIBDIR=lib" 82 "-DCMAKE_INSTALL_INCLUDEDIR=include" 83 "-DBUILD_WITH_SOLVER=ON" 84 "-DAMDGPU_TARGETS=${rocblas.amdgpu_targets}" 85 ] 86 ++ lib.optionals buildTests [ 87 "-DBUILD_CLIENTS_TESTS=ON" 88 ] 89 ++ lib.optionals buildBenchmarks [ 90 "-DBUILD_CLIENTS_BENCHMARKS=ON" 91 ] 92 ++ lib.optionals buildSamples [ 93 "-DBUILD_CLIENTS_SAMPLES=ON" 94 ]; 95 96 postInstall = 97 lib.optionalString buildTests '' 98 mkdir -p $test/bin 99 mv $out/bin/hipblas-test $test/bin 100 '' 101 + lib.optionalString buildBenchmarks '' 102 mkdir -p $benchmark/bin 103 mv $out/bin/hipblas-bench $benchmark/bin 104 '' 105 + lib.optionalString buildSamples '' 106 mkdir -p $sample/bin 107 mv $out/bin/example-* $sample/bin 108 '' 109 + lib.optionalString (buildTests || buildBenchmarks || buildSamples) '' 110 rmdir $out/bin 111 ''; 112 113 passthru.updateScript = rocmUpdateScript { 114 name = finalAttrs.pname; 115 inherit (finalAttrs.src) owner; 116 inherit (finalAttrs.src) repo; 117 }; 118 passthru.tests.hipblas-tested = hipblas.override { 119 buildTests = true; 120 buildBenchmarks = true; 121 buildSamples = true; 122 }; 123 124 meta = { 125 description = "ROCm BLAS marshalling library"; 126 homepage = "https://github.com/ROCm/hipBLAS"; 127 license = with lib.licenses; [ mit ]; 128 teams = [ lib.teams.rocm ]; 129 platforms = lib.platforms.linux; 130 }; 131})