2023-01-20 10:41:00 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2022-12-17 10:02:37 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, rocmUpdateScript
|
|
|
|
, cmake
|
|
|
|
, rocm-cmake
|
2023-01-20 10:41:00 +00:00
|
|
|
, rocm-runtime
|
2022-12-17 10:02:37 +00:00
|
|
|
, busybox
|
2023-01-20 10:41:00 +00:00
|
|
|
, python3
|
2022-12-17 10:02:37 +00:00
|
|
|
, gnugrep
|
2021-09-18 10:52:07 +00:00
|
|
|
# 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.
|
2022-12-17 10:02:37 +00:00
|
|
|
, defaultTargets ? []
|
|
|
|
}:
|
|
|
|
|
2022-11-27 09:42:12 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "5.7.1";
|
2021-09-18 10:52:07 +00:00
|
|
|
pname = "rocminfo";
|
2022-12-17 10:02:37 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
src = fetchFromGitHub {
|
2024-01-02 11:29:13 +00:00
|
|
|
owner = "ROCm";
|
2021-09-18 10:52:07 +00:00
|
|
|
repo = "rocminfo";
|
2022-11-27 09:42:12 +00:00
|
|
|
rev = "rocm-${finalAttrs.version}";
|
2023-10-19 13:55:26 +00:00
|
|
|
sha256 = "sha256-UzOo2qDT/uM+vdGdBM4pV5e143mfa+/6sZLBExOO26g=";
|
2021-09-18 10:52:07 +00:00
|
|
|
};
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
rocm-cmake
|
2021-09-18 10:52:07 +00:00
|
|
|
];
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
buildInputs = [ rocm-runtime ];
|
|
|
|
propagatedBuildInputs = [ python3 ];
|
|
|
|
cmakeFlags = [ "-DROCRTST_BLD_TYPE=Release" ];
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
prePatch = ''
|
2023-01-20 10:41:00 +00:00
|
|
|
patchShebangs rocm_agent_enumerator
|
2021-09-18 10:52:07 +00:00
|
|
|
sed 's,lsmod | grep ,${busybox}/bin/lsmod | ${gnugrep}/bin/grep ,' -i rocminfo.cc
|
|
|
|
'';
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
postInstall = lib.optionalString (defaultTargets != [ ]) ''
|
2021-09-18 10:52:07 +00:00
|
|
|
echo '${lib.concatStringsSep "\n" defaultTargets}' > $out/bin/target.lst
|
|
|
|
'';
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
passthru.updateScript = rocmUpdateScript {
|
|
|
|
name = finalAttrs.pname;
|
|
|
|
owner = finalAttrs.src.owner;
|
|
|
|
repo = finalAttrs.src.repo;
|
|
|
|
};
|
2021-09-18 10:52:07 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "ROCm Application for Reporting System Info";
|
2024-01-02 11:29:13 +00:00
|
|
|
homepage = "https://github.com/ROCm/rocminfo";
|
2021-09-18 10:52:07 +00:00
|
|
|
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;
|
2024-01-02 11:29:13 +00:00
|
|
|
broken = stdenv.isAarch64 || versions.minor finalAttrs.version != versions.minor stdenv.cc.version || versionAtLeast finalAttrs.version "6.0.0";
|
2021-09-18 10:52:07 +00:00
|
|
|
};
|
2022-11-27 09:42:12 +00:00
|
|
|
})
|