Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at flake-libs 134 lines 2.9 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 rocmUpdateScript, 6 cmake, 7 rocm-cmake, 8 rocblas, 9 rocprim, 10 rocsparse, 11 clr, 12 fmt, 13 gtest, 14 gfortran, 15 lapack-reference, 16 buildTests ? false, 17 buildBenchmarks ? false, 18 gpuTargets ? ( 19 clr.localGpuTargets or [ 20 "gfx900" 21 "gfx906" 22 "gfx908" 23 "gfx90a" 24 "gfx942" 25 "gfx1010" 26 "gfx1030" 27 "gfx1100" 28 "gfx1101" 29 "gfx1102" 30 ] 31 ), 32}: 33 34stdenv.mkDerivation (finalAttrs: { 35 pname = "rocsolver${clr.gpuArchSuffix}"; 36 version = "6.3.3"; 37 38 outputs = 39 [ 40 "out" 41 ] 42 ++ lib.optionals buildTests [ 43 "test" 44 ] 45 ++ lib.optionals buildBenchmarks [ 46 "benchmark" 47 ]; 48 49 src = fetchFromGitHub { 50 owner = "ROCm"; 51 repo = "rocSOLVER"; 52 rev = "rocm-${finalAttrs.version}"; 53 hash = "sha256-+sGU+0CB48iolJSyYo+xH36q5LCUp+nKtOYbguzMuhg="; 54 }; 55 56 nativeBuildInputs = 57 [ 58 cmake 59 # no ninja, it buffers console output and nix times out long periods of no output 60 rocm-cmake 61 clr 62 ] 63 ++ lib.optionals (buildTests || buildBenchmarks) [ 64 gfortran 65 ]; 66 67 buildInputs = 68 [ 69 # FIXME: rocblas and rocsolver can't build in parallel 70 # but rocsolver doesn't need rocblas' offload builds at build time 71 # could we build against a rocblas-minimal? 72 rocblas 73 rocprim 74 rocsparse 75 fmt 76 ] 77 ++ lib.optionals buildTests [ 78 gtest 79 ] 80 ++ lib.optionals (buildTests || buildBenchmarks) [ 81 lapack-reference 82 ]; 83 84 cmakeFlags = 85 [ 86 "-DHIP_CLANG_NUM_PARALLEL_JOBS=4" 87 "-DCMAKE_BUILD_TYPE=Release" 88 "-DCMAKE_VERBOSE_MAKEFILE=ON" 89 # Manually define CMAKE_INSTALL_<DIR> 90 # See: https://github.com/NixOS/nixpkgs/pull/197838 91 "-DCMAKE_INSTALL_BINDIR=bin" 92 "-DCMAKE_INSTALL_LIBDIR=lib" 93 "-DCMAKE_INSTALL_INCLUDEDIR=include" 94 ] 95 ++ lib.optionals (gpuTargets != [ ]) [ 96 "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" 97 ] 98 ++ lib.optionals buildTests [ 99 "-DBUILD_CLIENTS_TESTS=ON" 100 ] 101 ++ lib.optionals buildBenchmarks [ 102 "-DBUILD_CLIENTS_BENCHMARKS=ON" 103 ]; 104 105 postInstall = 106 lib.optionalString buildTests '' 107 mkdir -p $test/bin 108 mv $out/bin/rocsolver-test $test/bin 109 '' 110 + lib.optionalString buildBenchmarks '' 111 mkdir -p $benchmark/bin 112 mv $out/bin/rocsolver-bench $benchmark/bin 113 '' 114 + lib.optionalString (buildTests || buildBenchmarks) '' 115 rmdir $out/bin 116 ''; 117 118 passthru.updateScript = rocmUpdateScript { 119 name = "rocsolver"; 120 inherit (finalAttrs.src) owner repo; 121 }; 122 123 requiredSystemFeatures = [ "big-parallel" ]; 124 125 meta = with lib; { 126 description = "ROCm LAPACK implementation"; 127 homepage = "https://github.com/ROCm/rocSOLVER"; 128 license = with licenses; [ bsd2 ]; 129 teams = [ teams.rocm ]; 130 platforms = platforms.linux; 131 timeout = 14400; # 4 hours 132 maxSilent = 14400; # 4 hours 133 }; 134})