11 , buildBenchmarks ? false
15 stdenv.mkDerivation (finalAttrs: {
21 ] ++ lib.optionals buildTests [
23 ] ++ lib.optionals buildBenchmarks [
27 src = fetchFromGitHub {
30 rev = "rocm-${finalAttrs.version}";
31 hash = "sha256-+ukFWsWv3RhS+Z6tmR4TRT8QTYEDuAEk12F9Gv1eXGU=";
40 buildInputs = lib.optionals buildTests [
42 ] ++ lib.optionals buildBenchmarks [
47 "-DCMAKE_CXX_COMPILER=hipcc"
48 # Manually define CMAKE_INSTALL_<DIR>
49 # See: https://github.com/NixOS/nixpkgs/pull/197838
50 "-DCMAKE_INSTALL_BINDIR=bin"
51 "-DCMAKE_INSTALL_LIBDIR=lib"
52 "-DCMAKE_INSTALL_INCLUDEDIR=include"
53 ] ++ lib.optionals (gpuTargets != [ ]) [
54 "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}"
55 ] ++ lib.optionals buildTests [
57 ] ++ lib.optionals buildBenchmarks [
58 "-DBUILD_BENCHMARK=ON"
61 postInstall = lib.optionalString buildTests ''
63 mv $out/bin/test_* $test/bin
64 mv $out/bin/rocprim $test/bin
65 '' + lib.optionalString buildBenchmarks ''
66 mkdir -p $benchmark/bin
67 mv $out/bin/benchmark_* $benchmark/bin
68 '' + lib.optionalString (buildTests || buildBenchmarks) ''
72 passthru.updateScript = rocmUpdateScript {
73 name = finalAttrs.pname;
74 owner = finalAttrs.src.owner;
75 repo = finalAttrs.src.repo;
79 description = "ROCm parallel primitives";
80 homepage = "https://github.com/ROCm/rocPRIM";
81 license = with licenses; [ mit ];
82 maintainers = teams.rocm.members;
83 platforms = platforms.linux;
84 broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version || versionAtLeast finalAttrs.version "6.0.0";