summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuilherme Amadio <amadio@gentoo.org>2023-02-13 10:38:44 +0100
committerGuilherme Amadio <amadio@gentoo.org>2023-02-13 10:56:05 +0100
commit973118f64b057514090c5202ab63a2e36352a62c (patch)
tree80bfac912bb73908a1c54f16c74fe64b534ee0fd /dev-util/nvidia-cuda-toolkit
parentsci-physics/root: fix bug 882483 (diff)
downloadgentoo-973118f64b057514090c5202ab63a2e36352a62c.tar.gz
gentoo-973118f64b057514090c5202ab63a2e36352a62c.tar.bz2
gentoo-973118f64b057514090c5202ab63a2e36352a62c.zip
dev-util/nvidia-cuda-toolkit: add 12.0.1
Closes: https://bugs.gentoo.org/890515 Signed-off-by: Guilherme Amadio <amadio@gentoo.org>
Diffstat (limited to 'dev-util/nvidia-cuda-toolkit')
-rw-r--r--dev-util/nvidia-cuda-toolkit/Manifest1
-rw-r--r--dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-12.0.1.ebuild296
2 files changed, 297 insertions, 0 deletions
diff --git a/dev-util/nvidia-cuda-toolkit/Manifest b/dev-util/nvidia-cuda-toolkit/Manifest
index 9a2c85629a34..fead56ecde1f 100644
--- a/dev-util/nvidia-cuda-toolkit/Manifest
+++ b/dev-util/nvidia-cuda-toolkit/Manifest
@@ -1,2 +1,3 @@
DIST cuda_11.7.0_515.43.04_linux.run 3490450898 BLAKE2B f5984a3ae67a116f7944d8e1c2b3b0a25b41aa5081bff869dd30ea2213cc96d23459dffdfd84ec145d5a860bd683d81d212f331939d7b39f9d9b5f17c838f13c SHA512 070c9a4b3bb11503d99212cf483ead88ae182e7da7eabd7390a0211b57ea550fb8a806ed3c009b8bae654529a7dc6c11dd35c0d59066f6f4eebe064c94d4e071
DIST cuda_11.8.0_520.61.05_linux.run 4336730777 BLAKE2B cfdb4a51c49ee504e56a4a95de4e477ef207b678527cbb633c1e83e667f1a62c0f67038befd0b10f7ae24cda9c8bc5c54293d06a05b2e45be6cf677e40f71f17 SHA512 e96e1389abed34b5093b3a1d4e6ae9f3d4f8406621b1475f378efae65868657efce22da03b5b4e0a548d9635e406b8690b18b17b186d03ecb3ca0703c5d5787a
+DIST cuda_12.0.1_525.85.12_linux.run 4207617207 BLAKE2B d99b70b253decb03f37e73c783771b50aa057c02b31a4fa629c4ba2ac91dce8f87b8316d205ee1393ab936e19aebd7753cff339d00f91dcd4cfe7a968f98364e SHA512 edd73c6e989e8469d73a8a8c4c927aa0654c1c299eff77c8b30dafd5da6e4e368626cec48978785f8e94fe8d1b7b73f1df6d5d03a80a6f58a07fa2d1f15c7f86
diff --git a/dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-12.0.1.ebuild b/dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-12.0.1.ebuild
new file mode 100644
index 000000000000..ab597eca9d3f
--- /dev/null
+++ b/dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-12.0.1.ebuild
@@ -0,0 +1,296 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit check-reqs toolchain-funcs unpacker
+
+DRIVER_PV="525.85.12"
+
+DESCRIPTION="NVIDIA CUDA Toolkit (compiler and friends)"
+HOMEPAGE="https://developer.nvidia.com/cuda-zone"
+SRC_URI="https://developer.download.nvidia.com/compute/cuda/${PV}/local_installers/cuda_${PV}_${DRIVER_PV}_linux.run"
+S="${WORKDIR}"
+
+LICENSE="NVIDIA-CUDA"
+SLOT="0/${PV}"
+KEYWORDS="-* ~amd64 ~amd64-linux"
+IUSE="debugger nsight profiler vis-profiler sanitizer"
+RESTRICT="bindist mirror"
+
+# since CUDA 11, the bundled toolkit driver (== ${DRIVER_PV}) and the
+# actual required minimum driver version are different. Lowering the
+# bound helps Kepler sm_35 and sm_37 users.
+# https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html#cuda-major-component-versions
+RDEPEND="
+ <sys-devel/gcc-13_pre[cxx]
+ >=x11-drivers/nvidia-drivers-525.60.13
+ nsight? (
+ dev-libs/libpfm
+ dev-libs/wayland
+ || (
+ dev-libs/openssl-compat:1.1.1
+ =dev-libs/openssl-1.1.1*
+ )
+ || (
+ media-libs/tiff-compat:4
+ media-libs/tiff:0
+ )
+ sys-libs/zlib
+ )
+ vis-profiler? (
+ >=virtual/jre-1.8:*
+ )"
+
+QA_PREBUILT="opt/cuda/*"
+CHECKREQS_DISK_BUILD="7500M"
+
+pkg_setup() {
+ check-reqs_pkg_setup
+}
+
+src_prepare() {
+ # ATTENTION: change requires revbump, see link below for supported GCC # versions
+ # https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#system-requirements
+ local cuda_supported_gcc="8.5 9.4 9.5 10 10.3 10.4 11 11.1 11.2 11.3 12.1"
+
+ sed \
+ -e "s:CUDA_SUPPORTED_GCC:${cuda_supported_gcc}:g" \
+ "${FILESDIR}"/cuda-config.in > "${T}"/cuda-config || die
+
+ default
+}
+
+src_install() {
+ local cudadir=/opt/cuda
+ local ecudadir="${EPREFIX}${cudadir}"
+ local pathextradirs ldpathextradirs
+ dodir ${cudadir}
+ into ${cudadir}
+
+ # Install standard sub packages
+ local builddirs=(
+ builds/cuda_{cccl,cudart,cuobjdump,cuxxfilt,demo_suite,nvcc,nvdisasm,nvml_dev,nvprune,nvrtc,nvtx,opencl}
+ builds/lib{cublas,cufft,cufile,curand,cusolver,cusparse,npp,nvjitlink,nvjpeg}
+ builds/nvidia_fs
+ $(usex profiler "builds/cuda_nvprof builds/cuda_cupti builds/cuda_profiler_api" "")
+ $(usex vis-profiler "builds/cuda_nvvp" "")
+ $(usex debugger "builds/cuda_gdb" "")
+ )
+
+ local d f
+ for d in "${builddirs[@]}"; do
+ ebegin "Installing ${d}"
+ [[ -d ${d} ]] || die "Directory does not exist: ${d}"
+
+ if [[ -d ${d}/bin ]]; then
+ for f in ${d}/bin/*; do
+ if [[ -f ${f} ]]; then
+ dobin "${f}"
+ else
+ insinto ${cudadir}/bin
+ doins -r "${f}"
+ fi
+ done
+ fi
+
+ insinto ${cudadir}
+ if [[ -d ${d}/targets ]]; then
+ doins -r "${d}"/targets
+ fi
+ if [[ -d ${d}/share ]]; then
+ doins -r "${d}"/share
+ fi
+ if [[ -d ${d}/extras ]]; then
+ doins -r "${d}"/extras
+ fi
+ eend $?
+ done
+ dobin "${T}"/cuda-config
+
+ doins builds/EULA.txt
+ # nvml and nvvm need special handling
+ ebegin "Installing nvvm"
+ doins -r builds/cuda_nvcc/nvvm
+ fperms +x ${cudadir}/nvvm/bin/cicc
+ eend $?
+
+ ebegin "Installing nvml"
+ doins -r builds/cuda_nvml_dev/nvml
+ eend $?
+
+ if use sanitizer; then
+ ebegin "Installing sanitizer"
+ dobin builds/integration/Sanitizer/compute-sanitizer
+ doins -r builds/cuda_sanitizer_api/compute-sanitizer
+ # special handling for the executable
+ fperms +x ${cudadir}/compute-sanitizer/compute-sanitizer
+ eend $?
+ fi
+
+ use debugger && ldpathextradirs+=":${ecudadir}/extras/Debugger/lib64"
+ use profiler && ldpathextradirs+=":${ecudadir}/extras/CUPTI/lib64"
+
+ if use vis-profiler; then
+ ebegin "Installing libnvvp"
+ doins -r builds/cuda_nvvp/libnvvp
+ # special handling for the executable
+ fperms +x ${cudadir}/libnvvp/nvvp
+ eend $?
+ pathextradirs+=":${ecudadir}/libnvvp"
+ fi
+
+ if use nsight; then
+ local ncu_dir=$(grep -o 'nsight-compute-[0-9][0-9\.]*' -m1 manifests/cuda_x86_64.xml)
+ ebegin "Installing ${ncu_dir}"
+ mv builds/nsight_compute builds/${ncu_dir} || die
+ doins -r builds/${ncu_dir}
+
+ # check this list on every bump
+ local exes=(
+ ${ncu_dir}/ncu
+ ${ncu_dir}/ncu-ui
+ ${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/libexec/QtWebEngineProcess
+ ${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/CrashReporter
+ ${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/OpenGLVersionChecker
+ ${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/QdstrmImporter
+ ${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/ncu-ui
+ ${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/ncu-ui.bin
+ ${ncu_dir}/target/linux-desktop-glibc_2_11_3-x64/TreeLauncherSubreaper
+ ${ncu_dir}/target/linux-desktop-glibc_2_11_3-x64/TreeLauncherTargetLdPreloadHelper
+ ${ncu_dir}/target/linux-desktop-glibc_2_11_3-x64/ncu
+ )
+
+ dobin builds/integration/nsight-compute/{ncu,ncu-ui}
+ eend $?
+
+ local nsys_dir=$(grep -o 'nsight-systems-[0-9][0-9\.]*' -m1 manifests/cuda_x86_64.xml)
+ ebegin "Installing ${nsys_dir}"
+ mv builds/nsight_systems builds/${nsys_dir} || die
+ doins -r builds/${nsys_dir}
+
+ # check this list on every bump
+ exes+=(
+ ${nsys_dir}/host-linux-x64/nsys-ui
+ ${nsys_dir}/host-linux-x64/nsys-ui.bin
+ ${nsys_dir}/host-linux-x64/ResolveSymbols
+ ${nsys_dir}/host-linux-x64/ImportNvtxt
+ ${nsys_dir}/host-linux-x64/CrashReporter
+ ${nsys_dir}/host-linux-x64/QdstrmImporter
+ ${nsys_dir}/host-linux-x64/libexec/QtWebEngineProcess
+ ${nsys_dir}/target-linux-x64/nsys
+ ${nsys_dir}/target-linux-x64/launcher
+ ${nsys_dir}/target-linux-x64/nvgpucs
+ ${nsys_dir}/target-linux-x64/nsys-launcher
+ ${nsys_dir}/target-linux-x64/sqlite3
+ ${nsys_dir}/target-linux-x64/python/bin/python
+ )
+
+ dobin builds/integration/nsight-systems/{nsight-sys,nsys,nsys-exporter,nsys-ui}
+ eend $?
+
+ # nsight scripts and binaries need to have their executable bit set, #691284
+ for f in "${exes[@]}"; do
+ fperms +x ${cudadir}/${f}
+ done
+
+ # remove foreign archs (triggers SONAME warning, #749903)
+ rm -r "${ED}"/${cudadir}/${ncu_dir}/target/linux-desktop-glibc_2_19_0-ppc64le || die
+ rm -r "${ED}"/${cudadir}/${ncu_dir}/target/linux-desktop-t210-a64 || die
+
+ # unbundle libstdc++
+ rm "${ED}"/${cudadir}/${nsys_dir}/host-linux-x64/libstdc++.so.6 || die
+
+ # unbundle openssl
+ rm "${ED}"/${cudadir}/${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/libssl.so* || die
+ rm "${ED}"/${cudadir}/${nsys_dir}/host-linux-x64/libssl.so* || die
+
+ # unbundle libz
+ rm "${ED}"/${cudadir}/${nsys_dir}/host-linux-x64/libz.so* || die
+
+ # unbundle libpfm
+ rm "${ED}"/${cudadir}/${nsys_dir}/host-linux-x64/libpfm.so* || die
+
+ # TODO: unbundle qt5
+ # TODO: unbundle boost
+ # TODO: unbundle icu
+ # TODO: unbundle mesa
+ # TODO: unbundle libSshClient
+ # TODO: unbundle sqlite
+ fi
+
+ exes=(
+ extras/demo_suite/bandwidthTest
+ extras/demo_suite/busGrind
+ extras/demo_suite/deviceQuery
+ extras/demo_suite/nbody
+ extras/demo_suite/oceanFFT
+ extras/demo_suite/randomFog
+ extras/demo_suite/vectorAdd
+ )
+
+ # set executable bit on demo_suite binaries
+ for f in "${exes[@]}"; do
+ fperms +x ${cudadir}/${f}
+ done
+
+ # Add include and lib symlinks
+ dosym targets/x86_64-linux/include ${ecudadir}/include
+ dosym targets/x86_64-linux/lib ${ecudadir}/lib64
+
+ # Remove bad symlinks
+ rm "${ED}"/${cudadir}/targets/x86_64-linux/include/include || die
+ rm "${ED}"/${cudadir}/targets/x86_64-linux/lib/lib64 || die
+
+ newenvd - 99cuda <<-EOF
+ PATH=${ecudadir}/bin${pathextradirs}
+ ROOTPATH=${ecudadir}/bin
+ LDPATH=${ecudadir}/lib64:${ecudadir}/nvvm/lib64${ldpathextradirs}
+ EOF
+
+ # Cuda prepackages libraries, don't revdep-build on them
+ insinto /etc/revdep-rebuild
+ newins - 80${PN} <<-EOF
+ SEARCH_DIRS_MASK="${ecudadir}"
+ EOF
+ # TODO: Add pkgconfig files for installed libraries
+}
+
+pkg_postinst_check() {
+ local a="$("${EROOT}"/opt/cuda/bin/cuda-config -s)"
+ local b="0.0"
+ local v
+ for v in ${a}; do
+ ver_test "${v}" -gt "${b}" && b="${v}"
+ done
+
+ # if gcc and if not gcc-version is at least greatest supported
+ if tc-is-gcc && \
+ ver_test $(gcc-version) -gt "${b}"; then
+ ewarn
+ ewarn "gcc > ${b} will not work with CUDA"
+ ewarn "Make sure you set an earlier version of gcc with gcc-config"
+ ewarn "or append --compiler-bindir= pointing to a gcc bindir like"
+ ewarn "--compiler-bindir=${EPREFIX}/usr/*pc-linux-gnu/gcc-bin/gcc${b}"
+ ewarn "to the nvcc compiler flags"
+ ewarn
+ fi
+}
+
+pkg_postinst() {
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ pkg_postinst_check
+ fi
+
+ if use profiler || use nsight; then
+ einfo
+ einfo "nvidia-drivers restrict access to performance counters."
+ einfo "You'll need to either run profiling tools (nvprof, nsight) "
+ einfo "using sudo (needs cap SYS_ADMIN) or add the following line to "
+ einfo "a modprobe configuration file "
+ einfo "(e.g. /etc/modprobe.d/nvidia-prof.conf): "
+ einfo
+ einfo "options nvidia NVreg_RestrictProfilingToAdminUsers=0"
+ einfo
+ fi
+}