nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 rocmPackages,
6 cmake,
7 python3,
8 nlohmann_json,
9 gtest,
10}:
11
12stdenv.mkDerivation (finalAttrs: {
13 pname = "rocprof-trace-decoder";
14 version = "0.1.7";
15
16 src = fetchFromGitHub {
17 owner = "ROCm";
18 repo = "rocm-systems";
19 # No tags (yet?)
20 rev = "feeca99950c590e0b8228733405c4a1a10fa4773";
21 sparseCheckout = [
22 "projects/rocprof-trace-decoder"
23 "shared"
24 ];
25 hash = "sha256-aJhPiZf5380jj2IeCipgcTEQYogr5R19UnVwKRGnkxo=";
26 };
27
28 sourceRoot = "${finalAttrs.src.name}/projects/rocprof-trace-decoder";
29
30 patches = [
31 ./use-system-dependencies.patch
32 # https://github.com/ROCm/rocm-systems/pull/3800
33 ./fix-test-dependency.patch
34 ];
35
36 strictDeps = true;
37
38 nativeBuildInputs = [ cmake ];
39
40 buildInputs = [
41 rocmPackages.rocm-comgr
42 rocmPackages.rocm-runtime
43 ];
44
45 cmakeFlags = [
46 (lib.cmakeBool "BUILD_TESTS" finalAttrs.doCheck)
47 ];
48
49 nativeCheckInputs = [
50 python3
51 ];
52
53 checkInputs = [
54 nlohmann_json
55 gtest
56 ];
57
58 preCheck = ''
59 patchShebangs test
60 '';
61
62 checkPhase =
63 let
64 # Sanitize tests fail because the UBSan runtime (__ubsan_vptr_type_cache) is not available for
65 # LD_PRELOAD in the sandbox.
66 skipPattern = "_sanitize$";
67 in
68 ''
69 runHook preCheck
70
71 ctest --test-dir . --output-on-failure -E '${skipPattern}'
72
73 runHook postCheck
74 '';
75
76 doCheck = true;
77
78 meta = {
79 description = "Library for decoding ROCm thread trace data";
80 homepage = "https://github.com/ROCm/rocm-systems/tree/develop/projects/rocprof-trace-decoder";
81 license = with lib.licenses; [ mit ];
82 teams = [ lib.teams.rocm ];
83 platforms = lib.platforms.linux;
84 };
85})