commit:     e6d20abad9fbc9a535341c82f5df908324a4a957
Author:     Yiyang Wu <xgreenlandforwyy <AT> gmail <DOT> com>
AuthorDate: Wed Jan 18 13:36:49 2023 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Fri Jan 27 07:33:23 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e6d20aba

dev-util/rocm-smi: add 5.4.2

Closes: https://bugs.gentoo.org/886513
Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 dev-util/rocm-smi/Manifest                         |  1 +
 .../rocm-smi-5.4.2-detect-builtin-amdgpu.patch     | 26 ++++++++++
 dev-util/rocm-smi/rocm-smi-5.4.2.ebuild            | 57 ++++++++++++++++++++++
 3 files changed, 84 insertions(+)

diff --git a/dev-util/rocm-smi/Manifest b/dev-util/rocm-smi/Manifest
index 9aab44729a91..a37fb72a90db 100644
--- a/dev-util/rocm-smi/Manifest
+++ b/dev-util/rocm-smi/Manifest
@@ -1,2 +1,3 @@
 DIST rocm-smi-5.0.2.tar.gz 1677784 BLAKE2B 
28e136a8b3c630ed7d5b514ad5bf985ff540df8e1fc2378b855032a6ebd2bcbcd4aab5e8a5a9e6462eacd2ac9ada0b8940aed582ce118d1066bded115af42e22
 SHA512 
bbad2bbebb81de42a15d8aa48e4751dbf9b8f9ee74633d16828f6977fadff35e9db0b7c9ee465a61c40a3e8f2f0f99b79cd5c5b142785cf61958d432f13d7f05
 DIST rocm-smi-5.1.3.tar.gz 1701386 BLAKE2B 
c5e779f5c33fec0b1b39b09c758dfadd3c24e28f15381593f2959e5c2fb9f49af3a7ca1f9ab7d6bf34c5af4fbe3f0c0ae20c6c049cbf9421a9184735bb4a64a2
 SHA512 
7bf7af2b42a035c298c2f9009b6123671af41f9ca1a50607cfa362f39dbd82ff88f8c13ece6c4edab585edadd9072ed096a400dd3850851e1beef3633a8eb14e
+DIST rocm-smi-5.4.2.tar.gz 1553259 BLAKE2B 
0560e115028caafb1d5dd8892cfa677431b792714ecd8c75f31451fa7685d1c7070cbd687c894d7eefd112de5e2df9aa7895aa57821db207dffc4e8890898638
 SHA512 
0fd651593df0ebbcb2c2327d030d2674efacdb6e883daa5a8adf733db2bde3e5d16dc304856221f4bb07a3cd834944ffcc7ebd689624f7ba24ffd6c262ba74b8

diff --git a/dev-util/rocm-smi/files/rocm-smi-5.4.2-detect-builtin-amdgpu.patch 
b/dev-util/rocm-smi/files/rocm-smi-5.4.2-detect-builtin-amdgpu.patch
new file mode 100644
index 000000000000..1c406c7d042c
--- /dev/null
+++ b/dev-util/rocm-smi/files/rocm-smi-5.4.2-detect-builtin-amdgpu.patch
@@ -0,0 +1,26 @@
+Detect amdgpu module for amdgpu-builtin kernel
+From dc2a4b5b256692e1a6ecef45210682c316b961e0 Mon Sep 17 00:00:00 2001
+From: YiyangWu <xgreenlandfor...@gmail.com>
+Date: Sat, 2 Apr 2022 16:40:11 +0800
+Subject: [PATCH] Check /sys/module/amdgpu for ROCk instead of lsmod
+
+Closes: #102
+
+Signed-off-by: YiyangWu <xgreenlandfor...@gmail.com>
+---
+ python_smi_tools/rocm_smi.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+Index: rocm_smi_lib-rocm-5.4.2/python_smi_tools/rocm_smi.py
+===================================================================
+--- rocm_smi_lib-rocm-5.4.2.orig/python_smi_tools/rocm_smi.py
++++ rocm_smi_lib-rocm-5.4.2/python_smi_tools/rocm_smi.py
+@@ -66,7 +66,7 @@ def driverInitialized():
+     """
+     driverInitialized = ''
+     try:
+-        driverInitialized = str(subprocess.check_output("cat 
/sys/module/amdgpu/initstate |grep live", shell=True))
++        driverInitialized = str(subprocess.check_output("test -d 
/sys/module/amdgpu", shell=True))
+     except subprocess.CalledProcessError:
+         pass
+     if len(driverInitialized) > 0:

diff --git a/dev-util/rocm-smi/rocm-smi-5.4.2.ebuild 
b/dev-util/rocm-smi/rocm-smi-5.4.2.ebuild
new file mode 100644
index 000000000000..bc4f8b802371
--- /dev/null
+++ b/dev-util/rocm-smi/rocm-smi-5.4.2.ebuild
@@ -0,0 +1,57 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+
+inherit cmake python-r1
+
+DESCRIPTION="ROCm System Management Interface Library"
+HOMEPAGE="https://github.com/RadeonOpenCompute/rocm_smi_lib";
+
+if [[ ${PV} == *9999 ]] ; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/RadeonOpenCompute/rocm_smi_lib";
+       EGIT_BRANCH="master"
+else
+       
SRC_URI="https://github.com/RadeonOpenCompute/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)"
+IUSE=""
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+DEPEND=""
+RDEPEND="${PYTHON_DEPS}"
+BDEPEND=""
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-5.0.2-gcc12-memcpy.patch
+       "${FILESDIR}"/${PN}-5.4.2-detect-builtin-amdgpu.patch
+)
+
+src_prepare() {
+       sed -e "/LICENSE.txt/d" -i CMakeLists.txt || die
+       sed -e "/^path_librocm = /c\path_librocm = 
'${EPREFIX}/usr/lib64/librocm_smi64.so'" \
+               -i python_smi_tools/rsmiBindings.py || die
+       cmake_src_prepare
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
+               -DCMAKE_DISABLE_FIND_PACKAGE_LATEX=ON
+               -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
+}

Reply via email to