From 6e88b0b8d3a63dd0c8dad93ce20aa6fd21e361cb Mon Sep 17 00:00:00 2001 From: Madoura Date: Mon, 19 Dec 2022 10:54:52 -0600 Subject: [PATCH] rdc: init at 5.4.1 --- pkgs/development/tools/misc/rdc/default.nix | 123 ++++++++++++++++++++ pkgs/top-level/all-packages.nix | 3 + 2 files changed, 126 insertions(+) create mode 100644 pkgs/development/tools/misc/rdc/default.nix diff --git a/pkgs/development/tools/misc/rdc/default.nix b/pkgs/development/tools/misc/rdc/default.nix new file mode 100644 index 000000000000..5bf6da5fa483 --- /dev/null +++ b/pkgs/development/tools/misc/rdc/default.nix @@ -0,0 +1,123 @@ +{ lib +, stdenv +, fetchFromGitHub +, rocmUpdateScript +, cmake +, rocm-smi +, rocm-runtime +, libcap +, grpc +, protobuf +, openssl +, doxygen +, graphviz +, texlive +, gtest +, buildDocs ? true +, buildTests ? false +}: + +let + latex = lib.optionalAttrs buildDocs texlive.combine { + inherit (texlive) scheme-small + latexmk + varwidth + multirow + hanging + adjustbox + collectbox + stackengine + enumitem + alphalph + wasysym + sectsty + tocloft + newunicodechar + etoc + helvetic + wasy + courier; + }; +in stdenv.mkDerivation (finalAttrs: { + pname = "rdc"; + version = "5.4.1"; + + outputs = [ + "out" + ] ++ lib.optionals buildDocs [ + "doc" + ] ++ lib.optionals buildTests [ + "test" + ]; + + src = fetchFromGitHub { + owner = "RadeonOpenCompute"; + repo = "rdc"; + rev = "rocm-${finalAttrs.version}"; + hash = "sha256-dYacqkRp+zVejo/4dME1K6EN8t/1EBtIynEQ+AQ4JZo="; + }; + + nativeBuildInputs = [ + cmake + protobuf + ] ++ lib.optionals buildDocs [ + doxygen + graphviz + latex + ]; + + buildInputs = [ + rocm-smi + rocm-runtime + libcap + grpc + openssl + ] ++ lib.optionals buildTests [ + gtest + ]; + + cmakeFlags = [ + "-DCMAKE_VERBOSE_MAKEFILE=OFF" + "-DRDC_INSTALL_PREFIX=${placeholder "out"}" + "-DBUILD_ROCRTEST=ON" + "-DRSMI_INC_DIR=${rocm-smi}/include" + "-DRSMI_LIB_DIR=${rocm-smi}/lib" + "-DGRPC_ROOT=${grpc}" + # Manually define CMAKE_INSTALL_ + # See: https://github.com/NixOS/nixpkgs/pull/197838 + "-DCMAKE_INSTALL_BINDIR=bin" + "-DCMAKE_INSTALL_LIBDIR=lib" + "-DCMAKE_INSTALL_INCLUDEDIR=include" + "-DCMAKE_INSTALL_LIBEXECDIR=libexec" + "-DCMAKE_INSTALL_DOCDIR=doc" + ] ++ lib.optionals buildTests [ + "-DBUILD_TESTS=ON" + ]; + + postPatch = '' + substituteInPlace CMakeLists.txt \ + --replace "file(STRINGS /etc/os-release LINUX_DISTRO LIMIT_COUNT 1 REGEX \"NAME=\")" "set(LINUX_DISTRO \"NixOS\")" + ''; + + postInstall = '' + find $out/bin -executable -type f -exec \ + patchelf {} --shrink-rpath --allowed-rpath-prefixes /nix/store \; + '' + lib.optionalString buildTests '' + mkdir -p $test + mv $out/bin/rdctst_tests $test/bin + ''; + + passthru.updateScript = rocmUpdateScript { + name = finalAttrs.pname; + owner = finalAttrs.src.owner; + repo = finalAttrs.src.repo; + }; + + meta = with lib; { + description = "Simplifies administration and addresses infrastructure challenges in cluster and datacenter environments"; + homepage = "https://github.com/RadeonOpenCompute/rdc"; + license = with licenses; [ mit ]; + maintainers = teams.rocm.members; + broken = finalAttrs.version != rocm-smi.version; + }; +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 55ed9745d721..ef98acff7d7a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15376,6 +15376,9 @@ with pkgs; stdenv = rocmClangStdenv; }; + # Best just use GCC here + rdc = callPackage ../development/tools/misc/rdc { }; + # Best just use GCC here rocgdb = callPackage ../development/tools/misc/rocgdb { elfutils = elfutils.override { enableDebuginfod = true; };