diff --git a/dev-util/rocm-smi/Manifest b/dev-util/rocm-smi/Manifest index 162d85675b4dd..1a2bcca3ed91a 100644 --- a/dev-util/rocm-smi/Manifest +++ b/dev-util/rocm-smi/Manifest @@ -2,3 +2,4 @@ DIST rocm-smi-5.7.1.tar.gz 801646 BLAKE2B b4799bbdaeb7203c16117cd30511d589a2b96e DIST rocm-smi-6.1.1.tar.gz 872628 BLAKE2B 35830fd0eb36688b3803bed2059f29ba4d8613112ae4cfff2e0a3b1d7afef9f0d77ec16771e2205ba351df0aa678c3b0d2436940b76d10d020f1a30d14d760e9 SHA512 3e31ff0d94e7f0ea650c985973b27107e3f7293b92857fbf2fe196b61632c530e95c3228ad7550d44f8ee9f5f1abfd17e5c2b19164759728fb6d4b0995455fa7 DIST rocm-smi-6.3.2.tar.gz 902982 BLAKE2B 8b9f544d7ab66a8728f8e8fa0e217e2177fc8666c5cce47cdd59246c2309feedb63f59894fa53d5433acd462e5274826d411d5b052f6f61291e76516d3bf4dd5 SHA512 bdd7825a1147452cc9927d446cfb1f10ffa34fb63bdbb842e8e0f6a2126c3a2855e5bca2e6663c103f4b13d46656190b14d13aee3cf1a2f967f72305f15ce338 DIST rocm-smi-6.3.3.tar.gz 902980 BLAKE2B 8a8f80c4fb5485dc65b340ba4da2bb73061b989757ca6147d7d401dcbdbba5edbd1f68de78f66adcc5a6611a8ce870dfea6cbc31863918d6da9e9a7cb812746b SHA512 0f722effb404f605bef08f22eb4c4ecfb076ee10d112daf6a82f81d78e5279a185f497919b2d9ea414236761d1fa52231a6168a156f33b7f47a93857e30d7449 +DIST rocm-smi-6.4.1.tar.gz 934699 BLAKE2B 418ea7680118cf78f4ab9c8eaa8897360815519bdb0877e095fa7c5abe0d2e6c7db1d63098b8f75613e4fae9107d5581bfe7afd7fecef76f56de9231ce5d59ce SHA512 e8701f8746a48ebd6a22e919f14219e02992840003183e85811b4c94c7330efb1c487e8767a6504f4240fbbdc397b3e4e6a9ce0527e9635eb1bb944f412a8345 diff --git a/dev-util/rocm-smi/files/rocm-smi-6.4.1-log-exceptions.patch b/dev-util/rocm-smi/files/rocm-smi-6.4.1-log-exceptions.patch new file mode 100644 index 0000000000000..0e09b98269f81 --- /dev/null +++ b/dev-util/rocm-smi/files/rocm-smi-6.4.1-log-exceptions.patch @@ -0,0 +1,16 @@ +Log some more information, not just Exception caught: rsmi_init. + +Upstream PR: https://github.com/ROCm/rocm_smi_lib/pull/213#issuecomment-2972588767 +Bug: https://bugs.gentoo.org/957064 +--- a/src/rocm_smi.cc ++++ b/src/rocm_smi.cc +@@ -485,6 +485,9 @@ rsmi_init(uint64_t flags) { + if (smi.ref_count() == 1) { + try { + smi.Initialize(flags); ++ } catch(const amd::smi::rsmi_exception& e) { ++ smi.Cleanup(); ++ throw; + } catch(...) { + smi.Cleanup(); + throw amd::smi::rsmi_exception(RSMI_STATUS_INIT_ERROR, __FUNCTION__); \ No newline at end of file diff --git a/dev-util/rocm-smi/files/rocm-smi-6.4.1-set-soversion.patch b/dev-util/rocm-smi/files/rocm-smi-6.4.1-set-soversion.patch new file mode 100644 index 0000000000000..1d07aca0b77ad --- /dev/null +++ b/dev-util/rocm-smi/files/rocm-smi-6.4.1-set-soversion.patch @@ -0,0 +1,106 @@ +Switch from extracting version with git to version from ebuild filename. +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -38,21 +38,17 @@ set(SHARE_INSTALL_PREFIX + "share/${ROCM_SMI}" + CACHE STRING "Tests and Example install directory") + +-# provide git to utilities +-find_program (GIT NAMES git) +- +- +-## Setup the package version based on git tags. +-set(PKG_VERSION_GIT_TAG_PREFIX "rsmi_pkg_ver") +-get_package_version_number("7.6.0" ${PKG_VERSION_GIT_TAG_PREFIX} GIT) +-message("Package version: ${PKG_VERSION_STR}") +-set(${ROCM_SMI_LIBS_TARGET}_VERSION_MAJOR "${CPACK_PACKAGE_VERSION_MAJOR}") +-set(${ROCM_SMI_LIBS_TARGET}_VERSION_MINOR "${CPACK_PACKAGE_VERSION_MINOR}") +-set(${ROCM_SMI_LIBS_TARGET}_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}") +-set(${ROCM_SMI_LIBS_TARGET}_VERSION_BUILD "0") +-set(${ROCM_SMI_LIBS_TARGET}_VERSION_HASH "${PKG_VERSION_HASH}") +- +-set(${ROCM_SMI_LIBS_TARGET}_VERSION_STRING "${${ROCM_SMI_LIBS_TARGET}_VERSION_MAJOR}.${${ROCM_SMI_LIBS_TARGET}_VERSION_MINOR}.${${ROCM_SMI_LIBS_TARGET}_VERSION_PATCH}+${${ROCM_SMI_LIBS_TARGET}_VERSION_HASH}") ++set(VERSION_MAJOR "@VERSION_MAJOR@") ++set(VERSION_MINOR "@VERSION_MINOR@") ++set(VERSION_PATCH "@VERSION_PATCH@") ++set(PKG_VERSION_STR "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") ++set(SO_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}") ++set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}") ++set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}") ++set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}") ++set(rocm_smi_VERSION_MAJOR "${VERSION_MAJOR}") ++set(rocm_smi_VERSION_MINOR "${VERSION_MINOR}") ++set(rocm_smi_VERSION_PATCH "${VERSION_PATCH}") + + # The following default version values should be updated as appropriate for + # ABI breaks (update MAJOR and MINOR), and ABI/API additions (update MINOR). +--- a/oam/CMakeLists.txt ++++ b/oam/CMakeLists.txt +@@ -29,17 +29,6 @@ set(OAM_NAME "oam") + set(OAM_COMPONENT "lib${OAM_NAME}") + set(OAM_TARGET "${OAM_NAME}") + +-################# Determine the library version ######################### +-set(SO_VERSION_GIT_TAG_PREFIX "oam_so_ver") +- +-# VERSION_* variables should be set by get_version_from_tag +-message("Package version: ${PKG_VERSION_STR}") +- +-# Debian package specific variables +-# Set a default value for the package version +-get_version_from_tag("1.0.0.0" ${SO_VERSION_GIT_TAG_PREFIX} GIT) +- +-# VERSION_* variables should be set by get_version_from_tag + if ( ${ROCM_PATCH_VERSION} ) + set ( VERSION_PATCH ${ROCM_PATCH_VERSION}) + set(SO_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") +--- a/python_smi_tools/rsmiBindingsInit.py.in ++++ b/python_smi_tools/rsmiBindingsInit.py.in +@@ -26,17 +26,7 @@ def initRsmiBindings(silent=False): + if (rocm_smi_lib_path != None): + path_librocm = rocm_smi_lib_path + else: +- path_librocm = os.path.dirname(os.path.realpath(__file__)) + '/../../@CMAKE_INSTALL_LIBDIR@/librocm_smi64.so.@VERSION_MAJOR@' +- +- if not os.path.isfile(path_librocm): +- print_silent('Unable to find %s . Trying /opt/rocm*' % path_librocm) +- for root, dirs, files in os.walk('/opt', followlinks=True): +- if 'librocm_smi64.so.@VERSION_MAJOR@' in files: +- path_librocm = os.path.join(os.path.realpath(root), 'librocm_smi64.so.@VERSION_MAJOR@') +- if os.path.isfile(path_librocm): +- print_silent('Using lib from %s' % path_librocm) +- else: +- print('Unable to find librocm_smi64.so.@VERSION_MAJOR@') ++ path_librocm = 'librocm_smi64.so' + + # ----------> TODO: Support static libs as well as SO + try: +@@ -44,7 +34,7 @@ def initRsmiBindings(silent=False): + return CDLL(path_librocm) + except OSError: + print('Unable to load the rocm_smi library.\n'\ +- 'Set LD_LIBRARY_PATH to the folder containing librocm_smi64.so.@VERSION_MAJOR@\n'\ ++ 'Set LD_LIBRARY_PATH to the folder containing librocm_smi64.so\n'\ + '{0}Please refer to https://github.com/'\ + 'RadeonOpenCompute/rocm_smi_lib for the installation guide.{1}'\ + .format('\33[33m', '\033[0m')) +--- a/rocm_smi/CMakeLists.txt ++++ b/rocm_smi/CMakeLists.txt +@@ -31,17 +31,6 @@ set(ROCM_SMI_TARGET "${ROCM_SMI}64") + ## Include common cmake modules + include(utils) + +-################# Determine the library version ######################### +-set(SO_VERSION_GIT_TAG_PREFIX "rsmi_so_ver") +- +-# VERSION_* variables should be set by get_version_from_tag +-message("Package version: ${PKG_VERSION_STR}") +- +-# Debian package specific variables +-# Set a default value for the package version +-get_version_from_tag("1.0.0.0" ${SO_VERSION_GIT_TAG_PREFIX} GIT) +- +-# VERSION_* variables should be set by get_version_from_tag + if ( ${ROCM_PATCH_VERSION} ) + set ( VERSION_PATCH ${ROCM_PATCH_VERSION}) + set(SO_VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") diff --git a/dev-util/rocm-smi/rocm-smi-6.4.1.ebuild b/dev-util/rocm-smi/rocm-smi-6.4.1.ebuild new file mode 100644 index 0000000000000..c2bc046c9aeeb --- /dev/null +++ b/dev-util/rocm-smi/rocm-smi-6.4.1.ebuild @@ -0,0 +1,61 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{11..14} python3_13t ) + +inherit cmake python-r1 + +DESCRIPTION="ROCm System Management Interface Library" +HOMEPAGE="https://github.com/ROCm/rocm_smi_lib" + +if [[ ${PV} == *9999 ]] ; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/ROCm/rocm_smi_lib" + EGIT_BRANCH="master" +else + SRC_URI="https://github.com/ROCm/rocm_smi_lib/archive/rocm-${PV}.tar.gz -> rocm-smi-${PV}.tar.gz" + KEYWORDS="~amd64" + S="${WORKDIR}/rocm_smi_lib-rocm-${PV}" +fi + +LICENSE="MIT NCSA-AMD" +SLOT="0/$(ver_cut 1-2)" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" + +RDEPEND="${PYTHON_DEPS}" + +PATCHES=( + "${FILESDIR}"/${PN}-5.7.1-no-strip.patch + "${FILESDIR}"/${PN}-5.7.1-remove-example.patch + "${FILESDIR}"/${PN}-6.4.1-set-soversion.patch + "${FILESDIR}"/${PN}-6.3.0-fix-flags.patch + "${FILESDIR}"/${PN}-6.4.1-log-exceptions.patch +) + +src_prepare() { + cmake_src_prepare + + sed -e "s/@VERSION_MAJOR@/$(ver_cut 1)/" \ + -e "s/@VERSION_MINOR@/$(ver_cut 2)/" \ + -e "s/@VERSION_PATCH@/$(ver_cut 3)/" \ + -i CMakeLists.txt || die +} + +src_configure() { + local mycmakeargs=( + -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr" + -DFILE_REORG_BACKWARD_COMPATIBILITY=OFF + ) + cmake_src_configure +} + +src_install() { + cmake_src_install + python_foreach_impl python_newscript python_smi_tools/rocm_smi.py rocm-smi + python_foreach_impl python_domodule python_smi_tools/rsmiBindings.py + python_foreach_impl python_domodule python_smi_tools/rsmiBindingsInit.py + + mv "${ED}"/usr/share/doc/rocm_smi "${ED}/usr/share/doc/${PF}" || die +}