14 , buildBenchmarks ? false
17 assert buildTests -> gtest != null;
18 assert buildBenchmarks -> gbenchmark != null;
20 # CUB can also be used as a backend instead of rocPRIM.
21 stdenv.mkDerivation rec {
23 rocmVersion = "5.3.1";
24 version = "2.12.0-${rocmVersion}";
28 ] ++ lib.optionals buildTests [
30 ] ++ lib.optionals buildBenchmarks [
34 src = fetchFromGitHub {
35 owner = "ROCmSoftwarePlatform";
37 rev = "rocm-${rocmVersion}";
38 hash = "sha256-/GMZKbMD1sZQCM2FulM9jiJQ8ByYZinn0C8d/deFh0g=";
52 ] ++ lib.optionals buildTests [
54 ] ++ lib.optionals buildBenchmarks [
59 "-DCMAKE_CXX_COMPILER=hipcc"
60 "-DHIP_ROOT_DIR=${hip}"
61 # Manually define CMAKE_INSTALL_<DIR>
62 # See: https://github.com/NixOS/nixpkgs/pull/197838
63 "-DCMAKE_INSTALL_BINDIR=bin"
64 "-DCMAKE_INSTALL_LIBDIR=lib"
65 "-DCMAKE_INSTALL_INCLUDEDIR=include"
66 ] ++ lib.optionals buildTests [
68 ] ++ lib.optionals buildBenchmarks [
69 "-DBUILD_BENCHMARK=ON"
72 postInstall = lib.optionalString buildTests ''
74 mv $out/bin/test_* $test/bin
75 '' + lib.optionalString buildBenchmarks ''
76 mkdir -p $benchmark/bin
77 mv $out/bin/benchmark_* $benchmark/bin
78 '' + lib.optionalString (buildTests || buildBenchmarks) ''
83 description = "Thin wrapper library on top of rocPRIM or CUB";
84 homepage = "https://github.com/ROCmSoftwarePlatform/hipCUB";
85 license = with licenses; [ bsd3 ];
86 maintainers = with maintainers; [ Madouura ];
87 broken = rocmVersion != hip.version;