Gentoo Archives: gentoo-commits

From: Benda XU <heroxbd@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/rocFFT/files/, sci-libs/rocFFT/
Date: Sun, 27 Mar 2022 03:13:03
Message-Id: 1648350771.83c4bf0776b5e64867f547284ca794254dab36f7.heroxbd@gentoo
1 commit: 83c4bf0776b5e64867f547284ca794254dab36f7
2 Author: YiyangWu <xgreenlandforwyy <AT> gmail <DOT> com>
3 AuthorDate: Wed Mar 23 14:22:16 2022 +0000
4 Commit: Benda XU <heroxbd <AT> gentoo <DOT> org>
5 CommitDate: Sun Mar 27 03:12:51 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=83c4bf07
7
8 sci-libs/rocFFT: bump version to 5.0.2
9
10 Enable benchmark and perfscript USE flags.
11
12 Closes: https://github.com/gentoo/gentoo/pull/24726
13 Package-Manager: Portage-3.0.30, Repoman-3.0.3
14 Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
15 Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>
16
17 sci-libs/rocFFT/Manifest | 1 +
18 .../files/rocFFT-5.0.2-add-math-header.patch | 12 ++
19 .../files/rocFFT-5.0.2-unbundle-sqlite.patch | 54 ++++++++
20 sci-libs/rocFFT/metadata.xml | 4 +
21 sci-libs/rocFFT/rocFFT-5.0.2.ebuild | 148 +++++++++++++++++++++
22 5 files changed, 219 insertions(+)
23
24 diff --git a/sci-libs/rocFFT/Manifest b/sci-libs/rocFFT/Manifest
25 index 8757f213cfe1..a6b401c669d5 100644
26 --- a/sci-libs/rocFFT/Manifest
27 +++ b/sci-libs/rocFFT/Manifest
28 @@ -1,2 +1,3 @@
29 DIST rocFFT-4.0.0.tar.gz 772176 BLAKE2B f08db9487449e707ba814a66d23992f68c140017a38f72ee45b3b224fc3e46abd40b976aef645f4432601265b38cff8939456981c686360eba135349b5d28fb5 SHA512 db9a6b49162dfb7924aa5f5dc8d42c92a5a741e03c3c0b4ece2cfb72de7506a345f3d28d31a3d7755cfe78078c448c9f952ca671e472335a4301de8702916176
30 DIST rocFFT-4.3.0.tar.gz 840748 BLAKE2B 236a5faa930751d35e501a9a32ecc8b4075448ef21a0ffb0bb7ec04f4ed1cb67b908aa153b5b424e0823d3e306cf375d7c01a77d687220ed79de6d374037e003 SHA512 765d41e4018a04a53e847c03de80eec830d3e8766187fb8cb493624afa2673175347c16e6eeeebd4ad7d88bb866e58f7e572708f22238723c710b98565a0cd3d
31 +DIST rocFFT-5.0.2.tar.gz 837508 BLAKE2B b74d0c6edd7b232f775bffefbca829d88d9d7cd9108c27a0698f45d7fe2760d40463bcda8c710e923874b3bbfb1e83e0fe8622db4dfa28afb29392b3e135e9a5 SHA512 d6810a92a10a27dbcac8a04e8fcd56c7fa198f208da626d8938d5ff28b6ab8b89a058c7a56b5666464165e8f6bd7c4c031a94315625a3613eb02a9b8eccd9eb9
32
33 diff --git a/sci-libs/rocFFT/files/rocFFT-5.0.2-add-math-header.patch b/sci-libs/rocFFT/files/rocFFT-5.0.2-add-math-header.patch
34 new file mode 100644
35 index 000000000000..1a35126f1d8c
36 --- /dev/null
37 +++ b/sci-libs/rocFFT/files/rocFFT-5.0.2-add-math-header.patch
38 @@ -0,0 +1,12 @@
39 +fix compilation issue: error: use of undeclared identifier 'ceil' 'floor'
40 +===================================================================
41 +--- rocFFT-rocm-5.0.2.orig/library/src/device/generator/stockham_gen_base.h
42 ++++ rocFFT-rocm-5.0.2/library/src/device/generator/stockham_gen_base.h
43 +@@ -20,6 +20,7 @@
44 +
45 + #pragma once
46 + #include "stockham_gen.h"
47 ++#include <math.h>
48 +
49 + // Base class for stockham kernels. Subclasses are responsible for
50 + // different tiling types.
51
52 diff --git a/sci-libs/rocFFT/files/rocFFT-5.0.2-unbundle-sqlite.patch b/sci-libs/rocFFT/files/rocFFT-5.0.2-unbundle-sqlite.patch
53 new file mode 100644
54 index 000000000000..4da2b2092906
55 --- /dev/null
56 +++ b/sci-libs/rocFFT/files/rocFFT-5.0.2-unbundle-sqlite.patch
57 @@ -0,0 +1,54 @@
58 +Disable rocFFT fetching SQLite3 and link to system libsqlite.so
59 +--- rocFFT-rocm-5.0.2/library/src/CMakeLists.txt
60 ++++ rocFFT-rocm-5.0.2/library/src/CMakeLists.txt
61 +@@ -134,31 +134,7 @@ set( rocfft_source
62 + rtcsubprocess.cpp
63 + )
64 +
65 +-# SQLite 3.36.0 enabled the backup API by default, which we need
66 +-# for cache serialization. We also want to use a static SQLite,
67 +-# and distro static libraries aren't typically built
68 +-# position-independent.
69 +-include( FetchContent )
70 +-
71 +-# embed SQLite
72 +-FetchContent_Declare(sqlite_local
73 +- URL https://sqlite.org/2021/sqlite-amalgamation-3360000.zip
74 +- URL_HASH SHA256=999826fe4c871f18919fdb8ed7ec9dd8217180854dd1fe21eea96aed36186729
75 +-)
76 +-FetchContent_MakeAvailable(sqlite_local)
77 +-add_library( sqlite3 STATIC ${sqlite_local_SOURCE_DIR}/sqlite3.c )
78 +-set_target_properties( sqlite3 PROPERTIES
79 +- C_VISIBILITY_PRESET "hidden"
80 +- VISIBILITY_INLINES_HIDDEN ON
81 +- POSITION_INDEPENDENT_CODE ON
82 +- )
83 +-
84 +-# we don't need extensions, and omitting them from SQLite removes the
85 +-# need for dlopen/dlclose from within rocFFT
86 +-target_compile_options(
87 +- sqlite3
88 +- PRIVATE -DSQLITE_OMIT_LOAD_EXTENSION
89 +-)
90 ++find_package( SQLite3 REQUIRED )
91 +
92 + set_property(
93 + SOURCE rtc.cpp
94 +@@ -170,7 +146,7 @@ prepend_path( ".." rocfft_headers_public
95 + add_library( rocfft ${rocfft_source} ${relative_rocfft_headers_public} )
96 + add_library( roc::rocfft ALIAS rocfft )
97 +
98 +-target_link_libraries( rocfft PRIVATE stockham_gen sqlite3 )
99 ++target_link_libraries( rocfft PRIVATE stockham_gen ${SQLite3_LIBRARIES} )
100 + if( NOT WIN32 )
101 + target_link_libraries( rocfft PRIVATE -lstdc++fs )
102 + endif()
103 +@@ -203,7 +179,7 @@ endif()
104 + target_include_directories( rocfft
105 + PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/library/src/include>
106 + $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/library/src/device>
107 +- ${sqlite_local_SOURCE_DIR}
108 ++ ${SQLite3_LIBRARIES}
109 + PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/library/include>
110 + $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
111 + $<INSTALL_INTERFACE:include/rocFFT>
112
113 diff --git a/sci-libs/rocFFT/metadata.xml b/sci-libs/rocFFT/metadata.xml
114 index 3274277df8c4..825327b204eb 100644
115 --- a/sci-libs/rocFFT/metadata.xml
116 +++ b/sci-libs/rocFFT/metadata.xml
117 @@ -16,4 +16,8 @@
118 <upstream>
119 <remote-id type="github">ROCmSoftwarePlatform/rocFFT</remote-id>
120 </upstream>
121 + <use>
122 + <flag name="benchmark">Build and install [dyna-]rocfft-rider.</flag>
123 + <flag name="perfscripts">Install rocfft-perf performance visualization suite.</flag>
124 + </use>
125 </pkgmetadata>
126
127 diff --git a/sci-libs/rocFFT/rocFFT-5.0.2.ebuild b/sci-libs/rocFFT/rocFFT-5.0.2.ebuild
128 new file mode 100644
129 index 000000000000..8d0cb72d3ed8
130 --- /dev/null
131 +++ b/sci-libs/rocFFT/rocFFT-5.0.2.ebuild
132 @@ -0,0 +1,148 @@
133 +# Copyright 1999-2022 Gentoo Authors
134 +# Distributed under the terms of the GNU General Public License v2
135 +
136 +EAPI=8
137 +
138 +PYTHON_COMPAT=( python3_{8..10} )
139 +
140 +inherit cmake check-reqs multiprocessing python-r1
141 +
142 +DESCRIPTION="Next generation FFT implementation for ROCm"
143 +HOMEPAGE="https://github.com/ROCmSoftwarePlatform/rocFFT"
144 +SRC_URI="https://github.com/ROCmSoftwarePlatform/rocFFT/archive/rocm-${PV}.tar.gz -> rocFFT-${PV}.tar.gz"
145 +
146 +LICENSE="MIT"
147 +KEYWORDS="~amd64"
148 +SLOT="0/$(ver_cut 1-2)"
149 +
150 +# RDEPEND: perfscripts? dev-python/plotly[${PYTHON_USEDEP}] # currently masked by arch/amd64/x32/package.mask
151 +RDEPEND="
152 +perfscripts? (
153 + >=media-gfx/asymptote-2.61
154 + dev-texlive/texlive-latex
155 + dev-tex/latexmk
156 + sys-apps/texinfo
157 + dev-python/sympy[${PYTHON_USEDEP}]
158 + dev-python/numpy[${PYTHON_USEDEP}]
159 + dev-python/scipy[${PYTHON_USEDEP}]
160 + dev-python/pandas[${PYTHON_USEDEP}] )
161 +${PYTHON_DEPS}"
162 +
163 +DEPEND="dev-util/hip:${SLOT}
164 + ${PYTHON_DEPS}"
165 +
166 +BDEPEND="
167 + test? ( dev-cpp/gtest dev-libs/boost
168 + >=sci-libs/fftw-3
169 + >=dev-util/cmake-3.22
170 + dev-util/rocm-cmake:${SLOT}
171 +)"
172 +
173 +CHECKREQS_DISK_BUILD="7G"
174 +
175 +IUSE="benchmark perfscripts test"
176 +REQUIRED_USE="perfscripts? ( benchmark ) ${PYTHON_REQUIRED_USE}"
177 +
178 +RESTRICT="!test? ( test )"
179 +
180 +S="${WORKDIR}/rocFFT-rocm-${PV}"
181 +
182 +PATCHES=(
183 + "${FILESDIR}/${PN}-4.2.0-add-functional-header.patch"
184 + "${FILESDIR}/${PN}-5.0.2-unbundle-sqlite.patch"
185 + "${FILESDIR}/${PN}-5.0.2-add-math-header.patch" )
186 +
187 +required_mem() {
188 + if use test; then
189 + echo "52G"
190 + else
191 + if [[ -n "${AMDGPU_TARGETS}" ]]; then
192 + local NARCH=$(($(awk -F";" '{print NF-1}' <<< "${AMDGPU_TARGETS}" || die)+1)) # count how many archs user specified in ${AMDGPU_TARGETS}
193 + else
194 + local NARCH=7 # The default number of AMDGPU_TARGETS for rocFFT-4.3.0. May change in the future.
195 + fi
196 + echo "$(($(makeopts_jobs)*${NARCH}*25+2200))M" # A linear function estimating how much memory required
197 + fi
198 +}
199 +
200 +pkg_pretend() {
201 + return # leave the disk space check to pkg_setup phase
202 +}
203 +
204 +pkg_setup() {
205 + export CHECKREQS_MEMORY=$(required_mem)
206 + check-reqs_pkg_setup
207 + python_setup
208 +}
209 +
210 +src_prepare() {
211 + sed -e "s/PREFIX rocfft//" \
212 + -e "/rocm_install_symlink_subdir/d" \
213 + -e "/<INSTALL_INTERFACE/s,include,include/rocFFT," \
214 + -i library/src/CMakeLists.txt || die
215 +
216 + sed -e "/rocm_install_symlink_subdir/d" \
217 + -e "$!N;s:PREFIX\n[ ]*rocfft:# PREFIX rocfft\n:;P;D" \
218 + -i library/src/device/CMakeLists.txt || die
219 +
220 + if use perfscripts; then
221 + pushd scripts/perf || die
222 + sed -e "/\/opt\/rocm/d" -e "/rocmversion/s,rocm_info.strip(),\"${PV}\"," -i perflib/specs.py || dir
223 + sed -e "/^top/,+1d" -i rocfft-perf suites.py || die
224 + sed -e "s,perflib,${PN}_perflib,g" -i rocfft-perf suites.py perflib/*.py || die
225 + sed -e "/^top = /s,__file__).*$,\"${EPREFIX}/usr/share/${PN}-perflib\")," -i perflib/pdf.py perflib/generators.py || die
226 + popd
227 + fi
228 +
229 + cmake_src_prepare
230 +}
231 +
232 +src_configure() {
233 + # Grant access to the device
234 + addwrite /dev/kfd
235 + addpredict /dev/dri/
236 +
237 + # Compiler to use
238 + export CXX=hipcc
239 +
240 + local mycmakeargs=(
241 + -Wno-dev
242 + -DCMAKE_INSTALL_INCLUDEDIR="include/rocFFT/"
243 + -DCMAKE_SKIP_RPATH=ON
244 + -DBUILD_CLIENTS_TESTS=$(usex test ON OFF)
245 + -DBUILD_CLIENTS_SELFTEST=$(usex test ON OFF)
246 + -DBUILD_CLIENTS_RIDER=$(usex benchmark ON OFF)
247 + ${AMDGPU_TARGETS+-DAMDGPU_TARGETS="${AMDGPU_TARGETS}"}
248 + )
249 +
250 + cmake_src_configure
251 +}
252 +
253 +src_test() {
254 + addwrite /dev/kfd
255 + addpredict /dev/dri
256 + cd "${BUILD_DIR}/clients/staging" || die
257 + einfo "Running rocfft-test"
258 + LD_LIBRARY_PATH=${BUILD_DIR}/library/src/:${BUILD_DIR}/library/src/device ./rocfft-test || die
259 +
260 + einfo "Running rocfft-selftest"
261 + LD_LIBRARY_PATH=${BUILD_DIR}/library/src/:${BUILD_DIR}/library/src/device ./rocfft-selftest || die
262 +}
263 +
264 +src_install() {
265 + cmake_src_install
266 +
267 + if use benchmark; then
268 + cd "${BUILD_DIR}"/clients/staging || die
269 + dobin *rider
270 + fi
271 +
272 + if use perfscripts; then
273 + cd "${S}"/scripts/perf || die
274 + python_foreach_impl python_doexe rocfft-perf
275 + python_moduleinto ${PN}_perflib
276 + python_foreach_impl python_domodule perflib/*.py
277 + insinto /usr/share/${PN}-perflib
278 + doins *.asy suites.py
279 + fi
280 +}