Unverified Commit 5015e4b4 authored by Luna Nova's avatar Luna Nova
Browse files

rocmPackages.rocblas: split benchmark and test outputs

parent f9864971
Loading
Loading
Loading
Loading
+21 −9
Original line number Diff line number Diff line
@@ -26,8 +26,8 @@
  pkg-config,
  removeReferencesTo,
  buildTensile ? true,
  buildTests ? false,
  buildBenchmarks ? false,
  buildTests ? true,
  buildBenchmarks ? true,
  tensileSepArch ? true,
  tensileLazyLib ? true,
  withHipBlasLt ? true,
@@ -48,6 +48,8 @@ stdenv.mkDerivation (finalAttrs: {
    hash = "sha256-FCzo/BOk4xLEFkdOdqcCXh4a9t3/OIIBEy8oz6oOMWg=";
  };

  outputs = [ "out" ] ++ lib.optional buildBenchmarks "benchmark" ++ lib.optional buildTests "test";

  nativeBuildInputs = [
    cmake
    # no ninja, it buffers console output and nix times out long periods of no output
@@ -78,10 +80,8 @@ stdenv.mkDerivation (finalAttrs: {
    python3Packages.msgpack
    python3Packages.zstandard
  ]
  ++ lib.optionals buildTests [
    gtest
  ]
  ++ lib.optionals (buildTests || buildBenchmarks) [
    gtest
    gfortran
    rocm-smi
  ]
@@ -155,14 +155,26 @@ stdenv.mkDerivation (finalAttrs: {
    ''
      remove-references-to -t ${tensile} \
        "$out/lib/librocblas.so."*
    ''
    + lib.optionalString buildBenchmarks ''
      moveToOutput "bin/*-tune" "$benchmark"
      moveToOutput "bin/*-bench" "$benchmark"
      moveToOutput "bin/*example*" "$benchmark"
      cp "$out/bin/"*.{yaml,txt} "$benchmark/bin"
    ''
    + lib.optionalString buildTests ''
      moveToOutput "bin/*test*" "$test"
      cp "$out/bin/"*.{yaml,txt} "$test/bin"
    ''
    + ''
      if [ -d $out/bin ]; then
        rm $out/bin/*.{yaml,txt} || true
        rmdir $out/bin
      fi
    '';

  passthru = {
    amdgpu_targets = gpuTargets';
    tests.rocblas-tests = finalAttrs.finalPackage.override {
      buildBenchmarks = true;
      buildTests = true;
    };
    updateScript = rocmUpdateScript {
      name = finalAttrs.pname;
      inherit (finalAttrs.src) owner;