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: Mon, 28 Mar 2022 12:43:52
Message-Id: 1648471413.8887a506da51d0d648bb6d0de67db2eac9a5e971.amadio@gentoo
1 commit: 8887a506da51d0d648bb6d0de67db2eac9a5e971
2 Author: Guilherme Amadio <amadio <AT> gentoo <DOT> org>
3 AuthorDate: Mon Mar 28 12:42:19 2022 +0000
4 Commit: Guilherme Amadio <amadio <AT> gentoo <DOT> org>
5 CommitDate: Mon Mar 28 12:43:33 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8887a506
7
8 dev-util/nvidia-cuda-toolkit: version bump to 11.6.2
9
10 Package-Manager: Portage-3.0.30, Repoman-3.0.3
11 Signed-off-by: Guilherme Amadio <amadio <AT> gentoo.org>
12
13 dev-util/nvidia-cuda-toolkit/Manifest | 1 +
14 .../nvidia-cuda-toolkit-11.6.2.ebuild | 271 +++++++++++++++++++++
15 2 files changed, 272 insertions(+)
16
17 diff --git a/dev-util/nvidia-cuda-toolkit/Manifest b/dev-util/nvidia-cuda-toolkit/Manifest
18 index 1934523e51cb..52f66683c32a 100644
19 --- a/dev-util/nvidia-cuda-toolkit/Manifest
20 +++ b/dev-util/nvidia-cuda-toolkit/Manifest
21 @@ -1,3 +1,4 @@
22 DIST cuda_11.5.1_495.29.05_linux.run 3420998120 BLAKE2B 0d3f9626f97c60291397ebd0edc04e2c84942473d943d95af6fae244e5809721335bb90eaa6c019c9391de516d20599ca5631e99764616b6d25eacf1899d99d9 SHA512 71fb354714cac09265b5102223f919e34e3a8503593dd4f2e7b9542ae7787de96d64c490276b36b685da9e691cc2704419b67cfa376dcd3647e4d0f93b02db9b
23 DIST cuda_11.6.0_510.39.01_linux.run 3488951771 BLAKE2B f66d8b7779dc8e1e06ef5b83f1b565b6d500eb802aac1726c1393e0c0f065960761e8f6cdee955fd87362446331f7cb14febeb42efa5b89d86050e77b61b6ce9 SHA512 257b7b0bce1fa93cc442d8f335aec78681a3e4d457e31f04fb1cd01b91208aa35833f3793d8e2ef6d5db15e86c4d7659adb6ad127c57cbdabaa8dd14ef36a931
24 DIST cuda_11.6.1_510.47.03_linux.run 3529826023 BLAKE2B 93acd3a2984e89b1458d11051f4927e7bd2ac20bccce9166a2a4efcf16cf01a1ccbb6fa8be2f7a82ef1b5a403e4814c1e24aca493dd246c3a3c16e9107fbc1cc SHA512 75c8f28bcd3de638f780b4d8c5e80cea3023fb0e57b4075bd6905071da273e9d09281d947d660f2e4ab6d71f47c12cc021f12656fd8fbf56d11cf7e520e90a9e
25 +DIST cuda_11.6.2_510.47.03_linux.run 3462542823 BLAKE2B 8160591bc491a8d18bf9810c248a1e1966f82f6170fe4f98915fd51e984e594da390aab2eddee8a02ee245428c9db3ca4dbf6871d71a54823c06b5ba16769c4d SHA512 8afec50a2697074ee25eca59d5061041eb517bf324e20c21d7595f7000b445b9baeb8902b50fd2dcee16861502a7789b1c81994e1cba312426eea24f1252f21f
26
27 diff --git a/dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-11.6.2.ebuild b/dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-11.6.2.ebuild
28 new file mode 100644
29 index 000000000000..3f76059cf7ac
30 --- /dev/null
31 +++ b/dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-11.6.2.ebuild
32 @@ -0,0 +1,271 @@
33 +# Copyright 1999-2022 Gentoo Authors
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=8
37 +
38 +inherit check-reqs toolchain-funcs unpacker
39 +
40 +DRIVER_PV="510.47.03"
41 +
42 +DESCRIPTION="NVIDIA CUDA Toolkit (compiler and friends)"
43 +HOMEPAGE="https://developer.nvidia.com/cuda-zone"
44 +SRC_URI="https://developer.download.nvidia.com/compute/cuda/${PV}/local_installers/cuda_${PV}_${DRIVER_PV}_linux.run"
45 +S="${WORKDIR}"
46 +
47 +LICENSE="NVIDIA-CUDA"
48 +SLOT="0/${PV}"
49 +KEYWORDS="-* ~amd64 ~amd64-linux"
50 +IUSE="debugger nsight profiler vis-profiler sanitizer"
51 +RESTRICT="bindist mirror"
52 +
53 +# since CUDA 11, the bundled toolkit driver (== ${DRIVER_PV}) and the
54 +# actual required minimum driver version are different. Lowering the
55 +# bound helps Kepler sm_35 and sm_37 users.
56 +# https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#cuda-major-component-versions
57 +RDEPEND="
58 + <sys-devel/gcc-12_pre[cxx]
59 + >=x11-drivers/nvidia-drivers-450.80.02
60 + debugger? (
61 + dev-libs/openssl
62 + )
63 + nsight? (
64 + dev-libs/libpfm
65 + dev-libs/openssl
66 + sys-libs/zlib
67 + )
68 + vis-profiler? (
69 + dev-libs/openssl
70 + >=virtual/jre-1.8:*
71 + )"
72 +
73 +QA_PREBUILT="opt/cuda/*"
74 +CHECKREQS_DISK_BUILD="6800M"
75 +
76 +pkg_setup() {
77 + check-reqs_pkg_setup
78 +}
79 +
80 +src_prepare() {
81 + # ATTENTION: change requires revbump
82 + local cuda_supported_gcc="8.5 9.4 9.5 10.3 10.4 11.1 11.2 11.3"
83 +
84 + sed \
85 + -e "s:CUDA_SUPPORTED_GCC:${cuda_supported_gcc}:g" \
86 + "${FILESDIR}"/cuda-config.in > "${T}"/cuda-config || die
87 +
88 + default
89 +}
90 +
91 +src_install() {
92 + local cudadir=/opt/cuda
93 + local ecudadir="${EPREFIX}${cudadir}"
94 + local pathextradirs ldpathextradirs
95 + dodir ${cudadir}
96 + into ${cudadir}
97 +
98 + # Install standard sub packages
99 + local builddirs=(
100 + builds/cuda_{cccl,cudart,cuobjdump,cuxxfilt,memcheck,nvcc,nvdisasm,nvml_dev,nvprune,nvrtc,nvtx}
101 + builds/lib{cublas,cufft,curand,cusolver,cusparse,npp,nvjpeg}
102 + $(usex profiler "builds/cuda_nvprof builds/cuda_cupti" "")
103 + $(usex vis-profiler "builds/cuda_nvvp" "")
104 + $(usex debugger "builds/cuda_gdb" "")
105 + )
106 +
107 + local d f
108 + for d in "${builddirs[@]}"; do
109 + ebegin "Installing ${d}"
110 + [[ -d ${d} ]] || die "Directory does not exist: ${d}"
111 +
112 + if [[ -d ${d}/bin ]]; then
113 + for f in ${d}/bin/*; do
114 + if [[ -f ${f} ]]; then
115 + dobin "${f}"
116 + else
117 + insinto ${cudadir}/bin
118 + doins -r "${f}"
119 + fi
120 + done
121 + fi
122 +
123 + insinto ${cudadir}
124 + if [[ -d ${d}/targets ]]; then
125 + doins -r "${d}"/targets
126 + fi
127 + if [[ -d ${d}/share ]]; then
128 + doins -r "${d}"/share
129 + fi
130 + if [[ -d ${d}/extras ]]; then
131 + doins -r "${d}"/extras
132 + fi
133 + eend $?
134 + done
135 + dobin "${T}"/cuda-config
136 +
137 + doins builds/EULA.txt
138 + # nvml and nvvm need special handling
139 + ebegin "Installing nvvm"
140 + doins -r builds/cuda_nvcc/nvvm
141 + fperms +x ${cudadir}/nvvm/bin/cicc
142 + eend $?
143 +
144 + ebegin "Installing nvml"
145 + doins -r builds/cuda_nvml_dev/nvml
146 + eend $?
147 +
148 + if use sanitizer; then
149 + ebegin "Installing sanitizer"
150 + dobin builds/integration/Sanitizer/compute-sanitizer
151 + doins -r builds/cuda_sanitizer_api/compute-sanitizer
152 + # special handling for the executable
153 + fperms +x ${cudadir}/compute-sanitizer/compute-sanitizer
154 + eend $?
155 + fi
156 +
157 + use profiler && ldpathextradirs+=":${ecudadir}/extras/CUPTI/lib64"
158 +
159 + if use vis-profiler; then
160 + ebegin "Installing libnvvp"
161 + doins -r builds/cuda_nvvp/libnvvp
162 + # special handling for the executable
163 + fperms +x ${cudadir}/libnvvp/nvvp
164 + eend $?
165 + pathextradirs+=":${ecudadir}/libnvvp"
166 + fi
167 +
168 + if use nsight; then
169 + local ncu_dir=$(grep -o 'nsight-compute-[0-9][0-9\.]*' -m1 manifests/cuda_x86_64.xml)
170 + ebegin "Installing ${ncu_dir}"
171 + mv builds/nsight_compute builds/${ncu_dir} || die
172 + doins -r builds/${ncu_dir}
173 +
174 + # check this list on every bump
175 + local exes=(
176 + ${ncu_dir}/ncu
177 + ${ncu_dir}/ncu-ui
178 + ${ncu_dir}/nv-nsight-cu
179 + ${ncu_dir}/nv-nsight-cu-cli
180 + ${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/libexec/QtWebEngineProcess
181 + ${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/CrashReporter
182 + ${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/OpenGLVersionChecker
183 + ${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/ncu-ui
184 + ${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/ncu-ui.bin
185 + ${ncu_dir}/target/linux-desktop-glibc_2_11_3-x64/TreeLauncherTargetLdPreloadHelper
186 + ${ncu_dir}/target/linux-desktop-glibc_2_11_3-x64/TreeLauncherSubreaper
187 + ${ncu_dir}/target/linux-desktop-glibc_2_11_3-x64/ncu
188 + )
189 +
190 + dobin builds/integration/nsight-compute/{ncu,ncu-ui,nv-nsight-cu,nv-nsight-cu-cli}
191 + eend $?
192 +
193 + local nsys_dir=$(grep -o 'nsight-systems-[0-9][0-9\.]*' -m1 manifests/cuda_x86_64.xml)
194 + ebegin "Installing ${nsys_dir}"
195 + mv builds/nsight_systems builds/${nsys_dir} || die
196 + doins -r builds/${nsys_dir}
197 +
198 + # check this list on every bump
199 + exes+=(
200 + ${nsys_dir}/host-linux-x64/nsys-ui
201 + ${nsys_dir}/host-linux-x64/nsys-ui.bin
202 + ${nsys_dir}/host-linux-x64/ResolveSymbols
203 + ${nsys_dir}/host-linux-x64/ImportNvtxt
204 + ${nsys_dir}/host-linux-x64/CrashReporter
205 + ${nsys_dir}/host-linux-x64/QdstrmImporter
206 + ${nsys_dir}/host-linux-x64/libexec/QtWebEngineProcess
207 + ${nsys_dir}/target-linux-x64/nsys
208 + ${nsys_dir}/target-linux-x64/launcher
209 + ${nsys_dir}/target-linux-x64/nvgpucs
210 + ${nsys_dir}/target-linux-x64/nsys-launcher
211 + ${nsys_dir}/target-linux-x64/sqlite3
212 + ${nsys_dir}/target-linux-x64/python/bin/python
213 + )
214 +
215 + dobin builds/integration/nsight-systems/{nsight-sys,nsys,nsys-exporter,nsys-ui}
216 + eend $?
217 +
218 + # nsight scripts and binaries need to have their executable bit set, #691284
219 + for f in "${exes[@]}"; do
220 + fperms +x ${cudadir}/${f}
221 + done
222 +
223 + # remove foreign archs (triggers SONAME warning, #749903)
224 + rm -r "${ED}"/${cudadir}/${ncu_dir}/target/linux-desktop-glibc_2_19_0-ppc64le || die
225 + rm -r "${ED}"/${cudadir}/${ncu_dir}/target/linux-desktop-t210-a64 || die
226 +
227 + # unbundle libstdc++
228 + rm "${ED}"/${cudadir}/${nsys_dir}/host-linux-x64/libstdc++.so.6 || die
229 +
230 + # unbundle openssl
231 + rm "${ED}"/${cudadir}/${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/libssl.so* || die
232 + rm "${ED}"/${cudadir}/${nsys_dir}/host-linux-x64/libssl.so* || die
233 +
234 + # unbundle libz
235 + rm "${ED}"/${cudadir}/${nsys_dir}/host-linux-x64/libz.so* || die
236 +
237 + # unbundle libpfm
238 + rm "${ED}"/${cudadir}/${nsys_dir}/host-linux-x64/libpfm.so* || die
239 +
240 + # TODO: unbundle qt5
241 + # TODO: unbundle boost
242 + # TODO: unbundle icu
243 + # TODO: unbundle mesa
244 + # TODO: unbundle libSshClient
245 + # TODO: unbundle sqlite
246 + fi
247 +
248 + # Add include and lib symlinks
249 + dosym targets/x86_64-linux/include ${cudadir}/include
250 + dosym targets/x86_64-linux/lib ${cudadir}/lib64
251 +
252 + newenvd - 99cuda <<-EOF
253 + PATH=${ecudadir}/bin${pathextradirs}
254 + ROOTPATH=${ecudadir}/bin
255 + LDPATH=${ecudadir}/lib64:${ecudadir}/nvvm/lib64${ldpathextradirs}
256 + EOF
257 +
258 + # Cuda prepackages libraries, don't revdep-build on them
259 + insinto /etc/revdep-rebuild
260 + newins - 80${PN} <<-EOF
261 + SEARCH_DIRS_MASK="${ecudadir}"
262 + EOF
263 + # TODO: Add pkgconfig files for installed libraries
264 +}
265 +
266 +pkg_postinst_check() {
267 + local a="$(${EROOT}/opt/cuda/bin/cuda-config -s)"
268 + local b="0.0"
269 + local v
270 + for v in ${a}; do
271 + ver_test "${v}" -gt "${b}" && b="${v}"
272 + done
273 +
274 + # if gcc and if not gcc-version is at least greatest supported
275 + if tc-is-gcc && \
276 + ver_test $(gcc-version) -gt "${b}"; then
277 + ewarn
278 + ewarn "gcc > ${b} will not work with CUDA"
279 + ewarn "Make sure you set an earlier version of gcc with gcc-config"
280 + ewarn "or append --compiler-bindir= pointing to a gcc bindir like"
281 + ewarn "--compiler-bindir=${EPREFIX}/usr/*pc-linux-gnu/gcc-bin/gcc${b}"
282 + ewarn "to the nvcc compiler flags"
283 + ewarn
284 + fi
285 +}
286 +
287 +pkg_postinst() {
288 + if [[ ${MERGE_TYPE} != binary ]]; then
289 + pkg_postinst_check
290 + fi
291 +
292 + if use profiler || use nsight; then
293 + einfo
294 + einfo "nvidia-drivers restrict access to performance counters."
295 + einfo "You'll need to either run profiling tools (nvprof, nsight) "
296 + einfo "using sudo (needs cap SYS_ADMIN) or add the following line to "
297 + einfo "a modprobe configuration file "
298 + einfo "(e.g. /etc/modprobe.d/nvidia-prof.conf): "
299 + einfo
300 + einfo "options nvidia NVreg_RestrictProfilingToAdminUsers=0"
301 + einfo
302 + fi
303 +}