Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, stdenv 3, fetchFromGitHub 4, rocmUpdateScript 5, cmake 6, rocm-cmake 7, rocblas 8, rocsparse 9, rocprim 10, rocrand 11, hip 12, git 13, openmp 14, openmpi 15, gtest 16, buildTests ? false 17, buildBenchmarks ? false 18, buildSamples ? false 19, gpuTargets ? [ ] # gpuTargets = [ "gfx803" "gfx900:xnack-" "gfx906:xnack-" ... ] 20}: 21 22stdenv.mkDerivation (finalAttrs: { 23 pname = "rocalution"; 24 version = "5.4.3"; 25 26 outputs = [ 27 "out" 28 ] ++ lib.optionals buildTests [ 29 "test" 30 ] ++ lib.optionals buildBenchmarks [ 31 "benchmark" 32 ] ++ lib.optionals buildSamples [ 33 "sample" 34 ]; 35 36 src = fetchFromGitHub { 37 owner = "ROCmSoftwarePlatform"; 38 repo = "rocALUTION"; 39 rev = "rocm-${finalAttrs.version}"; 40 hash = "sha256-jovhodhNa7tr1bSqpZCKI/9xF7Ie96JB+giqAEfis2k="; 41 }; 42 43 nativeBuildInputs = [ 44 cmake 45 rocm-cmake 46 hip 47 git 48 ]; 49 50 buildInputs = [ 51 rocblas 52 rocsparse 53 rocprim 54 rocrand 55 openmp 56 openmpi 57 ] ++ lib.optionals buildTests [ 58 gtest 59 ]; 60 61 cmakeFlags = [ 62 "-DCMAKE_CXX_COMPILER=hipcc" 63 "-DROCM_PATH=${hip}" 64 "-DHIP_ROOT_DIR=${hip}" 65 "-DSUPPORT_HIP=ON" 66 "-DSUPPORT_OMP=ON" 67 "-DSUPPORT_MPI=ON" 68 "-DBUILD_CLIENTS_SAMPLES=${if buildSamples then "ON" else "OFF"}" 69 # Manually define CMAKE_INSTALL_<DIR> 70 # See: https://github.com/NixOS/nixpkgs/pull/197838 71 "-DCMAKE_INSTALL_BINDIR=bin" 72 "-DCMAKE_INSTALL_LIBDIR=lib" 73 "-DCMAKE_INSTALL_INCLUDEDIR=include" 74 ] ++ lib.optionals (gpuTargets != [ ]) [ 75 "-DAMDGPU_TARGETS=${lib.strings.concatStringsSep ";" gpuTargets}" 76 ] ++ lib.optionals buildTests [ 77 "-DBUILD_CLIENTS_TESTS=ON" 78 ] ++ lib.optionals buildBenchmarks [ 79 "-DBUILD_CLIENTS_BENCHMARKS=ON" 80 ]; 81 82 postInstall = lib.optionalString buildTests '' 83 mkdir -p $test/bin 84 mv $out/bin/rocalution-test $test/bin 85 '' + lib.optionalString buildBenchmarks '' 86 mkdir -p $benchmark/bin 87 mv $out/bin/rocalution-bench $benchmark/bin 88 '' + lib.optionalString buildSamples '' 89 mkdir -p $sample/bin 90 mv clients/staging/* $sample/bin 91 rm $sample/bin/rocalution-test || true 92 rm $sample/bin/rocalution-bench || true 93 94 patchelf --set-rpath \ 95 $out/lib:${lib.makeLibraryPath (finalAttrs.buildInputs ++ [ hip ])} \ 96 $sample/bin/* 97 '' + lib.optionalString (buildTests || buildBenchmarks) '' 98 rmdir $out/bin 99 ''; 100 101 passthru.updateScript = rocmUpdateScript { 102 name = finalAttrs.pname; 103 owner = finalAttrs.src.owner; 104 repo = finalAttrs.src.repo; 105 }; 106 107 meta = with lib; { 108 description = "Iterative sparse solvers for ROCm"; 109 homepage = "https://github.com/ROCmSoftwarePlatform/rocALUTION"; 110 license = with licenses; [ mit ]; 111 maintainers = teams.rocm.members; 112 platforms = platforms.linux; 113 broken = versions.minor finalAttrs.version != versions.minor hip.version; 114 }; 115})