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/hipFFT/, sci-libs/hipFFT/files/
Date: Tue, 30 Nov 2021 06:34:58
Message-Id: 1638253974.02dc3ee11c5815bec6c60fe88285d8d446f7263f.heroxbd@gentoo
1 commit: 02dc3ee11c5815bec6c60fe88285d8d446f7263f
2 Author: YiyangWu <xgreenlandforwyy <AT> gmail <DOT> com>
3 AuthorDate: Thu Aug 26 07:33:50 2021 +0000
4 Commit: Benda XU <heroxbd <AT> gentoo <DOT> org>
5 CommitDate: Tue Nov 30 06:32:54 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=02dc3ee1
7
8 sci-libs/hipFFT: ROCm FFT marshalling library
9
10 hipFFT is the front end of rocFFT, and is dependency of ROCm
11 supported math/DL frameworks like pytorch.
12
13 Bug: https://bugs.gentoo.org/705712
14 Closes: https://github.com/gentoo/gentoo/pull/22804
15 Package-Manager: Portage-3.0.20, Repoman-3.0.3
16 Signed-off-by: Yiyang Wu <xgreenlandforwyy <AT> gmail.com>
17 Signed-off-by: Benda Xu <heroxbd <AT> gentoo.org>
18
19 sci-libs/hipFFT/Manifest | 2 +
20 .../files/hipFFT-4.3.0-add-complex-header.patch | 11 ++++
21 .../hipFFT-4.3.0-gentoo-install-locations.patch | 42 ++++++++++++
22 .../files/hipFFT-4.3.0-remove-git-dependency.patch | 33 ++++++++++
23 sci-libs/hipFFT/hipFFT-4.3.0.ebuild | 75 ++++++++++++++++++++++
24 sci-libs/hipFFT/metadata.xml | 22 +++++++
25 6 files changed, 185 insertions(+)
26
27 diff --git a/sci-libs/hipFFT/Manifest b/sci-libs/hipFFT/Manifest
28 new file mode 100644
29 index 000000000000..c756438b9383
30 --- /dev/null
31 +++ b/sci-libs/hipFFT/Manifest
32 @@ -0,0 +1,2 @@
33 +DIST hipFFT-rocm-4.3.0.tar.gz 83355 BLAKE2B ee99b4cb685cbb846084d8a7c77982d75cf0d1597f9270260284bb26ae00702a31dd4d5ad9ae1885ab631c390f65c0f584f302be189701ba4f0dd9061b1bba5a SHA512 0d3100b054ff485eae06b13b8c568626b8e3a3286f36012c5a5f9bb4918e03c30c687a2714049bd797f6c3973f1730ad0936f02ad044cde1663c9c5750bbcf40
34 +DIST rocFFT-4.3.0.tar.gz 840748 BLAKE2B 236a5faa930751d35e501a9a32ecc8b4075448ef21a0ffb0bb7ec04f4ed1cb67b908aa153b5b424e0823d3e306cf375d7c01a77d687220ed79de6d374037e003 SHA512 765d41e4018a04a53e847c03de80eec830d3e8766187fb8cb493624afa2673175347c16e6eeeebd4ad7d88bb866e58f7e572708f22238723c710b98565a0cd3d
35
36 diff --git a/sci-libs/hipFFT/files/hipFFT-4.3.0-add-complex-header.patch b/sci-libs/hipFFT/files/hipFFT-4.3.0-add-complex-header.patch
37 new file mode 100644
38 index 000000000000..200481788b95
39 --- /dev/null
40 +++ b/sci-libs/hipFFT/files/hipFFT-4.3.0-add-complex-header.patch
41 @@ -0,0 +1,11 @@
42 +diff --color -uprN orig/clients/rider/rider.cpp hipFFT-rocm-4.3.0/clients/rider/rider.cpp
43 +--- orig/clients/rider/rider.cpp 2021-08-26 15:05:32.267279103 +0800
44 ++++ hipFFT-rocm-4.3.0/clients/rider/rider.cpp 2021-08-26 15:05:48.795279212 +0800
45 +@@ -22,6 +22,7 @@
46 + #include <cstddef>
47 + #include <iostream>
48 + #include <numeric>
49 ++#include <complex>
50 + #include <random>
51 + #include <sstream>
52 +
53
54 diff --git a/sci-libs/hipFFT/files/hipFFT-4.3.0-gentoo-install-locations.patch b/sci-libs/hipFFT/files/hipFFT-4.3.0-gentoo-install-locations.patch
55 new file mode 100644
56 index 000000000000..891774eb5a47
57 --- /dev/null
58 +++ b/sci-libs/hipFFT/files/hipFFT-4.3.0-gentoo-install-locations.patch
59 @@ -0,0 +1,42 @@
60 +diff --color -uprN orig/CMakeLists.txt hipFFT-rocm-4.3.0/CMakeLists.txt
61 +--- orig/CMakeLists.txt 2021-08-26 14:38:31.051268348 +0800
62 ++++ hipFFT-rocm-4.3.0/CMakeLists.txt 2021-08-26 14:38:42.655268425 +0800
63 +@@ -143,7 +143,7 @@ endif( )
64 + add_subdirectory( library )
65 +
66 + # force library install path to lib (CentOS 7 defaults to lib64)
67 +-set(CMAKE_INSTALL_LIBDIR "lib" CACHE INTERNAL "Installation directory for libraries" FORCE)
68 ++set(CMAKE_INSTALL_LIBDIR "lib64" CACHE INTERNAL "Installation directory for libraries" FORCE)
69 +
70 + # Build clients of the library
71 + if( BUILD_CLIENTS )
72 +diff --color -uprN orig/library/CMakeLists.txt hipFFT-rocm-4.3.0/library/CMakeLists.txt
73 +--- orig/library/CMakeLists.txt 2021-08-26 14:38:31.051268348 +0800
74 ++++ hipFFT-rocm-4.3.0/library/CMakeLists.txt 2021-08-26 14:39:21.919268686 +0800
75 +@@ -77,7 +77,7 @@ target_include_directories(hipfft
76 + PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/library/include>
77 + $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
78 + $<BUILD_INTERFACE:${HIP_INCLUDE_DIRS}>
79 +- $<INSTALL_INTERFACE:include>
80 ++ $<INSTALL_INTERFACE:include/hipfft>
81 + )
82 +
83 + if(BUILD_WITH_LIB STREQUAL "CUDA")
84 +@@ -112,13 +112,13 @@ if( ROCM_FOUND )
85 + rocm_install_targets( TARGETS hipfft
86 + INCLUDE
87 + ${CMAKE_SOURCE_DIR}/library/include
88 +- ${CMAKE_BINARY_DIR}/include
89 +- PREFIX hipfft )
90 ++ ${CMAKE_BINARY_DIR}/include )
91 ++ #PREFIX hipfft )
92 + rocm_export_targets( TARGETS hip::hipfft
93 +- PREFIX hipfft
94 ++ #PREFIX hipfft
95 + DEPENDS PACKAGE hip
96 + NAMESPACE hip:: )
97 +- rocm_install_symlink_subdir( hipfft )
98 ++ #rocm_install_symlink_subdir( hipfft )
99 +
100 +
101 + # During transition to standalone hipFFT repository, don't install
102
103 diff --git a/sci-libs/hipFFT/files/hipFFT-4.3.0-remove-git-dependency.patch b/sci-libs/hipFFT/files/hipFFT-4.3.0-remove-git-dependency.patch
104 new file mode 100644
105 index 000000000000..563da3085ab9
106 --- /dev/null
107 +++ b/sci-libs/hipFFT/files/hipFFT-4.3.0-remove-git-dependency.patch
108 @@ -0,0 +1,33 @@
109 +diff --color -uprN orig/cmake/dependencies.cmake hipFFT-rocm-4.3.0/cmake/dependencies.cmake
110 +--- orig/cmake/dependencies.cmake 2021-08-26 14:48:57.867272506 +0800
111 ++++ hipFFT-rocm-4.3.0/cmake/dependencies.cmake 2021-08-26 14:51:02.571273334 +0800
112 +@@ -21,9 +21,6 @@
113 + #
114 + # #############################################################################
115 +
116 +-# Git
117 +-find_package(Git REQUIRED)
118 +-
119 + # HIP
120 + if(NOT BUILD_WITH_LIB STREQUAL "CUDA")
121 + find_package(hip REQUIRED)
122 +diff --color -uprN orig/CMakeLists.txt hipFFT-rocm-4.3.0/CMakeLists.txt
123 +--- orig/CMakeLists.txt 2021-08-26 14:48:57.867272506 +0800
124 ++++ hipFFT-rocm-4.3.0/CMakeLists.txt 2021-08-26 14:49:15.247272622 +0800
125 +@@ -117,16 +117,6 @@ message(STATUS "BUILD_WITH_COMPILER = "
126 + include(cmake/dependencies.cmake)
127 +
128 + if( BUILD_CLIENTS_TESTS )
129 +- if( GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git" )
130 +- message(STATUS "rocFFT submodule update")
131 +- execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive
132 +- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
133 +- RESULT_VARIABLE GIT_SUBMOD_RESULT)
134 +- if( NOT GIT_SUBMOD_RESULT EQUAL "0" )
135 +- message(FATAL_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}, please checkout submodules manually.")
136 +- endif( )
137 +- endif( )
138 +-
139 + if( NOT EXISTS "${PROJECT_SOURCE_DIR}/rocFFT/CMakeLists.txt" )
140 + message(FATAL_ERROR "The rocFFT submodule is not present! Please update git submodules and try again.")
141 + endif( )
142
143 diff --git a/sci-libs/hipFFT/hipFFT-4.3.0.ebuild b/sci-libs/hipFFT/hipFFT-4.3.0.ebuild
144 new file mode 100644
145 index 000000000000..5f7d3a95f58a
146 --- /dev/null
147 +++ b/sci-libs/hipFFT/hipFFT-4.3.0.ebuild
148 @@ -0,0 +1,75 @@
149 +# Copyright 1999-2021 Gentoo Authors
150 +# Distributed under the terms of the GNU General Public License v2
151 +
152 +EAPI=7
153 +
154 +inherit cmake flag-o-matic
155 +
156 +DESCRIPTION="CU / ROCM agnostic hip FFT implementation"
157 +HOMEPAGE="https://github.com/ROCmSoftwarePlatform/hipFFT"
158 +SRC_URI="https://github.com/ROCmSoftwarePlatform/hipFFT/archive/refs/tags/rocm-${PV}.tar.gz -> hipFFT-rocm-${PV}.tar.gz
159 + test? ( https://github.com/ROCmSoftwarePlatform/rocFFT/archive/rocm-${PV}.tar.gz -> rocFFT-${PV}.tar.gz )"
160 +
161 +LICENSE="MIT"
162 +KEYWORDS="~amd64"
163 +IUSE="benchmark test"
164 +SLOT="0/$(ver_cut 1-2)"
165 +
166 +RESTRICT="!test? ( test )"
167 +
168 +RDEPEND="dev-util/hip:${SLOT}
169 + sci-libs/rocFFT:${SLOT}"
170 +DEPEND="${RDEPEND}"
171 +BDEPEND="
172 + test? (
173 + dev-cpp/gtest
174 + dev-libs/boost
175 +)"
176 +
177 +S="${WORKDIR}/hipFFT-rocm-${PV}"
178 +
179 +PATCHES=(
180 + "${FILESDIR}/${PN}-4.3.0-gentoo-install-locations.patch"
181 + "${FILESDIR}/${PN}-4.3.0-remove-git-dependency.patch"
182 + "${FILESDIR}/${PN}-4.3.0-add-complex-header.patch"
183 +)
184 +
185 +src_prepare() {
186 + use test && rmdir rocFFT && ln -s ../rocFFT-rocm-${PV} rocFFT
187 + eapply_user
188 + cmake_src_prepare
189 +}
190 +
191 +src_configure() {
192 + # Grant access to the device
193 + addwrite /dev/kfd
194 + addpredict /dev/dri/
195 +
196 + local mycmakeargs=(
197 + -DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr"
198 + -DCMAKE_INSTALL_INCLUDEDIR="include/hipfft"
199 + -DCMAKE_SKIP_RPATH=ON
200 + -DBUILD_CLIENTS_TESTS=$(usex test ON OFF)
201 + -DBUILD_CLIENTS_RIDER=$(usex benchmark ON OFF)
202 + ${AMDGPU_TARGETS+-DAMDGPU_TARGETS="${AMDGPU_TARGETS}"}
203 + -D__skip_rocmclang="ON" ## fix cmake-3.21 configuration issue caused by officialy support programming language "HIP"
204 + )
205 +
206 + cmake_src_configure
207 +}
208 +
209 +src_test () {
210 + addwrite /dev/kfd
211 + addpredict /dev/dri
212 + cd "${BUILD_DIR}/clients/staging" || die
213 + einfo "Running hipfft-test"
214 + LD_LIBRARY_PATH=${BUILD_DIR}/library ./hipfft-test || die
215 +}
216 +
217 +src_install() {
218 + cmake_src_install
219 + if use benchmark; then
220 + cd "${BUILD_DIR}/clients/staging" || die
221 + dobin hipfft-rider
222 + fi
223 +}
224
225 diff --git a/sci-libs/hipFFT/metadata.xml b/sci-libs/hipFFT/metadata.xml
226 new file mode 100644
227 index 000000000000..7839d343e80f
228 --- /dev/null
229 +++ b/sci-libs/hipFFT/metadata.xml
230 @@ -0,0 +1,22 @@
231 +<?xml version="1.0" encoding="UTF-8"?>
232 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
233 +<pkgmetadata>
234 + <maintainer type="project">
235 + <email>sci@g.o</email>
236 + <name>Gentoo Science Project</name>
237 + </maintainer>
238 + <maintainer type="person" proxied="yes">
239 + <email>gentoo@××××××.net</email>
240 + <name>Wilfried Holzke</name>
241 + </maintainer>
242 + <maintainer type="person" proxied="yes">
243 + <email>xgreenlandforwyy@×××××.com</email>
244 + <name>Yiyang Wu</name>
245 + </maintainer>
246 + <upstream>
247 + <remote-id type="github">ROCmSoftwarePlatform/hipFFT</remote-id>
248 + </upstream>
249 + <use>
250 + <flag name="benchmark">Build and install benchmark programs hipfft-rider.</flag>
251 + </use>
252 +</pkgmetadata>