diff options
author | Madoura <madouura@gmail.com> | 2023-10-01 20:05:32 -0500 |
---|---|---|
committer | Madoura <madouura@gmail.com> | 2023-10-09 16:38:51 -0500 |
commit | 575ce47fa4051fbb5c234a10eed923d11257749a (patch) | |
tree | d64f1026c35f2cdc227a220b3381fc03f5a4ea00 /pkgs/development/rocm-modules/5/hipcub | |
parent | 12e7fc6923688a08152ee937d00e272502d2ed63 (diff) |
rocm-related: move all relevant ROCm derivations to rocmPackages
clr: init at 5.7.0 (hipamd, opencl, rocclr merged)
Diffstat (limited to 'pkgs/development/rocm-modules/5/hipcub')
-rw-r--r-- | pkgs/development/rocm-modules/5/hipcub/default.nix | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/pkgs/development/rocm-modules/5/hipcub/default.nix b/pkgs/development/rocm-modules/5/hipcub/default.nix new file mode 100644 index 0000000000000..b3a23241366f6 --- /dev/null +++ b/pkgs/development/rocm-modules/5/hipcub/default.nix @@ -0,0 +1,87 @@ +{ lib +, stdenv +, fetchFromGitHub +, rocmUpdateScript +, cmake +, rocm-cmake +, rocprim +, hip +, gtest +, gbenchmark +, buildTests ? false +, buildBenchmarks ? false +}: + +# CUB can also be used as a backend instead of rocPRIM. +stdenv.mkDerivation (finalAttrs: { + pname = "hipcub"; + version = "5.7.0"; + + outputs = [ + "out" + ] ++ lib.optionals buildTests [ + "test" + ] ++ lib.optionals buildBenchmarks [ + "benchmark" + ]; + + src = fetchFromGitHub { + owner = "ROCmSoftwarePlatform"; + repo = "hipCUB"; + rev = "rocm-${finalAttrs.version}"; + hash = "sha256-ygBEA3NuCQ13QrSzGqyWXkx8Dy9WhR3u4syzapRTkFU="; + }; + + nativeBuildInputs = [ + cmake + rocm-cmake + hip + ]; + + buildInputs = [ + rocprim + ] ++ lib.optionals buildTests [ + gtest + ] ++ lib.optionals buildBenchmarks [ + gbenchmark + ]; + + cmakeFlags = [ + "-DCMAKE_CXX_COMPILER=hipcc" + "-DHIP_ROOT_DIR=${hip}" + # 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" + ] ++ lib.optionals buildTests [ + "-DBUILD_TEST=ON" + ] ++ lib.optionals buildBenchmarks [ + "-DBUILD_BENCHMARK=ON" + ]; + + postInstall = lib.optionalString buildTests '' + mkdir -p $test/bin + mv $out/bin/test_* $test/bin + '' + lib.optionalString buildBenchmarks '' + mkdir -p $benchmark/bin + mv $out/bin/benchmark_* $benchmark/bin + '' + lib.optionalString (buildTests || buildBenchmarks) '' + rmdir $out/bin + ''; + + passthru.updateScript = rocmUpdateScript { + name = finalAttrs.pname; + owner = finalAttrs.src.owner; + repo = finalAttrs.src.repo; + }; + + meta = with lib; { + description = "Thin wrapper library on top of rocPRIM or CUB"; + homepage = "https://github.com/ROCmSoftwarePlatform/hipCUB"; + license = with licenses; [ bsd3 ]; + maintainers = teams.rocm.members; + platforms = platforms.linux; + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; + }; +}) |