summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Ammerlaan <andrewammerlaan@gentoo.org>2022-03-05 21:50:24 +0100
committerAndrew Ammerlaan <andrewammerlaan@gentoo.org>2022-03-05 21:51:53 +0100
commit890148bb81f517304f86f41303534b0abaa7c77c (patch)
tree4ce496f748b8afcac14115909f095d7f4eddc809 /sci-libs/rocBLAS
parentdev-util/Tensile: add new dependency of rocBLAS (diff)
downloadgentoo-890148bb81f517304f86f41303534b0abaa7c77c.tar.gz
gentoo-890148bb81f517304f86f41303534b0abaa7c77c.tar.bz2
gentoo-890148bb81f517304f86f41303534b0abaa7c77c.zip
sci-libs/rocBLAS: unbundle Tensile
Package-Manager: Portage-3.0.30, Repoman-3.0.3 Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Diffstat (limited to 'sci-libs/rocBLAS')
-rw-r--r--sci-libs/rocBLAS/files/rocBLAS-4.3.0-unbundle-Tensile.patch44
-rw-r--r--sci-libs/rocBLAS/rocBLAS-4.3.0-r1.ebuild147
2 files changed, 191 insertions, 0 deletions
diff --git a/sci-libs/rocBLAS/files/rocBLAS-4.3.0-unbundle-Tensile.patch b/sci-libs/rocBLAS/files/rocBLAS-4.3.0-unbundle-Tensile.patch
new file mode 100644
index 000000000000..f2bcff9a58db
--- /dev/null
+++ b/sci-libs/rocBLAS/files/rocBLAS-4.3.0-unbundle-Tensile.patch
@@ -0,0 +1,44 @@
+diff --git a/cmake/virtualenv.cmake b/cmake/virtualenv.cmake
+index 4c29c94..f9838c2 100644
+--- a/cmake/virtualenv.cmake
++++ b/cmake/virtualenv.cmake
+@@ -11,7 +11,7 @@ set(VIRTUALENV_HOME_DIR ${CMAKE_BINARY_DIR}/virtualenv CACHE PATH "Path to virtu
+ function(virtualenv_create)
+ message("${VIRTUALENV_PYTHON_EXE} -m venv ${VIRTUALENV_HOME_DIR} --system-site-packages --clear")
+ execute_process(
+- COMMAND ${VIRTUALENV_PYTHON_EXE} -m venv ${VIRTUALENV_HOME_DIR} --system-site-packages --clear
++ COMMAND true
+ )
+ endfunction()
+
+@@ -21,7 +21,7 @@ function(virtualenv_install)
+ message("${VIRTUALENV_HOME_DIR}/bin/python -m pip install ${ARGN}")
+ execute_process(
+ RESULT_VARIABLE rc
+- COMMAND ${VIRTUALENV_HOME_DIR}/bin/python -m pip install ${ARGN}
++ COMMAND true
+ )
+ if(rc)
+ message(FATAL_ERROR ${rc})
+diff --git a/library/src/CMakeLists.txt b/library/src/CMakeLists.txt
+index a34ee87..bf94988 100755
+--- a/library/src/CMakeLists.txt
++++ b/library/src/CMakeLists.txt
+@@ -99,9 +99,6 @@ if( BUILD_WITH_TENSILE )
+ # Create a unique name for TensileHost compiled for rocBLAS
+ set_target_properties( TensileHost PROPERTIES OUTPUT_NAME rocblas-tensile CXX_EXTENSIONS NO )
+ target_compile_definitions( TensileHost PUBLIC USE_TENSILE_HOST )
+-
+- # Tensile host depends on libs build target
+- add_dependencies( TensileHost TENSILE_LIBRARY_TARGET )
+ else()
+ # Create a unique name for Tensile compiled for rocBLAS
+ set_target_properties( Tensile PROPERTIES OUTPUT_NAME rocblas-tensile CXX_EXTENSIONS NO )
+@@ -520,7 +517,6 @@ rocm_install_targets(
+ if( BUILD_WITH_TENSILE )
+ if( BUILD_WITH_TENSILE_HOST )
+ set( ROCBLAS_TENSILE_LIBRARY_DIR "\${CPACK_PACKAGING_INSTALL_PREFIX}rocblas/lib" CACHE PATH "path to tensile library" )
+- install(DIRECTORY ${CMAKE_BINARY_DIR}/Tensile/library DESTINATION ${ROCBLAS_TENSILE_LIBRARY_DIR})
+ endif()
+ endif()
+
diff --git a/sci-libs/rocBLAS/rocBLAS-4.3.0-r1.ebuild b/sci-libs/rocBLAS/rocBLAS-4.3.0-r1.ebuild
new file mode 100644
index 000000000000..13cf41fdd900
--- /dev/null
+++ b/sci-libs/rocBLAS/rocBLAS-4.3.0-r1.ebuild
@@ -0,0 +1,147 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{8..10} )
+DOCS_BUILDER="doxygen"
+DOCS_DIR="docs"
+DOCS_DEPEND="media-gfx/graphviz"
+inherit cmake docs prefix python-any-r1
+
+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-${P}.tar.gz"
+S="${WORKDIR}/${PN}-rocm-${PV}"
+
+LICENSE="BSD"
+KEYWORDS="~amd64"
+SLOT="0/$(ver_cut 1-2)"
+IUSE="benchmark test"
+RESTRICT="!test? ( test )"
+
+BDEPEND="${PYTHON_DEPS}
+ dev-util/rocm-cmake:${SLOT}
+ $(python_gen_any_dep '
+ dev-util/Tensile[${PYTHON_USEDEP}]
+ ')
+ dev-util/Tensile:${SLOT}
+"
+
+DEPEND="
+ dev-util/hip:${SLOT}
+ dev-libs/msgpack
+ test? (
+ virtual/blas
+ dev-cpp/gtest
+ sys-libs/libomp
+ )
+ benchmark? (
+ virtual/blas
+ sys-libs/libomp
+ )
+"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-4.3.0-fix-glibc-2.32-and-above.patch
+ "${FILESDIR}"/${PN}-4.3.0-change-default-Tensile-library-dir.patch
+ "${FILESDIR}"/${PN}-4.3.0-link-system-blas.patch
+ "${FILESDIR}"/${PN}-4.3.0-remove-problematic-test-suites.patch
+ "${FILESDIR}"/${PN}-4.3.0-unbundle-Tensile.patch
+)
+
+python_check_deps() {
+ has_version "dev-util/Tensile[${PYTHON_USEDEP}]"
+}
+
+src_prepare() {
+ cmake_src_prepare
+ # Fit for Gentoo FHS rule
+ 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 "s:share/doc/rocBLAS:share/doc/${P}:" \
+ -e "/rocm_install_symlink_subdir( rocblas )/d" -i library/src/CMakeLists.txt || die
+
+ sed -e "s:,-rpath=.*\":\":" -i clients/CMakeLists.txt || die
+
+ eprefixify library/src/tensile_host.cpp
+}
+
+src_configure() {
+ # allow acces to hardware
+ addpredict /dev/kfd
+ addpredict /dev/dri/
+ addpredict /dev/random
+
+ export PATH="${EPREFIX}/usr/lib/llvm/roc/bin:${PATH}"
+ export TENSILE_SKIP_LIBRARY=1
+
+ local mycmakeargs=(
+ -DTensile_LOGIC="asm_full"
+ -DTensile_COMPILER="hipcc"
+ -DTensile_LIBRARY_FORMAT="msgpack"
+ -DTensile_CODE_OBJECT_VERSION="V3"
+ -DTensile_TEST_LOCAL_PATH="${EPREFIX}/usr/share/Tensile"
+ -DTensile_ROOT="${EPREFIX}/usr/share/Tensile"
+ -DBUILD_WITH_TENSILE=ON
+ -DBUILD_WITH_TENSILE_HOST=ON
+ -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
+ -DCMAKE_INSTALL_INCLUDEDIR="include/rocblas"
+ -DCMAKE_SKIP_RPATH=TRUE
+ -DBUILD_TESTING=OFF
+ -DBUILD_CLIENTS_SAMPLES=OFF
+ -DBUILD_CLIENTS_TESTS=$(usex test ON OFF)
+ -DBUILD_CLIENTS_BENCHMARKS=$(usex benchmark ON OFF)
+ ${AMDGPU_TARGETS+-DAMDGPU_TARGETS="${AMDGPU_TARGETS}"}
+ )
+
+ 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
+}
+
+src_compile() {
+ docs_compile
+ cmake_src_compile
+}
+
+check_rw_permission() {
+ local cmd="[ -r $1 ] && [ -w $1 ]"
+ local error=0 user
+ if has sandbox ${FEATURES}; then
+ user="portage"
+ su portage -c "${cmd}" || error=1
+ else
+ user="$(whoami)"
+ ${cmd} || error=1
+ fi
+ if [[ "${error}" == 1 ]]; then
+ die "${user} do not have read and write permissions on $1! \n Make sure ${user} is in render group and check the permissions."
+ fi
+}
+
+src_test() {
+ # check permissions on /dev/kfd and /dev/dri/render*
+ check_rw_permission /dev/kfd
+ check_rw_permission /dev/dri/render*
+ addwrite /dev/kfd
+ addwrite /dev/dri/
+ cd "${BUILD_DIR}/clients/staging" || die
+ ./rocblas-test || die "Tests failed"
+}
+
+src_install() {
+ cmake_src_install
+
+ if use benchmark; then
+ cd "${BUILD_DIR}" || die
+ dolib.so clients/librocblas_fortran_client.so
+ dobin clients/staging/rocblas-bench
+ fi
+
+ # Don't install the License (it is installed into the wrong dir)
+ rm "${ED}/usr/share/doc/${P}/LICENSE"* || die
+}