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/rocThrust/, sci-libs/rocThrust/files/
Date: Sat, 06 Nov 2021 04:53:27
Message-Id: 1636174349.d89374796f7e7ee37eaf2881d7b86074542fc999.heroxbd@gentoo
1 commit: d89374796f7e7ee37eaf2881d7b86074542fc999
2 Author: YiyangWu <xgreenlandforwyy <AT> gmail <DOT> com>
3 AuthorDate: Thu Aug 26 03:19:10 2021 +0000
4 Commit: Benda XU <heroxbd <AT> gentoo <DOT> org>
5 CommitDate: Sat Nov 6 04:52:29 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d8937479
7
8 sci-libs/rocThrust: bump version to 4.3.0
9
10 Enable benchmark and test build options
11
12 Closes: https://github.com/gentoo/gentoo/pull/22803
13 Package-Manager: Portage-3.0.20, 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/rocThrust/Manifest | 1 +
18 .../rocThrust-4.3.0-deprecate-hcc_detail.patch | 13 ++++
19 sci-libs/rocThrust/metadata.xml | 3 +
20 sci-libs/rocThrust/rocThrust-4.3.0.ebuild | 76 ++++++++++++++++++++++
21 4 files changed, 93 insertions(+)
22
23 diff --git a/sci-libs/rocThrust/Manifest b/sci-libs/rocThrust/Manifest
24 index 282c08da9b9..d94ba9ef58d 100644
25 --- a/sci-libs/rocThrust/Manifest
26 +++ b/sci-libs/rocThrust/Manifest
27 @@ -1 +1,2 @@
28 DIST rocThrust-4.0.0.tar.gz 1166346 BLAKE2B 02c89e0c4ab2c888a20b7c956a73012157f2735e6ec76369a1f75fbc17bb3f995d1914106ec58562f28243fbe5f019ac230ac3313b6aacb4d8b868f3ac1f091e SHA512 476aa5706487c5801cc91908806a1a1fcb550171f63e0b2debd9b59b18c7435c484578ec456ccfabc140dd7bca7d9bb432a7ba223946b1fca22e72e7d053af2d
29 +DIST rocThrust-4.3.0.tar.gz 1156832 BLAKE2B a462cfaa31883253fabba584ca77622cc5a7234bd9979472a84ec77b91c60f48f1064149b86d624aaedd70262fb65fb6aadb03cc6e00939d4eed6cd11bfc0090 SHA512 8c6aa3aefd59c87cc8278930bf90021867f519c356c86a3c3ebfcdf90887b8631250b6a9a8156f77c0cbf7ddbad7881e5e1b802f1cd1305cc3a2e7d95ef4e6f3
30
31 diff --git a/sci-libs/rocThrust/files/rocThrust-4.3.0-deprecate-hcc_detail.patch b/sci-libs/rocThrust/files/rocThrust-4.3.0-deprecate-hcc_detail.patch
32 new file mode 100644
33 index 00000000000..a923a016f96
34 --- /dev/null
35 +++ b/sci-libs/rocThrust/files/rocThrust-4.3.0-deprecate-hcc_detail.patch
36 @@ -0,0 +1,13 @@
37 +https://github.com/ROCmSoftwarePlatform/rocThrust/issues/180
38 +
39 +--- orig/thrust/system/hip/detail/guarded_driver_types.h
40 ++++ rocThrust-rocm-4.3.0/thrust/system/hip/detail/guarded_driver_types.h
41 +@@ -47,7 +47,7 @@
42 + # endif // __DRIVER_TYPES_H__
43 + #endif // __GNUC__
44 +
45 +-#include <hip/hcc_detail/host_defines.h>
46 ++#include <hip/amd_detail/host_defines.h>
47 +
48 + #if !defined(__GNUC__) || ((10000 * __GNUC__ + 100 * __GNUC_MINOR__ + __GNUC_PATCHLEVEL__) >= 40500)
49 + # ifdef THRUST_HOST_NEEDS_RESTORATION
50
51 diff --git a/sci-libs/rocThrust/metadata.xml b/sci-libs/rocThrust/metadata.xml
52 index 2de21c17fe6..20ece3c2955 100644
53 --- a/sci-libs/rocThrust/metadata.xml
54 +++ b/sci-libs/rocThrust/metadata.xml
55 @@ -15,4 +15,7 @@
56 <upstream>
57 <remote-id type="github">ROCm-Developer-Tools/rocThrust</remote-id>
58 </upstream>
59 + <use>
60 + <flag name="benchmark">Build and install benchmark binary.</flag>
61 + </use>
62 </pkgmetadata>
63
64 diff --git a/sci-libs/rocThrust/rocThrust-4.3.0.ebuild b/sci-libs/rocThrust/rocThrust-4.3.0.ebuild
65 new file mode 100644
66 index 00000000000..5063cf4dbce
67 --- /dev/null
68 +++ b/sci-libs/rocThrust/rocThrust-4.3.0.ebuild
69 @@ -0,0 +1,76 @@
70 +# Copyright 1999-2021 Gentoo Authors
71 +# Distributed under the terms of the GNU General Public License v2
72 +
73 +EAPI=7
74 +
75 +inherit cmake
76 +
77 +DESCRIPTION="HIP back-end for the parallel algorithm library Thrust"
78 +HOMEPAGE="https://github.com/ROCmSoftwarePlatform/rocThrust"
79 +SRC_URI="https://github.com/ROCmSoftwarePlatform/rocThrust/archive/rocm-${PV}.tar.gz -> rocThrust-${PV}.tar.gz"
80 +
81 +LICENSE="Apache-2.0"
82 +KEYWORDS="~amd64"
83 +SLOT="0/$(ver_cut 1-2)"
84 +IUSE="benchmark test"
85 +
86 +RESTRICT="!test? ( test )"
87 +
88 +RDEPEND="dev-util/hip:${SLOT}
89 + sci-libs/rocPRIM:${SLOT}"
90 +DEPEND="${RDEPEND}"
91 +
92 +S="${WORKDIR}/rocThrust-rocm-${PV}"
93 +
94 +PATCHES=( "${FILESDIR}/${PN}-4.0-operator_new.patch"
95 + "${FILESDIR}/${P}-deprecate-hcc_detail.patch" )
96 +
97 +src_prepare() {
98 + sed -e "/PREFIX rocthrust/d" \
99 + -e "/DESTINATION/s:rocthrust/include/thrust:include/rocthrust/thrust:" \
100 + -e "/rocm_install_symlink_subdir(rocthrust)/d" \
101 + -e "/<INSTALL_INTERFACE/s:rocthrust/include/:include/rocthrust/:" -i thrust/CMakeLists.txt || die
102 +
103 + sed -e "s:\${CMAKE_INSTALL_INCLUDEDIR}:&/rocthrust:" \
104 + -e "s:\${ROCM_INSTALL_LIBDIR}:\${CMAKE_INSTALL_LIBDIR}:" -i cmake/ROCMExportTargetsHeaderOnly.cmake || die
105 +
106 + # disable downloading googletest and googlebenchmark
107 + sed -r -e '/Downloading/{:a;N;/\n *\)$/!ba; d}' -i cmake/Dependencies.cmake || die
108 +
109 + # remove GIT dependency
110 + sed -r -e '/find_package\(Git/{:a;N;/\nendif/!ba; d}' -i cmake/Dependencies.cmake || die
111 +
112 + eapply_user
113 + cmake_src_prepare
114 +}
115 +
116 +src_configure() {
117 + # Grant access to the device
118 + addwrite /dev/kfd
119 + addpredict /dev/dri/
120 +
121 + # Compiler to use
122 + export CXX=hipcc
123 +
124 + local mycmakeargs=(
125 + -DBUILD_TEST=$(usex test ON OFF)
126 + -DBUILD_BENCHMARKS=$(usex benchmark ON OFF)
127 + ${AMDGPU_TARGETS+-DAMDGPU_TARGETS="${AMDGPU_TARGETS}"}
128 + -D__skip_rocmclang="ON" ## fix cmake-3.21 configuration issue caused by officialy support programming language "HIP"
129 + )
130 +
131 + cmake_src_configure
132 +}
133 +
134 +src_test() {
135 + # Grant access to the device
136 + addwrite /dev/kfd
137 + addwrite /dev/dri/
138 + cmake_src_test
139 +}
140 +
141 +src_install() {
142 + cmake_src_install
143 +
144 + use benchmark && dobin "${BUILD_DIR}"/benchmarks/benchmark_thrust_bench
145 +}