commit:     d0adb875160c06a460f49d028adf6eed32646ae5
Author:     Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Sat Feb  6 16:18:10 2021 +0000
Commit:     Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Sat Feb  6 16:19:49 2021 +0000
URL:        https://gitweb.gentoo.org/proj/sci.git/commit/?id=d0adb875

sci-libs/rocBLAS: depend on Tensile-4.0.0-r1 and newer.

clean up the ebuild.

Bug: https://github.com/justxi/rocm/issues/133
Package-Manager: Portage-3.0.12, Repoman-3.0.1
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>

 .../files/Tensile-4.0.0-locate-commands.patch      | 32 +++++++++
 sci-libs/rocBLAS/rocBLAS-4.0.0-r2.ebuild           | 76 ++++++++++++++++++++++
 2 files changed, 108 insertions(+)

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
new file mode 100644
index 000000000..461a736a2
--- /dev/null
+++ b/sci-libs/rocBLAS/files/Tensile-4.0.0-locate-commands.patch
@@ -0,0 +1,32 @@
+Index: Tensile-rocm-4.0.0/Tensile/Common.py
+===================================================================
+--- Tensile-rocm-4.0.0.orig/Tensile/Common.py
++++ Tensile-rocm-4.0.0/Tensile/Common.py
+@@ -1521,14 +1521,14 @@ def assignGlobalParameters( config ):
+       print2(" %24s: %8s (unspecified)" % (key, defaultValue))
+ 
+   # ROCm Agent Enumerator Path
+-  globalParameters["ROCmAgentEnumeratorPath"] = locateExe("/opt/rocm/bin", 
"rocm_agent_enumerator")
++  globalParameters["ROCmAgentEnumeratorPath"] = locateExe("", 
"rocm_agent_enumerator")
+   if "CxxCompiler" in config:
+     globalParameters["CxxCompiler"] = config["CxxCompiler"]
+ 
+   if "TENSILE_ROCM_ASSEMBLER_PATH" in os.environ:
+     globalParameters["AssemblerPath"] = 
os.environ.get("TENSILE_ROCM_ASSEMBLER_PATH")
+   elif globalParameters["AssemblerPath"] is None and 
globalParameters["CxxCompiler"] == "hipcc":
+-    globalParameters["AssemblerPath"] = locateExe("/opt/rocm/llvm/bin", 
"clang++")
++    globalParameters["AssemblerPath"] = locateExe("", "clang++")
+   elif globalParameters["AssemblerPath"] is None and 
globalParameters["CxxCompiler"] == "hcc":
+     globalParameters["AssemblerPath"] = locateExe("/opt/rocm/bin", "hcc")
+ 
+@@ -1536,8 +1536,8 @@ def assignGlobalParameters( config ):
+   if globalParameters["CxxCompiler"] == "hcc":
+     globalParameters["ExtractKernelPath"] = locateExe("/opt/rocm/bin", 
"extractkernel")
+   else:
+-    globalParameters["ExtractKernelPath"] = locateExe("/opt/rocm/hip/bin", 
"extractkernel")
+-    globalParameters["ClangOffloadBundlerPath"] = 
locateExe("/opt/rocm/llvm/bin", "clang-offload-bundler")
++    globalParameters["ExtractKernelPath"] = locateExe("", "extractkernel")
++    globalParameters["ClangOffloadBundlerPath"] = locateExe("", 
"clang-offload-bundler")
+ 
+   if "ROCmAgentEnumeratorPath" in config:
+     globalParameters["ROCmAgentEnumeratorPath"] = 
config["ROCmAgentEnumeratorPath"]

diff --git a/sci-libs/rocBLAS/rocBLAS-4.0.0-r2.ebuild 
b/sci-libs/rocBLAS/rocBLAS-4.0.0-r2.ebuild
new file mode 100644
index 000000000..ba8f4c0e6
--- /dev/null
+++ b/sci-libs/rocBLAS/rocBLAS-4.0.0-r2.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit cmake
+
+DESCRIPTION="AMD's library for BLAS on ROCm."
+HOMEPAGE="https://github.com/ROCmSoftwarePlatform/rocBLAS";
+SRC_URI="https://github.com/ROCmSoftwarePlatform/rocBLAS/archive/rocm-${PV}.tar.gz
 -> rocm-${PN}-${PV}.tar.gz"
+
+LICENSE="MIT"
+KEYWORDS="~amd64"
+SLOT="0"
+
+RDEPEND="=dev-util/hip-$(ver_cut 1-2)*"
+DEPEND="${RDEPEND}
+       dev-perl/File-Which
+       dev-libs/msgpack
+       dev-util/cmake
+       dev-util/rocm-cmake
+       >=dev-util/Tensile-4.0.0-r1
+       "
+
+# stripped library is not working
+RESTRICT="strip"
+
+S="${WORKDIR}"/${PN}-rocm-${PV}
+
+rocBLAS_V="0.1"
+
+PATCHES=( "${FILESDIR}"/${PN}-4.0.0-use-system-tensile.patch )
+
+src_prepare() {
+       eapply_user
+
+       sed -e "/PREFIX rocblas/d" \
+               -e "/<INSTALL_INTERFACE/s:include:include/rocblas:" \
+               -e "s:rocblas/include:include/rocblas:" \
+               -e 
"s:\\\\\${CPACK_PACKAGING_INSTALL_PREFIX}rocblas/lib:${EPREFIX}/usr/$(get_libdir)/rocblas:"
 \
+               -e "/rocm_install_symlink_subdir( rocblas )/d" -i 
library/src/CMakeLists.txt || die
+
+       cmake_src_prepare
+}
+
+src_configure() {
+       # allow acces to hardware
+       addwrite /dev/kfd
+       addwrite /dev/dri/
+       addwrite /dev/random
+
+       export PATH="${EPREFIX}/usr/lib/llvm/roc/bin:${PATH}"
+
+       local mycmakeargs=(
+               -DTensile_LOGIC="asm_full"
+               -DTensile_COMPILER="hipcc"
+               -DTensile_ARCHITECTURE="all"
+               -DTensile_LIBRARY_FORMAT="msgpack"
+               -DTensile_CODE_OBJECT_VERSION="V3"
+               -DTensile_TEST_LOCAL_PATH="${WORKDIR}/Tensile-rocm-${PV}"
+               -DBUILD_WITH_TENSILE=ON
+               -DBUILD_WITH_TENSILE_HOST=ON
+               -DCMAKE_CXX_FLAGS="--rocm-path=${EPREFIX}/usr"
+               -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
+               -DCMAKE_INSTALL_INCLUDEDIR="include/rocblas"
+               -DBUILD_TESTING=OFF
+               -DBUILD_CLIENTS_SAMPLES=OFF
+               -DBUILD_CLIENTS_TESTS=OFF
+               -DBUILD_CLIENTS_BENCHMARKS=OFF
+       )
+
+       CXX="hipcc" cmake_src_configure
+
+       # do not rerun cmake and the build process in src_install
+       sed -e '/RERUN/,+1d' -i "${BUILD_DIR}"/build.ninja || die
+}

Reply via email to