summary refs log tree commit diff
path: root/pkgs/development/libraries/rocprofiler/default.nix
blob: e7e0c9fed6502f1b713afcf1a4d92d30fad05994 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{ lib
, stdenv
, fetchFromGitHub
, rocmUpdateScript
, cmake
, rocm-runtime
, rocm-thunk
, roctracer
, numactl
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "rocprofiler";
  version = "5.4.3";

  src = fetchFromGitHub {
    owner = "ROCm-Developer-Tools";
    repo = "rocprofiler";
    rev = "rocm-${finalAttrs.version}";
    hash = "sha256-CpD/+soMN8WTeSb5X7dsnZ596PMkw+4EVsVSvFtKCak=";
  };

  patches = [ ./0000-dont-require-hsa_amd_aqlprofile.patch ];
  nativeBuildInputs = [ cmake ];

  buildInputs = [
    rocm-thunk
    rocm-runtime
    numactl
  ];

  cmakeFlags = [
    "-DPROF_API_HEADER_PATH=${roctracer.src}/inc/ext"
    # Manually define CMAKE_INSTALL_<DIR>
    # See: https://github.com/NixOS/nixpkgs/pull/197838
    "-DCMAKE_INSTALL_BINDIR=bin"
    "-DCMAKE_INSTALL_LIBDIR=lib"
    "-DCMAKE_INSTALL_INCLUDEDIR=include"
  ];

  postPatch = ''
    patchShebangs bin test

    substituteInPlace cmake_modules/env.cmake \
      --replace "FATAL_ERROR \"AQL_PROFILE" "WARNING \"AQL_PROFILE"
  '';

  postInstall = ''
    patchelf --set-rpath $out/lib:${lib.makeLibraryPath finalAttrs.buildInputs} $out/lib/rocprofiler/librocprof-tool.so
  '';

  passthru.updateScript = rocmUpdateScript {
    name = finalAttrs.pname;
    owner = finalAttrs.src.owner;
    repo = finalAttrs.src.repo;
  };

  meta = with lib; {
    description = "Profiling with perf-counters and derived metrics";
    homepage = "https://github.com/ROCm-Developer-Tools/rocprofiler";
    license = with licenses; [ mit ]; # mitx11
    maintainers = teams.rocm.members;
    platforms = platforms.linux;
    broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
  };
})