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: Wed, 23 Feb 2022 09:48:09
Message-Id: 1645609677.4b43ff6fe5595ba4d930df5f358996a95f204425.amadio@gentoo
1 commit: 4b43ff6fe5595ba4d930df5f358996a95f204425
2 Author: Guilherme Amadio <amadio <AT> gentoo <DOT> org>
3 AuthorDate: Wed Feb 23 09:46:10 2022 +0000
4 Commit: Guilherme Amadio <amadio <AT> gentoo <DOT> org>
5 CommitDate: Wed Feb 23 09:47:57 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4b43ff6f
7
8 dev-util/nvidia-cuda-toolkit: version bump to 11.6.1
9
10 Closes: https://bugs.gentoo.org/823882
11 Package-Manager: Portage-3.0.30, Repoman-3.0.3
12 Signed-off-by: Guilherme Amadio <amadio <AT> gentoo.org>
13
14 dev-util/nvidia-cuda-toolkit/Manifest | 1 +
15 .../nvidia-cuda-toolkit-11.6.1.ebuild | 271 +++++++++++++++++++++
16 2 files changed, 272 insertions(+)
17
18 diff --git a/dev-util/nvidia-cuda-toolkit/Manifest b/dev-util/nvidia-cuda-toolkit/Manifest
19 index 3598390e75ee..297e4c9a4f78 100644
20 --- a/dev-util/nvidia-cuda-toolkit/Manifest
21 +++ b/dev-util/nvidia-cuda-toolkit/Manifest
22 @@ -1,3 +1,4 @@
23 DIST cuda_10.2.89_440.33.01_linux.run 2645419389 BLAKE2B 236aa70a7b45e3636c2c229fffa7d1ca0699ab4365865a73edab607a209c42c2899133dd6a83c61c5929fa754668ad15aec4d847639af1c00a8e6657c8487c77 SHA512 ad8da539ff5df7caf411d1e497ff3d6978cfa8a1fd9150fa4846089e92a604ea56be8631f3efdfe7229a655b8d2d28e6edb32f5731530a77d6f00241cc7aab6e
24 DIST cuda_11.5.1_495.29.05_linux.run 3420998120 BLAKE2B 0d3f9626f97c60291397ebd0edc04e2c84942473d943d95af6fae244e5809721335bb90eaa6c019c9391de516d20599ca5631e99764616b6d25eacf1899d99d9 SHA512 71fb354714cac09265b5102223f919e34e3a8503593dd4f2e7b9542ae7787de96d64c490276b36b685da9e691cc2704419b67cfa376dcd3647e4d0f93b02db9b
25 DIST cuda_11.6.0_510.39.01_linux.run 3488951771 BLAKE2B f66d8b7779dc8e1e06ef5b83f1b565b6d500eb802aac1726c1393e0c0f065960761e8f6cdee955fd87362446331f7cb14febeb42efa5b89d86050e77b61b6ce9 SHA512 257b7b0bce1fa93cc442d8f335aec78681a3e4d457e31f04fb1cd01b91208aa35833f3793d8e2ef6d5db15e86c4d7659adb6ad127c57cbdabaa8dd14ef36a931
26 +DIST cuda_11.6.1_510.47.03_linux.run 3529826023 BLAKE2B 93acd3a2984e89b1458d11051f4927e7bd2ac20bccce9166a2a4efcf16cf01a1ccbb6fa8be2f7a82ef1b5a403e4814c1e24aca493dd246c3a3c16e9107fbc1cc SHA512 75c8f28bcd3de638f780b4d8c5e80cea3023fb0e57b4075bd6905071da273e9d09281d947d660f2e4ab6d71f47c12cc021f12656fd8fbf56d11cf7e520e90a9e
27
28 diff --git a/dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-11.6.1.ebuild b/dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-11.6.1.ebuild
29 new file mode 100644
30 index 000000000000..3f76059cf7ac
31 --- /dev/null
32 +++ b/dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-11.6.1.ebuild
33 @@ -0,0 +1,271 @@
34 +# Copyright 1999-2022 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=8
38 +
39 +inherit check-reqs toolchain-funcs unpacker
40 +
41 +DRIVER_PV="510.47.03"
42 +
43 +DESCRIPTION="NVIDIA CUDA Toolkit (compiler and friends)"
44 +HOMEPAGE="https://developer.nvidia.com/cuda-zone"
45 +SRC_URI="https://developer.download.nvidia.com/compute/cuda/${PV}/local_installers/cuda_${PV}_${DRIVER_PV}_linux.run"
46 +S="${WORKDIR}"
47 +
48 +LICENSE="NVIDIA-CUDA"
49 +SLOT="0/${PV}"
50 +KEYWORDS="-* ~amd64 ~amd64-linux"
51 +IUSE="debugger nsight profiler vis-profiler sanitizer"
52 +RESTRICT="bindist mirror"
53 +
54 +# since CUDA 11, the bundled toolkit driver (== ${DRIVER_PV}) and the
55 +# actual required minimum driver version are different. Lowering the
56 +# bound helps Kepler sm_35 and sm_37 users.
57 +# https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#cuda-major-component-versions
58 +RDEPEND="
59 + <sys-devel/gcc-12_pre[cxx]
60 + >=x11-drivers/nvidia-drivers-450.80.02
61 + debugger? (
62 + dev-libs/openssl
63 + )
64 + nsight? (
65 + dev-libs/libpfm
66 + dev-libs/openssl
67 + sys-libs/zlib
68 + )
69 + vis-profiler? (
70 + dev-libs/openssl
71 + >=virtual/jre-1.8:*
72 + )"
73 +
74 +QA_PREBUILT="opt/cuda/*"
75 +CHECKREQS_DISK_BUILD="6800M"
76 +
77 +pkg_setup() {
78 + check-reqs_pkg_setup
79 +}
80 +
81 +src_prepare() {
82 + # ATTENTION: change requires revbump
83 + local cuda_supported_gcc="8.5 9.4 9.5 10.3 10.4 11.1 11.2 11.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_{cccl,cudart,cuobjdump,cuxxfilt,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}/ncu
178 + ${ncu_dir}/ncu-ui
179 + ${ncu_dir}/nv-nsight-cu
180 + ${ncu_dir}/nv-nsight-cu-cli
181 + ${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/libexec/QtWebEngineProcess
182 + ${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/CrashReporter
183 + ${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/OpenGLVersionChecker
184 + ${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/ncu-ui
185 + ${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/ncu-ui.bin
186 + ${ncu_dir}/target/linux-desktop-glibc_2_11_3-x64/TreeLauncherTargetLdPreloadHelper
187 + ${ncu_dir}/target/linux-desktop-glibc_2_11_3-x64/TreeLauncherSubreaper
188 + ${ncu_dir}/target/linux-desktop-glibc_2_11_3-x64/ncu
189 + )
190 +
191 + dobin builds/integration/nsight-compute/{ncu,ncu-ui,nv-nsight-cu,nv-nsight-cu-cli}
192 + eend $?
193 +
194 + local nsys_dir=$(grep -o 'nsight-systems-[0-9][0-9\.]*' -m1 manifests/cuda_x86_64.xml)
195 + ebegin "Installing ${nsys_dir}"
196 + mv builds/nsight_systems builds/${nsys_dir} || die
197 + doins -r builds/${nsys_dir}
198 +
199 + # check this list on every bump
200 + exes+=(
201 + ${nsys_dir}/host-linux-x64/nsys-ui
202 + ${nsys_dir}/host-linux-x64/nsys-ui.bin
203 + ${nsys_dir}/host-linux-x64/ResolveSymbols
204 + ${nsys_dir}/host-linux-x64/ImportNvtxt
205 + ${nsys_dir}/host-linux-x64/CrashReporter
206 + ${nsys_dir}/host-linux-x64/QdstrmImporter
207 + ${nsys_dir}/host-linux-x64/libexec/QtWebEngineProcess
208 + ${nsys_dir}/target-linux-x64/nsys
209 + ${nsys_dir}/target-linux-x64/launcher
210 + ${nsys_dir}/target-linux-x64/nvgpucs
211 + ${nsys_dir}/target-linux-x64/nsys-launcher
212 + ${nsys_dir}/target-linux-x64/sqlite3
213 + ${nsys_dir}/target-linux-x64/python/bin/python
214 + )
215 +
216 + dobin builds/integration/nsight-systems/{nsight-sys,nsys,nsys-exporter,nsys-ui}
217 + eend $?
218 +
219 + # nsight scripts and binaries need to have their executable bit set, #691284
220 + for f in "${exes[@]}"; do
221 + fperms +x ${cudadir}/${f}
222 + done
223 +
224 + # remove foreign archs (triggers SONAME warning, #749903)
225 + rm -r "${ED}"/${cudadir}/${ncu_dir}/target/linux-desktop-glibc_2_19_0-ppc64le || die
226 + rm -r "${ED}"/${cudadir}/${ncu_dir}/target/linux-desktop-t210-a64 || die
227 +
228 + # unbundle libstdc++
229 + rm "${ED}"/${cudadir}/${nsys_dir}/host-linux-x64/libstdc++.so.6 || die
230 +
231 + # unbundle openssl
232 + rm "${ED}"/${cudadir}/${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/libssl.so* || die
233 + rm "${ED}"/${cudadir}/${nsys_dir}/host-linux-x64/libssl.so* || die
234 +
235 + # unbundle libz
236 + rm "${ED}"/${cudadir}/${nsys_dir}/host-linux-x64/libz.so* || die
237 +
238 + # unbundle libpfm
239 + rm "${ED}"/${cudadir}/${nsys_dir}/host-linux-x64/libpfm.so* || die
240 +
241 + # TODO: unbundle qt5
242 + # TODO: unbundle boost
243 + # TODO: unbundle icu
244 + # TODO: unbundle mesa
245 + # TODO: unbundle libSshClient
246 + # TODO: unbundle sqlite
247 + fi
248 +
249 + # Add include and lib symlinks
250 + dosym targets/x86_64-linux/include ${cudadir}/include
251 + dosym targets/x86_64-linux/lib ${cudadir}/lib64
252 +
253 + newenvd - 99cuda <<-EOF
254 + PATH=${ecudadir}/bin${pathextradirs}
255 + ROOTPATH=${ecudadir}/bin
256 + LDPATH=${ecudadir}/lib64:${ecudadir}/nvvm/lib64${ldpathextradirs}
257 + EOF
258 +
259 + # Cuda prepackages libraries, don't revdep-build on them
260 + insinto /etc/revdep-rebuild
261 + newins - 80${PN} <<-EOF
262 + SEARCH_DIRS_MASK="${ecudadir}"
263 + EOF
264 + # TODO: Add pkgconfig files for installed libraries
265 +}
266 +
267 +pkg_postinst_check() {
268 + local a="$(${EROOT}/opt/cuda/bin/cuda-config -s)"
269 + local b="0.0"
270 + local v
271 + for v in ${a}; do
272 + ver_test "${v}" -gt "${b}" && b="${v}"
273 + done
274 +
275 + # if gcc and if not gcc-version is at least greatest supported
276 + if tc-is-gcc && \
277 + ver_test $(gcc-version) -gt "${b}"; then
278 + ewarn
279 + ewarn "gcc > ${b} will not work with CUDA"
280 + ewarn "Make sure you set an earlier version of gcc with gcc-config"
281 + ewarn "or append --compiler-bindir= pointing to a gcc bindir like"
282 + ewarn "--compiler-bindir=${EPREFIX}/usr/*pc-linux-gnu/gcc-bin/gcc${b}"
283 + ewarn "to the nvcc compiler flags"
284 + ewarn
285 + fi
286 +}
287 +
288 +pkg_postinst() {
289 + if [[ ${MERGE_TYPE} != binary ]]; then
290 + pkg_postinst_check
291 + fi
292 +
293 + if use profiler || use nsight; then
294 + einfo
295 + einfo "nvidia-drivers restrict access to performance counters."
296 + einfo "You'll need to either run profiling tools (nvprof, nsight) "
297 + einfo "using sudo (needs cap SYS_ADMIN) or add the following line to "
298 + einfo "a modprobe configuration file "
299 + einfo "(e.g. /etc/modprobe.d/nvidia-prof.conf): "
300 + einfo
301 + einfo "options nvidia NVreg_RestrictProfilingToAdminUsers=0"
302 + einfo
303 + fi
304 +}