Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at litex 95 lines 2.3 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, rocmUpdateScript 5, cmake 6, rocm-cmake 7, rocblas 8, hip 9, fmt 10, gtest 11, gfortran 12, lapack-reference 13, buildTests ? false 14, buildBenchmarks ? false 15, gpuTargets ? [ ] # gpuTargets = [ "gfx803" "gfx900" "gfx906:xnack-" ] 16}: 17 18stdenv.mkDerivation (finalAttrs: { 19 pname = "rocsolver"; 20 version = "5.4.4"; 21 22 outputs = [ 23 "out" 24 ] ++ lib.optionals buildTests [ 25 "test" 26 ] ++ lib.optionals buildBenchmarks [ 27 "benchmark" 28 ]; 29 30 src = fetchFromGitHub { 31 owner = "ROCmSoftwarePlatform"; 32 repo = "rocSOLVER"; 33 rev = "rocm-${finalAttrs.version}"; 34 hash = "sha256-UHUcA9CVPuYFpE2DTvRrRMMj51yNPo5wMTKnByL2RTg="; 35 }; 36 37 nativeBuildInputs = [ 38 cmake 39 rocm-cmake 40 hip 41 ] ++ lib.optionals (buildTests || buildBenchmarks) [ 42 gfortran 43 ]; 44 45 buildInputs = [ 46 rocblas 47 fmt 48 ] ++ lib.optionals buildTests [ 49 gtest 50 ] ++ lib.optionals (buildTests || buildBenchmarks) [ 51 lapack-reference 52 ]; 53 54 cmakeFlags = [ 55 "-DCMAKE_CXX_COMPILER=hipcc" 56 # Manually define CMAKE_INSTALL_<DIR> 57 # See: https://github.com/NixOS/nixpkgs/pull/197838 58 "-DCMAKE_INSTALL_BINDIR=bin" 59 "-DCMAKE_INSTALL_LIBDIR=lib" 60 "-DCMAKE_INSTALL_INCLUDEDIR=include" 61 ] ++ lib.optionals (gpuTargets != [ ]) [ 62 "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" 63 ] ++ lib.optionals buildTests [ 64 "-DBUILD_CLIENTS_TESTS=ON" 65 ] ++ lib.optionals buildBenchmarks [ 66 "-DBUILD_CLIENTS_BENCHMARKS=ON" 67 ]; 68 69 postInstall = lib.optionalString buildTests '' 70 mkdir -p $test/bin 71 mv $out/bin/rocsolver-test $test/bin 72 '' + lib.optionalString buildBenchmarks '' 73 mkdir -p $benchmark/bin 74 mv $out/bin/rocsolver-bench $benchmark/bin 75 '' + lib.optionalString (buildTests || buildBenchmarks) '' 76 rmdir $out/bin 77 ''; 78 79 passthru.updateScript = rocmUpdateScript { 80 name = finalAttrs.pname; 81 owner = finalAttrs.src.owner; 82 repo = finalAttrs.src.repo; 83 }; 84 85 requiredSystemFeatures = [ "big-parallel" ]; 86 87 meta = with lib; { 88 description = "ROCm LAPACK implementation"; 89 homepage = "https://github.com/ROCmSoftwarePlatform/rocSOLVER"; 90 license = with licenses; [ bsd2 ]; 91 maintainers = teams.rocm.members; 92 platforms = platforms.linux; 93 broken = versions.minor finalAttrs.version != versions.minor hip.version; 94 }; 95})