1 |
commit: f4dba4a5f9cb91c066086f6145d34bf53578f3d8 |
2 |
Author: Yiyang Wu <xgreenlandforwyy <AT> gmail <DOT> com> |
3 |
AuthorDate: Sat Jan 28 12:32:37 2023 +0000 |
4 |
Commit: Benda XU <heroxbd <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Jan 31 14:26:51 2023 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f4dba4a5 |
7 |
|
8 |
sci-libs/rocBLAS: add 5.4.2 |
9 |
|
10 |
Closes: https://github.com/gentoo/gentoo/pull/29319 |
11 |
Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com> |
12 |
Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org> |
13 |
|
14 |
sci-libs/rocBLAS/Manifest | 2 + |
15 |
.../files/rocBLAS-5.4.2-add-missing-header.patch | 14 +++ |
16 |
.../files/rocBLAS-5.4.2-cpp_lib_filesystem.patch | 24 +++++ |
17 |
.../rocBLAS/files/rocBLAS-5.4.2-link-cblas.patch | 12 +++ |
18 |
.../files/rocBLAS-5.4.2-unbundle-Tensile.patch | 26 +++++ |
19 |
sci-libs/rocBLAS/rocBLAS-5.4.2.ebuild | 107 +++++++++++++++++++++ |
20 |
6 files changed, 185 insertions(+) |
21 |
|
22 |
diff --git a/sci-libs/rocBLAS/Manifest b/sci-libs/rocBLAS/Manifest |
23 |
index 8e328c26a78e..3ba6938bbd3c 100644 |
24 |
--- a/sci-libs/rocBLAS/Manifest |
25 |
+++ b/sci-libs/rocBLAS/Manifest |
26 |
@@ -1,3 +1,5 @@ |
27 |
DIST rocBLAS-5.0.2-Tensile-asm_full-navi22.tar.gz 1110323 BLAKE2B 80fab97c6f89fccf1f8829ad41baf15ad31bbbb313b48825841834c7ec1b9f8ece794aebdf9fda42b54a38f642beb1bc1e374f2f3b4e43d8ba9dfd1eb6e3ece5 SHA512 8f6946cf9d68afd195640ae7e0da8dc33341c67f28813813b5361a56531fa2af4453d075703ea52c66d93a1936cf74688b86aa2fa62b52a7ed5f03272290c232 |
28 |
+DIST rocBLAS-5.4.2-Tensile-asm_full-navi22.tar.gz 1057686 BLAKE2B aa755595bbcd48775713f1d94c18b9bfa6464cae97653dd5beda9e4ed600802b62c4159e6edef7fbd4c92e629bbda1c284e6c48e096c7eaf22bbaad86bdcdace SHA512 cdc928528e7ce5bcc3ae32ec18e3aee48533f24e77c1e42f6e0398858eefebd52b8812caabe01a0ef7fa552e00118b862e025f1675a9642b009f1e38efbcdd53 |
29 |
DIST rocm-rocBLAS-5.0.2.tar.gz 13295178 BLAKE2B e1abfa06b9ac1545732465857839dae3f3708af49439a306a2b5b1b1b392101c38c95815f2c05a0d9ed29d41b154bc2e16a4f9203a37f5e2f68ee12cc4b44a06 SHA512 2f4a74f49350ede0debcf32229a6b6b95505615723c3f2bee16e4c169a3bb966dfb1971819028f47c525f571bea5662b892e63f655b0d1d2b8f20746bc5fe770 |
30 |
DIST rocm-rocBLAS-5.1.3.tar.gz 13741546 BLAKE2B af10d8cb69bee44ef5aab2dc350e1d9f3b6fddb3a840c17230c4b55b2649a4724c9f2e58c1eafdb3e2716eea016a72a35c3ddb498881b1ce682d780baa8d8b07 SHA512 5ab71838fdd0e9c5848cbf28a19d113353b619a878d8c7d05f64feb32faae2054169c95ed6e9dd6b05a2e807b57229dd2c361c4d289b6e6f17c196558640890f |
31 |
+DIST rocm-rocBLAS-5.4.2.tar.gz 15938434 BLAKE2B 14ebafa944fdac443800bb7f9b16f8ecf0f420b168d3c6534f68ad7d14bf058a4cc1673fce8f4b9be53e4a6c1cf05011e01853cd901bce0b59827d2aca4d029f SHA512 e62bb80457c1e89454885499bdce9d60beecd706806724418983c78c65c2ae303550f9670b5a6e71dae6a61c0e42b223ab01b36b8406430731ebcbff54c4a8f4 |
32 |
|
33 |
diff --git a/sci-libs/rocBLAS/files/rocBLAS-5.4.2-add-missing-header.patch b/sci-libs/rocBLAS/files/rocBLAS-5.4.2-add-missing-header.patch |
34 |
new file mode 100644 |
35 |
index 000000000000..cefad2bad61a |
36 |
--- /dev/null |
37 |
+++ b/sci-libs/rocBLAS/files/rocBLAS-5.4.2-add-missing-header.patch |
38 |
@@ -0,0 +1,14 @@ |
39 |
+Mitigate compilation issue. |
40 |
+ |
41 |
+std::bad_alloc is defined in <new> |
42 |
+--- a/clients/include/host_alloc.hpp |
43 |
++++ b/clients/include/host_alloc.hpp |
44 |
+@@ -22,6 +22,8 @@ |
45 |
+ |
46 |
+ #pragma once |
47 |
+ |
48 |
++#include <new> |
49 |
++ |
50 |
+ //! |
51 |
+ //! @brief Host free memory w/o swap. Returns kB or -1 if unknown. |
52 |
+ //! |
53 |
|
54 |
diff --git a/sci-libs/rocBLAS/files/rocBLAS-5.4.2-cpp_lib_filesystem.patch b/sci-libs/rocBLAS/files/rocBLAS-5.4.2-cpp_lib_filesystem.patch |
55 |
new file mode 100644 |
56 |
index 000000000000..688fe7eb5bc3 |
57 |
--- /dev/null |
58 |
+++ b/sci-libs/rocBLAS/files/rocBLAS-5.4.2-cpp_lib_filesystem.patch |
59 |
@@ -0,0 +1,24 @@ |
60 |
+Index: rocBLAS-rocm-5.4.2/clients/common/utility.cpp |
61 |
+=================================================================== |
62 |
+--- rocBLAS-rocm-5.4.2.orig/clients/common/utility.cpp |
63 |
++++ rocBLAS-rocm-5.4.2/clients/common/utility.cpp |
64 |
+@@ -38,6 +38,7 @@ |
65 |
+ #ifdef WIN32 |
66 |
+ #define strcasecmp(A, B) _stricmp(A, B) |
67 |
+ |
68 |
++#include <version> |
69 |
+ #ifdef __cpp_lib_filesystem |
70 |
+ #include <filesystem> |
71 |
+ namespace fs = std::filesystem; |
72 |
+Index: rocBLAS-rocm-5.4.2/clients/include/singletons.hpp |
73 |
+=================================================================== |
74 |
+--- rocBLAS-rocm-5.4.2.orig/clients/include/singletons.hpp |
75 |
++++ rocBLAS-rocm-5.4.2/clients/include/singletons.hpp |
76 |
+@@ -21,6 +21,6 @@ |
77 |
+ * ************************************************************************ */ |
78 |
+ |
79 |
+ // global for device memory padding see d_vector.hpp |
80 |
+- |
81 |
++#include<cstddef> |
82 |
+ extern size_t g_DVEC_PAD; |
83 |
+ void d_vector_set_pad_length(size_t pad); |
84 |
|
85 |
diff --git a/sci-libs/rocBLAS/files/rocBLAS-5.4.2-link-cblas.patch b/sci-libs/rocBLAS/files/rocBLAS-5.4.2-link-cblas.patch |
86 |
new file mode 100644 |
87 |
index 000000000000..a0a599ad0de8 |
88 |
--- /dev/null |
89 |
+++ b/sci-libs/rocBLAS/files/rocBLAS-5.4.2-link-cblas.patch |
90 |
@@ -0,0 +1,12 @@ |
91 |
+Fix CPU blas function not found linking issue |
92 |
+--- a/clients/CMakeLists.txt |
93 |
++++ b/clients/CMakeLists.txt |
94 |
+@@ -119,7 +119,7 @@ if( BUILD_CLIENTS_BENCHMARKS OR BUILD_CLIENTS_TESTS) |
95 |
+ set( BLIS_CPP ../common/blis_interface.cpp ) |
96 |
+ set( BLAS_LIBRARY ${BUILD_DIR}/deps/blis/lib/libblis.a ) |
97 |
+ else() |
98 |
+- set( BLAS_LIBRARY "blas" ) |
99 |
++ set( BLAS_LIBRARY "blas -lcblas" ) |
100 |
+ endif() |
101 |
+ else() # WIN32 |
102 |
+ set( BLAS_INCLUDE_DIR ${OPENBLAS_DIR}/include CACHE PATH "OpenBLAS library include path" ) |
103 |
|
104 |
diff --git a/sci-libs/rocBLAS/files/rocBLAS-5.4.2-unbundle-Tensile.patch b/sci-libs/rocBLAS/files/rocBLAS-5.4.2-unbundle-Tensile.patch |
105 |
new file mode 100644 |
106 |
index 000000000000..114c10502e68 |
107 |
--- /dev/null |
108 |
+++ b/sci-libs/rocBLAS/files/rocBLAS-5.4.2-unbundle-Tensile.patch |
109 |
@@ -0,0 +1,26 @@ |
110 |
+Index: rocBLAS-rocm-5.4.2/CMakeLists.txt |
111 |
+=================================================================== |
112 |
+--- rocBLAS-rocm-5.4.2.orig/CMakeLists.txt |
113 |
++++ rocBLAS-rocm-5.4.2/CMakeLists.txt |
114 |
+@@ -138,21 +138,6 @@ if(NOT SKIP_LIBRARY) |
115 |
+ |
116 |
+ set( Tensile_TEST_LOCAL_PATH "" CACHE PATH "Use local Tensile directory instead of fetching a GitHub branch" ) |
117 |
+ |
118 |
+- include(virtualenv) |
119 |
+- |
120 |
+- if (Tensile_TEST_LOCAL_PATH) |
121 |
+- virtualenv_install(${Tensile_TEST_LOCAL_PATH}) |
122 |
+- message (STATUS "using local Tensile from ${Tensile_TEST_LOCAL_PATH}, copied to ${Tensile_ROOT}") |
123 |
+- else() |
124 |
+- # Use the virtual-env setup and download package from specified repot: |
125 |
+- set( tensile_fork "ROCmSoftwarePlatform" CACHE STRING "Tensile fork to use" ) |
126 |
+- file (STRINGS "tensile_tag.txt" read_tensile_tag) |
127 |
+- set( tensile_tag ${read_tensile_tag} CACHE STRING "Tensile tag to download" ) |
128 |
+- virtualenv_install("git+https://github.com/${tensile_fork}/Tensile.git@${tensile_tag}") |
129 |
+- message (STATUS "using GIT Tensile fork=${tensile_fork} from branch=${tensile_tag}") |
130 |
+- endif() |
131 |
+- message(STATUS "Adding ${VIRTUALENV_HOME_DIR} to CMAKE_PREFIX_PATH") |
132 |
+- list(APPEND CMAKE_PREFIX_PATH ${VIRTUALENV_HOME_DIR}) |
133 |
+ if (TENSILE_VERSION) |
134 |
+ find_package(Tensile ${TENSILE_VERSION} EXACT REQUIRED HIP LLVM OpenMP PATHS "${INSTALLED_TENSILE_PATH}") |
135 |
+ else() |
136 |
|
137 |
diff --git a/sci-libs/rocBLAS/rocBLAS-5.4.2.ebuild b/sci-libs/rocBLAS/rocBLAS-5.4.2.ebuild |
138 |
new file mode 100644 |
139 |
index 000000000000..28fad2ffbe68 |
140 |
--- /dev/null |
141 |
+++ b/sci-libs/rocBLAS/rocBLAS-5.4.2.ebuild |
142 |
@@ -0,0 +1,107 @@ |
143 |
+# Copyright 1999-2023 Gentoo Authors |
144 |
+# Distributed under the terms of the GNU General Public License v2 |
145 |
+ |
146 |
+EAPI=8 |
147 |
+ |
148 |
+DOCS_BUILDER="doxygen" |
149 |
+DOCS_DIR="docs" |
150 |
+DOCS_DEPEND="media-gfx/graphviz" |
151 |
+ROCM_VERSION=${PV} |
152 |
+inherit cmake docs edo multiprocessing rocm |
153 |
+ |
154 |
+DESCRIPTION="AMD's library for BLAS on ROCm" |
155 |
+HOMEPAGE="https://github.com/ROCmSoftwarePlatform/rocBLAS" |
156 |
+SRC_URI="https://github.com/ROCmSoftwarePlatform/rocBLAS/archive/rocm-${PV}.tar.gz -> rocm-${P}.tar.gz |
157 |
+ https://media.githubusercontent.com/media/littlewu2508/littlewu2508.github.io/main/gentoo-distfiles/${PN}-5.4.2-Tensile-asm_full-navi22.tar.gz" |
158 |
+S="${WORKDIR}/${PN}-rocm-${PV}" |
159 |
+ |
160 |
+LICENSE="BSD" |
161 |
+KEYWORDS="~amd64" |
162 |
+SLOT="0/$(ver_cut 1-2)" |
163 |
+IUSE="benchmark test" |
164 |
+REQUIRED_USE="${ROCM_REQUIRED_USE}" |
165 |
+RESTRICT="!test? ( test )" |
166 |
+ |
167 |
+BDEPEND=" |
168 |
+ >=dev-util/rocm-cmake-5.3 |
169 |
+ dev-util/Tensile:${SLOT} |
170 |
+" |
171 |
+ |
172 |
+DEPEND=" |
173 |
+ dev-util/hip |
174 |
+ dev-libs/msgpack |
175 |
+ test? ( |
176 |
+ virtual/blas |
177 |
+ dev-cpp/gtest |
178 |
+ sys-libs/libomp |
179 |
+ ) |
180 |
+ benchmark? ( |
181 |
+ virtual/blas |
182 |
+ sys-libs/libomp |
183 |
+ ) |
184 |
+" |
185 |
+ |
186 |
+QA_FLAGS_IGNORED="/usr/lib64/rocblas/library/.*" |
187 |
+ |
188 |
+PATCHES=( |
189 |
+ "${FILESDIR}"/${PN}-5.4.2-cpp_lib_filesystem.patch |
190 |
+ "${FILESDIR}"/${PN}-5.4.2-unbundle-Tensile.patch |
191 |
+ "${FILESDIR}"/${PN}-5.4.2-add-missing-header.patch |
192 |
+ "${FILESDIR}"/${PN}-5.4.2-link-cblas.patch |
193 |
+ ) |
194 |
+ |
195 |
+src_prepare() { |
196 |
+ cmake_src_prepare |
197 |
+ cp -a "${WORKDIR}/asm_full/" library/src/blas3/Tensile/Logic/ || die |
198 |
+ sed -e "s:,-rpath=.*\":\":" -i clients/CMakeLists.txt || die |
199 |
+} |
200 |
+ |
201 |
+src_configure() { |
202 |
+ addpredict /dev/random |
203 |
+ addpredict /dev/kfd |
204 |
+ addpredict /dev/dri/ |
205 |
+ |
206 |
+ local mycmakeargs=( |
207 |
+ -DCMAKE_SKIP_RPATH=On |
208 |
+ -DBUILD_FILE_REORG_BACKWARD_COMPATIBILITY=OFF |
209 |
+ -DROCM_SYMLINK_LIBS=OFF |
210 |
+ -DAMDGPU_TARGETS="$(get_amdgpu_flags)" |
211 |
+ -DTensile_LOGIC="asm_full" |
212 |
+ -DTensile_COMPILER="hipcc" |
213 |
+ -DTensile_LIBRARY_FORMAT="msgpack" |
214 |
+ -DTensile_CODE_OBJECT_VERSION="V3" |
215 |
+ -DTensile_TEST_LOCAL_PATH="${EPREFIX}/usr/share/Tensile" |
216 |
+ -DTensile_ROOT="${EPREFIX}/usr/share/Tensile" |
217 |
+ -DBUILD_WITH_TENSILE=ON |
218 |
+ -DCMAKE_INSTALL_INCLUDEDIR="include/rocblas" |
219 |
+ -DBUILD_CLIENTS_SAMPLES=OFF |
220 |
+ -DBUILD_CLIENTS_TESTS=$(usex test ON OFF) |
221 |
+ -DBUILD_CLIENTS_BENCHMARKS=$(usex benchmark ON OFF) |
222 |
+ -DTensile_CPU_THREADS=$(makeopts_jobs) |
223 |
+ ) |
224 |
+ |
225 |
+ CXX=hipcc cmake_src_configure |
226 |
+} |
227 |
+ |
228 |
+src_compile() { |
229 |
+ docs_compile |
230 |
+ cmake_src_compile |
231 |
+} |
232 |
+ |
233 |
+src_test() { |
234 |
+ check_amdgpu |
235 |
+ cd "${BUILD_DIR}"/clients/staging || die |
236 |
+ export ROCBLAS_TEST_TIMEOUT=3600 ROCBLAS_TENSILE_LIBPATH="${BUILD_DIR}/Tensile/library" |
237 |
+ export LD_LIBRARY_PATH="${BUILD_DIR}/clients:${BUILD_DIR}/library/src" |
238 |
+ edob ./${PN,,}-test |
239 |
+} |
240 |
+ |
241 |
+src_install() { |
242 |
+ cmake_src_install |
243 |
+ |
244 |
+ if use benchmark; then |
245 |
+ cd "${BUILD_DIR}" || die |
246 |
+ dolib.a clients/librocblas_fortran_client.a |
247 |
+ dobin clients/staging/rocblas-bench |
248 |
+ fi |
249 |
+} |