Gentoo Archives: gentoo-commits

From: Guilherme Amadio <amadio@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/nvidia-cuda-toolkit/
Date: Thu, 29 Apr 2021 08:42:51
Message-Id: 1619685721.916d327603b9e1169bd7767511ca881ccbeaf801.amadio@gentoo
1 commit: 916d327603b9e1169bd7767511ca881ccbeaf801
2 Author: Octiabrina Terrien–Puig <octiabrina <AT> myrvogna <DOT> net>
3 AuthorDate: Wed Apr 28 16:20:18 2021 +0000
4 Commit: Guilherme Amadio <amadio <AT> gentoo <DOT> org>
5 CommitDate: Thu Apr 29 08:42:01 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=916d3276
7
8 dev-util/nvidia-cuda-toolkit: bump to 11.3.0
9
10 Closes: https://github.com/gentoo/gentoo/pull/20579
11
12 Package-Manager: Portage-3.0.18, Repoman-3.0.3
13 Signed-off-by: Octiabrina Terrien-Puig <octiabrina <AT> myrvogna.net>
14 Signed-off-by: Guilherme Amadio <amadio <AT> gentoo.org>
15
16 dev-util/nvidia-cuda-toolkit/Manifest | 1 +
17 .../nvidia-cuda-toolkit-11.3.0.ebuild | 254 +++++++++++++++++++++
18 2 files changed, 255 insertions(+)
19
20 diff --git a/dev-util/nvidia-cuda-toolkit/Manifest b/dev-util/nvidia-cuda-toolkit/Manifest
21 index 5309b33e49d..d9efd1af95a 100644
22 --- a/dev-util/nvidia-cuda-toolkit/Manifest
23 +++ b/dev-util/nvidia-cuda-toolkit/Manifest
24 @@ -2,5 +2,6 @@ DIST cuda_10.2.89_440.33.01_linux.run 2645419389 BLAKE2B 236aa70a7b45e3636c2c229
25 DIST cuda_11.1.1_455.32.00_linux.run 3532172082 BLAKE2B f4af6bd87c419c002b4913ea7cfcbc84c78e3da485a7ac7dff0da483347cb38bde020e70c7352fe995a2efe0b8e97a156e0536f87aef69ff13fdf6e75fa634d1 SHA512 3da629e6f63548d06050a77d6ad2dbf314db33b2bf4e7d1659f039b3d9ad2ad3f87a6e506ec54db9ca2d21ac7b5ec576748082684bbab3b6642c03d2793d73a9
26 DIST cuda_11.2.0_460.27.04_linux.run 3046790184 BLAKE2B 5330bc2e12ff131eb993610c95b22e6358b11d6a7a952625a4e88ed856769256c02e165ac7bf6cc43236052c8427cee17bf1e7346995dc2eba84d93c5d444eb3 SHA512 0aa7390490b93be7f359327a8fe364a44b538e742c7ccd560e9bbb40ed8613539c37fcb4aa71a2fbfa0bfdb0416ab43bbdcc09cd0c81db3f1a07b37318d6b2b3
27 DIST cuda_11.2.2_460.32.03_linux.run 3057439068 BLAKE2B c3f3cd9eaaa4f91eb8080e7cafe1280f9bbc9cfc71ce1a6115af1dd348b83d30eed945609bf87e00d4873bede1fa9136fc4a7f393fd31db4e6406dc76086bc22 SHA512 e28d7d2eabd96df9e18f8e55f61adda39b07c2223605f77a6c2d92a02f7b57e9ce8b83d4b4de1124faa5670509d204d3db70c03b18af5cc5964b6ed6653d6a22
28 +DIST cuda_11.3.0_465.19.01_linux.run 3029622552 BLAKE2B ca64af09dc68b085a589b5756e3bfce72550e262b778aad06eb1f5b77d9cb30447fb8b57f5f6c3d210b49cd300e0db153c5eec1d51384b6889855a076ee62d07 SHA512 3120455e9513f62f82108539c5a4ccb4e9aa64beb66f816644e559bb8b573ff582c865c6a346ca39c6afb775c0c5fd567f5d31f0a0c5b927d6be849cd2905749
29 DIST cuda_8.0.61_375.26_linux.run 1465528129 BLAKE2B d52ddf1dcf5246f230f210d10d1f6e7b540c892dea5a8cd770f0d062b30b01f5c8467d930430b383464d40a9b4a14eaaf22a365e081955e4452ec4f55e08da0b SHA512 d22303719a9feff64f95bf6a966f1caa2bf0cf8c955e475ce08ce54faa5e098d336c2db223ef0185c1f23b9c52b7d2f81a63515485219cfc016d72bda979248b
30 DIST cuda_9.2.88_396.26_linux.run 1758421686 BLAKE2B 5068b2dfae87e43c124a6a72ac98b7c562aebc7161e7c977cfba68342127e99705228be531aa5bb8af0318e17c4ef8fe36257452d0f507fc3b82e3fbd0184bdc SHA512 2d0d87926e11a1b21d6d3377138753df458a53ba9539d8399f9f252e0784cb41e2c63a5c724ca81ded82b9657b97fda51d812b467b0827e7d361aa2ad73b2dba
31
32 diff --git a/dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-11.3.0.ebuild b/dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-11.3.0.ebuild
33 new file mode 100644
34 index 00000000000..9d0d4008b3c
35 --- /dev/null
36 +++ b/dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-11.3.0.ebuild
37 @@ -0,0 +1,254 @@
38 +# Copyright 1999-2021 Gentoo Authors
39 +# Distributed under the terms of the GNU General Public License v2
40 +
41 +EAPI=7
42 +
43 +inherit check-reqs cuda toolchain-funcs unpacker
44 +
45 +DRIVER_PV="465.19.01"
46 +
47 +DESCRIPTION="NVIDIA CUDA Toolkit (compiler and friends)"
48 +HOMEPAGE="https://developer.nvidia.com/cuda-zone"
49 +SRC_URI="https://developer.download.nvidia.com/compute/cuda/${PV}/local_installers/cuda_${PV}_${DRIVER_PV}_linux.run"
50 +
51 +LICENSE="NVIDIA-CUDA"
52 +SLOT="0/${PV}"
53 +KEYWORDS="-* ~amd64 ~amd64-linux"
54 +IUSE="debugger nsight profiler vis-profiler sanitizer"
55 +RESTRICT="bindist mirror"
56 +
57 +BDEPEND=""
58 +RDEPEND="
59 + <sys-devel/gcc-11_pre[cxx]
60 + >=x11-drivers/nvidia-drivers-${DRIVER_PV}
61 + debugger? (
62 + dev-libs/openssl
63 + sys-libs/libtermcap-compat
64 + sys-libs/ncurses-compat:5[tinfo]
65 + )
66 + vis-profiler? (
67 + dev-libs/openssl
68 + >=virtual/jre-1.6
69 + )"
70 +
71 +S="${WORKDIR}"
72 +
73 +QA_PREBUILT="opt/cuda/*"
74 +CHECKREQS_DISK_BUILD="6800M"
75 +
76 +pkg_setup() {
77 + # We don't like to run cuda_pkg_setup as it depends on us
78 + check-reqs_pkg_setup
79 +}
80 +
81 +src_prepare() {
82 + # ATTENTION: change requires revbump
83 + local cuda_supported_gcc="6.5 7.5 8.4 9.3 10.2 10.3"
84 +
85 + sed \
86 + -e "s:CUDA_SUPPORTED_GCC:${cuda_supported_gcc}:g" \
87 + "${FILESDIR}"/cuda-config.in > "${T}"/cuda-config || die
88 +
89 + default
90 +}
91 +
92 +src_install() {
93 + local cudadir=/opt/cuda
94 + local ecudadir="${EPREFIX}${cudadir}"
95 + local pathextradirs ldpathextradirs
96 + dodir ${cudadir}
97 + into ${cudadir}
98 +
99 + # Install standard sub packages
100 + local builddirs=(
101 + builds/cuda_{cudart,cuobjdump,memcheck,nvcc,nvdisasm,nvml_dev,nvprune,nvrtc,nvtx}
102 + builds/lib{cublas,cufft,curand,cusolver,cusparse,npp,nvjpeg}
103 + $(usex profiler "builds/cuda_nvprof builds/cuda_cupti" "")
104 + $(usex vis-profiler "builds/cuda_nvvp" "")
105 + $(usex debugger "builds/cuda_gdb" "")
106 + )
107 +
108 + local d f
109 + for d in "${builddirs[@]}"; do
110 + ebegin "Installing ${d}"
111 + [[ -d ${d} ]] || die "Directory does not exist: ${d}"
112 +
113 + if [[ -d ${d}/bin ]]; then
114 + for f in ${d}/bin/*; do
115 + if [[ -f ${f} ]]; then
116 + dobin "${f}"
117 + else
118 + insinto ${cudadir}/bin
119 + doins -r "${f}"
120 + fi
121 + done
122 + fi
123 +
124 + insinto ${cudadir}
125 + if [[ -d ${d}/targets ]]; then
126 + doins -r "${d}"/targets
127 + fi
128 + if [[ -d ${d}/share ]]; then
129 + doins -r "${d}"/share
130 + fi
131 + if [[ -d ${d}/extras ]]; then
132 + doins -r "${d}"/extras
133 + fi
134 + eend
135 + done
136 + dobin "${T}"/cuda-config
137 +
138 + doins builds/EULA.txt
139 + # nvml and nvvm need special handling
140 + ebegin "Installing nvvm"
141 + doins -r builds/cuda_nvcc/nvvm
142 + fperms +x ${cudadir}/nvvm/bin/cicc
143 + eend
144 +
145 + ebegin "Installing nvml"
146 + doins -r builds/cuda_nvml_dev/nvml
147 + eend
148 +
149 + if use sanitizer; then
150 + ebegin "Installing sanitizer"
151 + dobin builds/integration/Sanitizer/compute-sanitizer
152 + doins -r builds/cuda_sanitizer_api/compute-sanitizer
153 + # special handling for the executable
154 + fperms +x ${cudadir}/compute-sanitizer/compute-sanitizer
155 + eend
156 + fi
157 +
158 + use profiler && ldpathextradirs+=":${ecudadir}/extras/CUPTI/lib64"
159 +
160 + if use vis-profiler; then
161 + ebegin "Installing libnvvp"
162 + doins -r builds/cuda_nvvp/libnvvp
163 + # special handling for the executable
164 + fperms +x ${cudadir}/libnvvp/nvvp
165 + eend
166 + pathextradirs+=":${ecudadir}/libnvvp"
167 + fi
168 +
169 + if use nsight; then
170 + local ncu_dir=$(grep -o 'nsight-compute-[0-9][0-9\.]*' -m1 manifests/cuda_x86_64.xml)
171 + ebegin "Installing ${ncu_dir}"
172 + mv builds/nsight_compute builds/${ncu_dir} || die
173 + doins -r builds/${ncu_dir}
174 +
175 + # check this list on every bump
176 + local exes=(
177 + ${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/libexec/QtWebEngineProcess
178 + ${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/CrashReporter
179 + ${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/ncu-ui
180 + ${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/ncu-ui.bin
181 + ${ncu_dir}/target/linux-desktop-glibc_2_11_3-x64/TreeLauncherTargetLdPreloadHelper
182 + ${ncu_dir}/target/linux-desktop-glibc_2_11_3-x64/TreeLauncherSubreaper
183 + ${ncu_dir}/target/linux-desktop-glibc_2_11_3-x64/ncu
184 + )
185 +
186 + dobin builds/integration/nsight-compute/{ncu,ncu-ui,nv-nsight-cu,nv-nsight-cu-cli}
187 + eend
188 +
189 + local nsys_dir=$(grep -o 'nsight-systems-[0-9][0-9\.]*' -m1 manifests/cuda_x86_64.xml)
190 + ebegin "Installing ${nsys_dir}"
191 + mv builds/nsight_systems builds/${nsys_dir} || die
192 + doins -r builds/${nsys_dir}
193 +
194 + # check this list on every bump
195 + exes+=(
196 + ${nsys_dir}/host-linux-x64/nsys-ui
197 + ${nsys_dir}/host-linux-x64/nsys-ui.bin
198 + ${nsys_dir}/host-linux-x64/ResolveSymbols
199 + ${nsys_dir}/host-linux-x64/ImportNvtxt
200 + ${nsys_dir}/host-linux-x64/CrashReporter
201 + ${nsys_dir}/host-linux-x64/QdstrmImporter
202 + ${nsys_dir}/host-linux-x64/libexec/QtWebEngineProcess
203 + ${nsys_dir}/target-linux-x64/nsys
204 + ${nsys_dir}/target-linux-x64/launcher
205 + ${nsys_dir}/target-linux-x64/nvgpucs
206 + ${nsys_dir}/target-linux-x64/nsys-launcher
207 + ${nsys_dir}/target-linux-x64/sqlite3
208 + ${nsys_dir}/target-linux-x64/python/bin/python
209 + )
210 +
211 + dobin builds/integration/nsight-systems/{nsight-sys,nsys,nsys-exporter,nsys-ui}
212 + eend
213 +
214 + # nsight scripts and binaries need to have their executable bit set, #691284
215 + for f in "${exes[@]}"; do
216 + fperms +x ${cudadir}/${f}
217 + done
218 +
219 + # remove foreign archs (triggers SONAME warning, #749903)
220 + rm -r "${ED}"/${cudadir}/${ncu_dir}/target/linux-desktop-glibc_2_19_0-ppc64le || die
221 + rm -r "${ED}"/${cudadir}/${ncu_dir}/target/linux-desktop-t210-a64 || die
222 + rm -r "${ED}"/${cudadir}/${nsys_dir}/target-linux-armv8 || die
223 +
224 + # TODO: unbundle qt5
225 + # TODO: unbundle boost
226 + # TODO: unbundle icu
227 + # TODO: unbundle openssl
228 + # TODO: unbundle mesa
229 + # TODO: unbundle libz
230 + # TODO: unbundle libstdc++
231 + # TODO: unbundle libSshClient
232 + # TODO: unbundle sqlite
233 + # TODO: unbundle libpfm ?
234 + fi
235 +
236 + # Add include and lib symlinks
237 + dosym targets/x86_64-linux/include ${cudadir}/include
238 + dosym targets/x86_64-linux/lib ${cudadir}/lib64
239 +
240 + newenvd - 99cuda <<-EOF
241 + PATH=${ecudadir}/bin${pathextradirs}
242 + ROOTPATH=${ecudadir}/bin
243 + LDPATH=${ecudadir}/lib64:${ecudadir}/nvvm/lib64${ldpathextradirs}
244 + EOF
245 +
246 + # Cuda prepackages libraries, don't revdep-build on them
247 + insinto /etc/revdep-rebuild
248 + newins - 80${PN} <<-EOF
249 + SEARCH_DIRS_MASK="${ecudadir}"
250 + EOF
251 + # TODO: Add pkgconfig files for installed libraries
252 +}
253 +
254 +pkg_postinst_check() {
255 + local a="$(${EROOT}/opt/cuda/bin/cuda-config -s)"
256 + local b="0.0"
257 + local v
258 + for v in ${a}; do
259 + ver_test "${v}" -gt "${b}" && b="${v}"
260 + done
261 +
262 + # if gcc and if not gcc-version is at least greatest supported
263 + if tc-is-gcc && \
264 + ver_test $(gcc-version) -gt "${b}"; then
265 + ewarn
266 + ewarn "gcc > ${b} will not work with CUDA"
267 + ewarn "Make sure you set an earlier version of gcc with gcc-config"
268 + ewarn "or append --compiler-bindir= pointing to a gcc bindir like"
269 + ewarn "--compiler-bindir=${EPREFIX}/usr/*pc-linux-gnu/gcc-bin/gcc${b}"
270 + ewarn "to the nvcc compiler flags"
271 + ewarn
272 + fi
273 +}
274 +
275 +pkg_postinst() {
276 + if [[ ${MERGE_TYPE} != binary ]]; then
277 + pkg_postinst_check
278 + fi
279 +
280 + if use profiler || use nsight; then
281 + einfo
282 + einfo "nvidia-drivers restrict access to performance counters."
283 + einfo "You'll need to either run profiling tools (nvprof, nsight) "
284 + einfo "using sudo (needs cap SYS_ADMIN) or add the following line to "
285 + einfo "a modprobe configuration file "
286 + einfo "(e.g. /etc/modprobe.d/nvidia-prof.conf): "
287 + einfo
288 + einfo "options nvidia NVreg_RestrictProfilingToAdminUsers=0"
289 + einfo
290 + fi
291 +}