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/, sci-libs/rocBLAS/files/
Date: Wed, 20 Jan 2021 16:11:45
Message-Id: 1611159084.5a6ca7469f59dd61a837ad34b60a9bb33b9f105b.heroxbd@gentoo
1 commit: 5a6ca7469f59dd61a837ad34b60a9bb33b9f105b
2 Author: Benda Xu <heroxbd <AT> gentoo <DOT> org>
3 AuthorDate: Wed Jan 20 09:00:35 2021 +0000
4 Commit: Benda XU <heroxbd <AT> gentoo <DOT> org>
5 CommitDate: Wed Jan 20 16:11:24 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=5a6ca746
7
8 sci-libs/rocBLAS: AMD library for BLAS on the ROCm platform.
9
10 To be considered landing on ::gentoo when dev-util/Tensile is
11 available.
12
13 Bug: https://bugs.gentoo.org/650804
14 Bug: https://github.com/gentoo/gentoo/pull/10724
15 Suggested-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
16 Suggested-by: Wilfried Holzke <gentoo <AT> holzke.net>
17 Bug: https://github.com/justxi/rocm/issues/133
18 Package-Manager: Portage-3.0.12, Repoman-3.0.1
19 Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>
20
21 .../files/rocBLAS-4.0.0-use-system-tensile.patch | 30 ++++++++
22 sci-libs/rocBLAS/metadata.xml | 11 +++
23 sci-libs/rocBLAS/rocBLAS-4.0.0-r1.ebuild | 88 ++++++++++++++++++++++
24 3 files changed, 129 insertions(+)
25
26 diff --git a/sci-libs/rocBLAS/files/rocBLAS-4.0.0-use-system-tensile.patch b/sci-libs/rocBLAS/files/rocBLAS-4.0.0-use-system-tensile.patch
27 new file mode 100644
28 index 000000000..3b8e44a99
29 --- /dev/null
30 +++ b/sci-libs/rocBLAS/files/rocBLAS-4.0.0-use-system-tensile.patch
31 @@ -0,0 +1,30 @@
32 +diff --color -uprN rocBLAS-rocm-4.0.0/CMakeLists.txt new/CMakeLists.txt
33 +--- rocBLAS-rocm-4.0.0/CMakeLists.txt 2020-11-11 00:56:04.000000000 +0800
34 ++++ new/CMakeLists.txt 2021-01-20 15:23:09.570222990 +0800
35 +@@ -208,25 +208,7 @@ if( BUILD_WITH_TENSILE )
36 + option(TENSILE_USE_MSGPACK "Use msgpack for parsing config files." ON)
37 + endif()
38 +
39 +- include(virtualenv)
40 +- if (Tensile_TEST_LOCAL_PATH)
41 +- virtualenv_install(${Tensile_TEST_LOCAL_PATH})
42 +- message (STATUS "using local Tensile from ${Tensile_TEST_LOCAL_PATH}, copied to ${Tensile_ROOT}")
43 +- else()
44 +- # Use the virtual-env setup and download package from specified repot:
45 +- set( tensile_fork "ROCmSoftwarePlatform" CACHE STRING "Tensile fork to use" )
46 +- file (STRINGS "tensile_tag.txt" read_tensile_tag)
47 +- set( tensile_tag ${read_tensile_tag} CACHE STRING "Tensile tag to download" )
48 +- virtualenv_install("git+https://github.com/${tensile_fork}/Tensile.git@${tensile_tag}")
49 +- message (STATUS "using GIT Tensile fork=${tensile_fork} from branch=${tensile_tag}")
50 +- endif()
51 +- message(STATUS "Adding ${VIRTUALENV_HOME_DIR} to CMAKE_PREFIX_PATH")
52 +- list(APPEND CMAKE_PREFIX_PATH ${VIRTUALENV_HOME_DIR})
53 +- if (TENSILE_VERSION)
54 +- find_package(Tensile ${TENSILE_VERSION} EXACT REQUIRED HIP LLVM OpenMP PATHS "${INSTALLED_TENSILE_PATH}")
55 +- else()
56 +- find_package(Tensile 4.24.0 EXACT REQUIRED HIP LLVM OpenMP PATHS "${INSTALLED_TENSILE_PATH}")
57 +- endif()
58 ++ find_package(Tensile 4.24.0 EXACT REQUIRED HIP LLVM OpenMP)
59 + endif()
60 +
61 + # Find HCC/HIP dependencies
62
63 diff --git a/sci-libs/rocBLAS/metadata.xml b/sci-libs/rocBLAS/metadata.xml
64 new file mode 100644
65 index 000000000..336bdb639
66 --- /dev/null
67 +++ b/sci-libs/rocBLAS/metadata.xml
68 @@ -0,0 +1,11 @@
69 +<?xml version="1.0" encoding="UTF-8"?>
70 +<!DOCTYPE pkgmetadata SYSTEM 'http://www.gentoo.org/dtd/metadata.dtd'>
71 +<pkgmetadata>
72 + <maintainer type="project">
73 + <email>sci@g.o</email>
74 + </maintainer>
75 + <maintainer type="person">
76 + <email>gentoo@××××××.net</email>
77 + <name>Wilfried Holzke</name>
78 + </maintainer>
79 +</pkgmetadata>
80
81 diff --git a/sci-libs/rocBLAS/rocBLAS-4.0.0-r1.ebuild b/sci-libs/rocBLAS/rocBLAS-4.0.0-r1.ebuild
82 new file mode 100644
83 index 000000000..ca0fcfd8c
84 --- /dev/null
85 +++ b/sci-libs/rocBLAS/rocBLAS-4.0.0-r1.ebuild
86 @@ -0,0 +1,88 @@
87 +# Copyright 1999-2021 Gentoo Authors
88 +# Distributed under the terms of the GNU General Public License v2
89 +
90 +EAPI=7
91 +
92 +inherit cmake
93 +
94 +DESCRIPTION="AMD's library for BLAS on ROCm."
95 +HOMEPAGE="https://github.com/ROCmSoftwarePlatform/rocBLAS"
96 +SRC_URI="https://github.com/ROCmSoftwarePlatform/rocBLAS/archive/rocm-${PV}.tar.gz -> rocm-rocBLAS-${PV}.tar.gz"
97 +
98 +LICENSE="MIT"
99 +KEYWORDS="~amd64"
100 +SLOT="0"
101 +
102 +IUSE="debug"
103 +
104 +RDEPEND="=dev-util/hip-$(ver_cut 1-2)*"
105 +DEPEND="${RDEPEND}
106 + dev-util/cmake
107 + dev-util/rocm-cmake
108 + dev-libs/msgpack
109 + dev-perl/File-Which"
110 +
111 +# stripped library is not working
112 +RESTRICT="strip"
113 +
114 +S="${WORKDIR}/rocBLAS-rocm-${PV}"
115 +
116 +rocBLAS_V="0.1"
117 +
118 +PATCHES="${FILESDIR}/${PN}-4.0.0-use-system-tensile.patch"
119 +
120 +src_prepare() {
121 + eapply_user
122 +
123 + sed -e "/PREFIX rocblas/d" \
124 + -e "/<INSTALL_INTERFACE/s:include:include/rocblas:" \
125 + -e "s:rocblas/include:include/rocblas:" \
126 + -e "s:\\\\\${CPACK_PACKAGING_INSTALL_PREFIX}rocblas/lib:${EPREFIX}/usr/$(get_libdir)/rocblas:" \
127 + -e "/rocm_install_symlink_subdir( rocblas )/d" -i library/src/CMakeLists.txt || die
128 +
129 + cmake_src_prepare
130 +}
131 +
132 +src_configure() {
133 + # allow acces to hardware
134 + addwrite /dev/kfd
135 + addpredict /dev/dri/
136 +
137 + # Compiler to use
138 + export CXX="hipcc"
139 +
140 + if use debug; then
141 + buildtype="Debug"
142 + else
143 + buildtype="Release"
144 + fi
145 +
146 + local mycmakeargs=(
147 + -DTensile_LOGIC="asm_full"
148 + -DTensile_COMPILER="hipcc"
149 + -DTensile_ARCHITECTURE="all"
150 + -DTensile_LIBRARY_FORMAT="msgpack"
151 + -DTensile_CODE_OBJECT_VERSION="V3"
152 + -DTensile_TEST_LOCAL_PATH="${WORKDIR}/Tensile-rocm-${PV}"
153 + -DBUILD_WITH_TENSILE=ON
154 + -DBUILD_WITH_TENSILE_HOST=ON
155 + -DCMAKE_BUILD_TYPE="${buildtype}"
156 + -DCMAKE_CXX_FLAGS="--rocm-path=${EPREFIX}/usr"
157 + -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
158 + -DCMAKE_INSTALL_INCLUDEDIR="include/rocblas"
159 + -DBUILD_TESTING=OFF
160 + -DBUILD_CLIENTS_SAMPLES=OFF
161 + -DBUILD_CLIENTS_TESTS=OFF
162 + -DBUILD_CLIENTS_BENCHMARKS=OFF
163 + )
164 +
165 + cmake_src_configure
166 +
167 + # do not rerun cmake and the build process in src_install
168 + sed -e '/RERUN/,+1d' -i "${BUILD_DIR}"/build.ninja || die
169 +}
170 +
171 +src_install() {
172 + cmake_src_install
173 + chrpath --delete "${ED}/usr/lib64/librocblas.so.${rocBLAS_V}"
174 +}