pytrainer: unpin python 3.10
[NixPkgs.git] / pkgs / development / rocm-modules / 6 / rocprim / default.nix
blob3e8525655141e0d4b1df5a46f4fd6bec59d656b4
1 { lib
2 , fetchpatch
3 , stdenv
4 , fetchFromGitHub
5 , rocmUpdateScript
6 , cmake
7 , rocm-cmake
8 , clr
9 , gtest
10 , gbenchmark
11 , buildTests ? false
12 , buildBenchmarks ? false
13 , gpuTargets ? [ ]
16 stdenv.mkDerivation (finalAttrs: {
17   pname = "rocprim";
18   version = "6.0.2";
20   outputs = [
21     "out"
22   ] ++ lib.optionals buildTests [
23     "test"
24   ] ++ lib.optionals buildBenchmarks [
25     "benchmark"
26   ];
28   src = fetchFromGitHub {
29     owner = "ROCm";
30     repo = "rocPRIM";
31     rev = "rocm-${finalAttrs.version}";
32     hash = "sha256-nWvq26qRPZ6Au1rc5cR74TKArcdUFg7O9djFi8SvMeM=";
33   };
35   patches = [
36     (fetchpatch {
37       name = "arch-conversion-marco.patch";
38       url = "https://salsa.debian.org/rocm-team/rocprim/-/raw/70c8aaee3cf545d92685f4ed9bf8f41e3d4d570c/debian/patches/arch-conversion-macro.patch";
39       hash = "sha256-oXdmbCArOB5bKE8ozDFrSh4opbO+c4VI6PNhljeUSms=";
40     })
41   ];
43   nativeBuildInputs = [
44     cmake
45     rocm-cmake
46     clr
47   ];
49   buildInputs = lib.optionals buildTests [
50     gtest
51   ] ++ lib.optionals buildBenchmarks [
52     gbenchmark
53   ];
55   cmakeFlags = [
56     "-DCMAKE_CXX_COMPILER=hipcc"
57     # Manually define CMAKE_INSTALL_<DIR>
58     # See: https://github.com/NixOS/nixpkgs/pull/197838
59     "-DCMAKE_INSTALL_BINDIR=bin"
60     "-DCMAKE_INSTALL_LIBDIR=lib"
61     "-DCMAKE_INSTALL_INCLUDEDIR=include"
62   ] ++ lib.optionals (gpuTargets != [ ]) [
63     "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}"
64   ] ++ lib.optionals buildTests [
65     "-DBUILD_TEST=ON"
66   ] ++ lib.optionals buildBenchmarks [
67     "-DBUILD_BENCHMARK=ON"
68   ];
70   postInstall = lib.optionalString buildTests ''
71     mkdir -p $test/bin
72     mv $out/bin/test_* $test/bin
73     mv $out/bin/rocprim $test/bin
74   '' + lib.optionalString buildBenchmarks ''
75     mkdir -p $benchmark/bin
76     mv $out/bin/benchmark_* $benchmark/bin
77   '' + lib.optionalString (buildTests || buildBenchmarks) ''
78     rmdir $out/bin
79   '';
81   passthru.updateScript = rocmUpdateScript {
82     name = finalAttrs.pname;
83     owner = finalAttrs.src.owner;
84     repo = finalAttrs.src.repo;
85   };
87   meta = with lib; {
88     description = "ROCm parallel primitives";
89     homepage = "https://github.com/ROCm/rocPRIM";
90     license = with licenses; [ mit ];
91     maintainers = teams.rocm.members;
92     platforms = platforms.linux;
93     broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version || versionAtLeast finalAttrs.version "7.0.0";
94   };