2021-09-18 10:52:07 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, writeScript, fetchpatch, cmake, rocm-runtime, python3, rocm-cmake, busybox, gnugrep
|
|
|
|
# rocminfo requires that the calling user have a password and be in
|
|
|
|
# the video group. If we let rocm_agent_enumerator rely upon
|
|
|
|
# rocminfo's output, then it, too, has those requirements. Instead,
|
|
|
|
# we can specify the GPU targets for this system (e.g. "gfx803" for
|
|
|
|
# Polaris) such that no system call is needed for downstream
|
|
|
|
# compilers to determine the desired target.
|
|
|
|
, defaultTargets ? []}:
|
2022-11-27 09:42:12 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
|
|
version = "5.3.3";
|
2021-09-18 10:52:07 +00:00
|
|
|
pname = "rocminfo";
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "RadeonOpenCompute";
|
|
|
|
repo = "rocminfo";
|
2022-11-27 09:42:12 +00:00
|
|
|
rev = "rocm-${finalAttrs.version}";
|
2022-10-21 18:38:19 +00:00
|
|
|
sha256 = "sha256-4wZTm5AZgG8xEd6uYqxWq4bWZgcSYZ2WYA1z4RAPF8U=";
|
2021-09-18 10:52:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2022-04-03 18:54:34 +00:00
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
buildInputs = [ rocm-cmake rocm-runtime ];
|
2021-09-18 10:52:07 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DROCM_DIR=${rocm-runtime}"
|
|
|
|
"-DROCRTST_BLD_TYPE=Release"
|
|
|
|
];
|
|
|
|
|
|
|
|
prePatch = ''
|
|
|
|
sed 's,#!/usr/bin/env python3,#!${python3}/bin/python,' -i rocm_agent_enumerator
|
|
|
|
sed 's,lsmod | grep ,${busybox}/bin/lsmod | ${gnugrep}/bin/grep ,' -i rocminfo.cc
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
cp rocminfo $out/bin
|
|
|
|
cp rocm_agent_enumerator $out/bin
|
|
|
|
'' + lib.optionalString (defaultTargets != []) ''
|
|
|
|
echo '${lib.concatStringsSep "\n" defaultTargets}' > $out/bin/target.lst
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru.updateScript = writeScript "update.sh" ''
|
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#!nix-shell -i bash -p curl jq common-updater-scripts
|
2022-12-02 08:20:57 +00:00
|
|
|
version="$(curl ''${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} -sL "https://api.github.com/repos/RadeonOpenCompute/rocminfo/tags" | jq '.[].name | split("-") | .[1] | select( . != null )' --raw-output | sort -n | tail -1)"
|
2022-11-27 09:42:12 +00:00
|
|
|
update-source-version rocminfo "$version" --ignore-same-hash
|
2021-09-18 10:52:07 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "ROCm Application for Reporting System Info";
|
|
|
|
homepage = "https://github.com/RadeonOpenCompute/rocminfo";
|
|
|
|
license = licenses.ncsa;
|
2022-11-27 09:42:12 +00:00
|
|
|
maintainers = with maintainers; [ lovesegfault ] ++ teams.rocm.members;
|
2021-09-18 10:52:07 +00:00
|
|
|
platforms = platforms.linux;
|
2022-11-21 17:40:18 +00:00
|
|
|
broken = stdenv.isAarch64;
|
2021-09-18 10:52:07 +00:00
|
|
|
};
|
2022-11-27 09:42:12 +00:00
|
|
|
})
|