Gentoo Archives: gentoo-commits

From: Benda XU <heroxbd@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:master commit in: sci-libs/rocBLAS/files/, sci-libs/rocBLAS/
Date: Sat, 06 Feb 2021 16:19:59
Message-Id: 1612628389.d0adb875160c06a460f49d028adf6eed32646ae5.heroxbd@gentoo
1 commit: d0adb875160c06a460f49d028adf6eed32646ae5
2 Author: Benda Xu <heroxbd <AT> gentoo <DOT> org>
3 AuthorDate: Sat Feb 6 16:18:10 2021 +0000
4 Commit: Benda XU <heroxbd <AT> gentoo <DOT> org>
5 CommitDate: Sat Feb 6 16:19:49 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=d0adb875
7
8 sci-libs/rocBLAS: depend on Tensile-4.0.0-r1 and newer.
9
10 clean up the ebuild.
11
12 Bug: https://github.com/justxi/rocm/issues/133
13 Package-Manager: Portage-3.0.12, Repoman-3.0.1
14 Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>
15
16 .../files/Tensile-4.0.0-locate-commands.patch | 32 +++++++++
17 sci-libs/rocBLAS/rocBLAS-4.0.0-r2.ebuild | 76 ++++++++++++++++++++++
18 2 files changed, 108 insertions(+)
19
20 diff --git a/sci-libs/rocBLAS/files/Tensile-4.0.0-locate-commands.patch b/sci-libs/rocBLAS/files/Tensile-4.0.0-locate-commands.patch
21 new file mode 100644
22 index 000000000..461a736a2
23 --- /dev/null
24 +++ b/sci-libs/rocBLAS/files/Tensile-4.0.0-locate-commands.patch
25 @@ -0,0 +1,32 @@
26 +Index: Tensile-rocm-4.0.0/Tensile/Common.py
27 +===================================================================
28 +--- Tensile-rocm-4.0.0.orig/Tensile/Common.py
29 ++++ Tensile-rocm-4.0.0/Tensile/Common.py
30 +@@ -1521,14 +1521,14 @@ def assignGlobalParameters( config ):
31 + print2(" %24s: %8s (unspecified)" % (key, defaultValue))
32 +
33 + # ROCm Agent Enumerator Path
34 +- globalParameters["ROCmAgentEnumeratorPath"] = locateExe("/opt/rocm/bin", "rocm_agent_enumerator")
35 ++ globalParameters["ROCmAgentEnumeratorPath"] = locateExe("", "rocm_agent_enumerator")
36 + if "CxxCompiler" in config:
37 + globalParameters["CxxCompiler"] = config["CxxCompiler"]
38 +
39 + if "TENSILE_ROCM_ASSEMBLER_PATH" in os.environ:
40 + globalParameters["AssemblerPath"] = os.environ.get("TENSILE_ROCM_ASSEMBLER_PATH")
41 + elif globalParameters["AssemblerPath"] is None and globalParameters["CxxCompiler"] == "hipcc":
42 +- globalParameters["AssemblerPath"] = locateExe("/opt/rocm/llvm/bin", "clang++")
43 ++ globalParameters["AssemblerPath"] = locateExe("", "clang++")
44 + elif globalParameters["AssemblerPath"] is None and globalParameters["CxxCompiler"] == "hcc":
45 + globalParameters["AssemblerPath"] = locateExe("/opt/rocm/bin", "hcc")
46 +
47 +@@ -1536,8 +1536,8 @@ def assignGlobalParameters( config ):
48 + if globalParameters["CxxCompiler"] == "hcc":
49 + globalParameters["ExtractKernelPath"] = locateExe("/opt/rocm/bin", "extractkernel")
50 + else:
51 +- globalParameters["ExtractKernelPath"] = locateExe("/opt/rocm/hip/bin", "extractkernel")
52 +- globalParameters["ClangOffloadBundlerPath"] = locateExe("/opt/rocm/llvm/bin", "clang-offload-bundler")
53 ++ globalParameters["ExtractKernelPath"] = locateExe("", "extractkernel")
54 ++ globalParameters["ClangOffloadBundlerPath"] = locateExe("", "clang-offload-bundler")
55 +
56 + if "ROCmAgentEnumeratorPath" in config:
57 + globalParameters["ROCmAgentEnumeratorPath"] = config["ROCmAgentEnumeratorPath"]
58
59 diff --git a/sci-libs/rocBLAS/rocBLAS-4.0.0-r2.ebuild b/sci-libs/rocBLAS/rocBLAS-4.0.0-r2.ebuild
60 new file mode 100644
61 index 000000000..ba8f4c0e6
62 --- /dev/null
63 +++ b/sci-libs/rocBLAS/rocBLAS-4.0.0-r2.ebuild
64 @@ -0,0 +1,76 @@
65 +# Copyright 1999-2021 Gentoo Authors
66 +# Distributed under the terms of the GNU General Public License v2
67 +
68 +EAPI=7
69 +
70 +inherit cmake
71 +
72 +DESCRIPTION="AMD's library for BLAS on ROCm."
73 +HOMEPAGE="https://github.com/ROCmSoftwarePlatform/rocBLAS"
74 +SRC_URI="https://github.com/ROCmSoftwarePlatform/rocBLAS/archive/rocm-${PV}.tar.gz -> rocm-${PN}-${PV}.tar.gz"
75 +
76 +LICENSE="MIT"
77 +KEYWORDS="~amd64"
78 +SLOT="0"
79 +
80 +RDEPEND="=dev-util/hip-$(ver_cut 1-2)*"
81 +DEPEND="${RDEPEND}
82 + dev-perl/File-Which
83 + dev-libs/msgpack
84 + dev-util/cmake
85 + dev-util/rocm-cmake
86 + >=dev-util/Tensile-4.0.0-r1
87 + "
88 +
89 +# stripped library is not working
90 +RESTRICT="strip"
91 +
92 +S="${WORKDIR}"/${PN}-rocm-${PV}
93 +
94 +rocBLAS_V="0.1"
95 +
96 +PATCHES=( "${FILESDIR}"/${PN}-4.0.0-use-system-tensile.patch )
97 +
98 +src_prepare() {
99 + eapply_user
100 +
101 + sed -e "/PREFIX rocblas/d" \
102 + -e "/<INSTALL_INTERFACE/s:include:include/rocblas:" \
103 + -e "s:rocblas/include:include/rocblas:" \
104 + -e "s:\\\\\${CPACK_PACKAGING_INSTALL_PREFIX}rocblas/lib:${EPREFIX}/usr/$(get_libdir)/rocblas:" \
105 + -e "/rocm_install_symlink_subdir( rocblas )/d" -i library/src/CMakeLists.txt || die
106 +
107 + cmake_src_prepare
108 +}
109 +
110 +src_configure() {
111 + # allow acces to hardware
112 + addwrite /dev/kfd
113 + addwrite /dev/dri/
114 + addwrite /dev/random
115 +
116 + export PATH="${EPREFIX}/usr/lib/llvm/roc/bin:${PATH}"
117 +
118 + local mycmakeargs=(
119 + -DTensile_LOGIC="asm_full"
120 + -DTensile_COMPILER="hipcc"
121 + -DTensile_ARCHITECTURE="all"
122 + -DTensile_LIBRARY_FORMAT="msgpack"
123 + -DTensile_CODE_OBJECT_VERSION="V3"
124 + -DTensile_TEST_LOCAL_PATH="${WORKDIR}/Tensile-rocm-${PV}"
125 + -DBUILD_WITH_TENSILE=ON
126 + -DBUILD_WITH_TENSILE_HOST=ON
127 + -DCMAKE_CXX_FLAGS="--rocm-path=${EPREFIX}/usr"
128 + -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
129 + -DCMAKE_INSTALL_INCLUDEDIR="include/rocblas"
130 + -DBUILD_TESTING=OFF
131 + -DBUILD_CLIENTS_SAMPLES=OFF
132 + -DBUILD_CLIENTS_TESTS=OFF
133 + -DBUILD_CLIENTS_BENCHMARKS=OFF
134 + )
135 +
136 + CXX="hipcc" cmake_src_configure
137 +
138 + # do not rerun cmake and the build process in src_install
139 + sed -e '/RERUN/,+1d' -i "${BUILD_DIR}"/build.ninja || die
140 +}