Gentoo Archives: gentoo-commits

From: Benda XU <heroxbd@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/rocm-smi/files/, dev-util/rocm-smi/
Date: Sat, 06 Aug 2022 14:23:20
Message-Id: 1659795744.c1198ee528b9f90cca1f63baecf16c8dbd0741e6.heroxbd@gentoo
1 commit: c1198ee528b9f90cca1f63baecf16c8dbd0741e6
2 Author: Yiyang Wu <xgreenlandforwyy <AT> gmail <DOT> com>
3 AuthorDate: Mon Jul 11 09:04:21 2022 +0000
4 Commit: Benda XU <heroxbd <AT> gentoo <DOT> org>
5 CommitDate: Sat Aug 6 14:22:24 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c1198ee5
7
8 dev-util/rocm-smi: add 5.1.3
9
10 Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
11 Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>
12
13 dev-util/rocm-smi/Manifest | 1 +
14 .../rocm-smi-5.1.3-detect-builtin-amdgpu.patch | 26 +++++++++
15 dev-util/rocm-smi/rocm-smi-5.1.3.ebuild | 62 ++++++++++++++++++++++
16 3 files changed, 89 insertions(+)
17
18 diff --git a/dev-util/rocm-smi/Manifest b/dev-util/rocm-smi/Manifest
19 index d45d584c8345..a5d1a8903631 100644
20 --- a/dev-util/rocm-smi/Manifest
21 +++ b/dev-util/rocm-smi/Manifest
22 @@ -2,3 +2,4 @@ DIST rocm-smi-4.0.0.tar.gz 45065 BLAKE2B 90a28c162099deaa67c98701b79328c760973d8
23 DIST rocm-smi-4.3.0.tar.gz 1672482 BLAKE2B 21b35daa565ce368ac10110ba73f723c5d2125e401f5c8fa2d8e3300f450f39dd0c1de74681249868a842b568af0f2cf0d1f7bf0d40d338a7d1ee7c9e25b67dd SHA512 2bf5d3f1be50636c7c848cfa982fcdb6fbf25d648bcbe2a195e1153c7f4c8b11b2b3650aaa110eec780a218a1503afe84637c7d6e7e868e7065f8c51d8d3b8dd
24 DIST rocm-smi-4.5.2.tar.gz 1674835 BLAKE2B 7cf69170a4a8dedfdc467e3b8dc64bd829136062487814e169cca0deabcd05d8adaf4fc440173e10cd8117ae63119f10a09c3042b0915b865e0620322c940e91 SHA512 640645d07dbc93a85d4e498bcc88fa0caab36b5af0f9feabf8a2383786ccb2b588be625f46e90d1b71803c011891a62a3642098fd0eb83530d5d8e0a49d204dc
25 DIST rocm-smi-5.0.2.tar.gz 1677784 BLAKE2B 28e136a8b3c630ed7d5b514ad5bf985ff540df8e1fc2378b855032a6ebd2bcbcd4aab5e8a5a9e6462eacd2ac9ada0b8940aed582ce118d1066bded115af42e22 SHA512 bbad2bbebb81de42a15d8aa48e4751dbf9b8f9ee74633d16828f6977fadff35e9db0b7c9ee465a61c40a3e8f2f0f99b79cd5c5b142785cf61958d432f13d7f05
26 +DIST rocm-smi-5.1.3.tar.gz 1701386 BLAKE2B c5e779f5c33fec0b1b39b09c758dfadd3c24e28f15381593f2959e5c2fb9f49af3a7ca1f9ab7d6bf34c5af4fbe3f0c0ae20c6c049cbf9421a9184735bb4a64a2 SHA512 7bf7af2b42a035c298c2f9009b6123671af41f9ca1a50607cfa362f39dbd82ff88f8c13ece6c4edab585edadd9072ed096a400dd3850851e1beef3633a8eb14e
27
28 diff --git a/dev-util/rocm-smi/files/rocm-smi-5.1.3-detect-builtin-amdgpu.patch b/dev-util/rocm-smi/files/rocm-smi-5.1.3-detect-builtin-amdgpu.patch
29 new file mode 100644
30 index 000000000000..3f322aef3582
31 --- /dev/null
32 +++ b/dev-util/rocm-smi/files/rocm-smi-5.1.3-detect-builtin-amdgpu.patch
33 @@ -0,0 +1,26 @@
34 +Detect amdgpu module for amdgpu-builtin kernel
35 +From dc2a4b5b256692e1a6ecef45210682c316b961e0 Mon Sep 17 00:00:00 2001
36 +From: YiyangWu <xgreenlandforwyy@×××××.com>
37 +Date: Sat, 2 Apr 2022 16:40:11 +0800
38 +Subject: [PATCH] Check /sys/module/amdgpu for ROCk instead of lsmod
39 +
40 +Closes: #102
41 +
42 +Signed-off-by: YiyangWu <xgreenlandforwyy@×××××.com>
43 +---
44 + python_smi_tools/rocm_smi.py | 2 +-
45 + 1 file changed, 1 insertion(+), 1 deletion(-)
46 +
47 +diff --git a/python_smi_tools/rocm_smi.py b/python_smi_tools/rocm_smi.py
48 +index 57606ee..35be495 100755
49 +--- a/python_smi_tools/rocm_smi.py
50 ++++ b/python_smi_tools/rocm_smi.py
51 +@@ -66,7 +66,7 @@ def driverInitialized():
52 + """
53 + driverInitialized = ''
54 + try:
55 +- driverInitialized = str(subprocess.check_output("cat /proc/modules|grep amdgpu", shell=True))
56 ++ driverInitialized = str(subprocess.check_output("test -d /sys/module/amdgpu", shell=True))
57 + except subprocess.CalledProcessError:
58 + pass
59 + if len(driverInitialized) > 0:
60
61 diff --git a/dev-util/rocm-smi/rocm-smi-5.1.3.ebuild b/dev-util/rocm-smi/rocm-smi-5.1.3.ebuild
62 new file mode 100644
63 index 000000000000..7947568516a5
64 --- /dev/null
65 +++ b/dev-util/rocm-smi/rocm-smi-5.1.3.ebuild
66 @@ -0,0 +1,62 @@
67 +# Copyright 1999-2022 Gentoo Authors
68 +# Distributed under the terms of the GNU General Public License v2
69 +
70 +EAPI=8
71 +
72 +PYTHON_COMPAT=( python3_{8..10} )
73 +
74 +inherit cmake python-r1
75 +
76 +DESCRIPTION="ROCm System Management Interface Library"
77 +HOMEPAGE="https://github.com/RadeonOpenCompute/rocm_smi_lib"
78 +
79 +if [[ ${PV} == *9999 ]] ; then
80 + inherit git-r3
81 + EGIT_REPO_URI="https://github.com/RadeonOpenCompute/rocm_smi_lib"
82 + EGIT_BRANCH="master"
83 +else
84 + SRC_URI="https://github.com/RadeonOpenCompute/rocm_smi_lib/archive/rocm-${PV}.tar.gz -> rocm-smi-${PV}.tar.gz"
85 + KEYWORDS="~amd64"
86 + S="${WORKDIR}/rocm_smi_lib-rocm-${PV}"
87 +fi
88 +
89 +LICENSE="MIT NCSA-AMD"
90 +SLOT="0/$(ver_cut 1-2)"
91 +IUSE=""
92 +REQUIRED_USE="${PYTHON_REQUIRED_USE}"
93 +
94 +DEPEND=""
95 +RDEPEND="${PYTHON_DEPS}"
96 +BDEPEND=""
97 +
98 +PATCHES=(
99 + "${FILESDIR}"/${PN}-5.0.2-gcc12-memcpy.patch
100 + "${FILESDIR}"/${PN}-5.1.3-detect-builtin-amdgpu.patch
101 +)
102 +
103 +src_prepare() {
104 + sed -e "/DESTINATION/s,\${OAM_NAME}/lib,$(get_libdir)," \
105 + -e "/DESTINATION/s,oam/include/oam,include/oam," -i oam/CMakeLists.txt || die
106 + sed -e "/link DESTINATION/,+1d" \
107 + -e "/DESTINATION/s,\${ROCM_SMI}/lib,$(get_libdir)," \
108 + -e "/bindings_link/,+3d" \
109 + -e "/rsmiBindings.py/,+1d" \
110 + -e "/DESTINATION/s,rocm_smi/include/rocm_smi,include/rocm_smi," -i rocm_smi/CMakeLists.txt || die
111 + sed -e "/LICENSE.txt/d" -e "s,\${ROCM_SMI}/lib/cmake,$(get_libdir)/cmake,g" -i CMakeLists.txt || die
112 + sed -e "/^path_librocm = /c\path_librocm = '${EPREFIX}/usr/lib64/librocm_smi64.so'" -i python_smi_tools/rsmiBindings.py || die
113 + cmake_src_prepare
114 +}
115 +
116 +src_configure() {
117 + local mycmakeargs=(
118 + -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
119 + -DCMAKE_DISABLE_FIND_PACKAGE_LATEX=ON
120 + )
121 + cmake_src_configure
122 +}
123 +
124 +src_install() {
125 + cmake_src_install
126 + python_foreach_impl python_newexe python_smi_tools/rocm_smi.py rocm-smi
127 + python_foreach_impl python_domodule python_smi_tools/rsmiBindings.py
128 +}