From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 81FAF1581EE for ; Sat, 05 Apr 2025 00:42:16 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 6C2FA343258 for ; Sat, 05 Apr 2025 00:42:16 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id BA08C1104B6; Sat, 05 Apr 2025 00:42:11 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id AFFD91104B6 for ; Sat, 05 Apr 2025 00:42:11 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 61752343188 for ; Sat, 05 Apr 2025 00:42:11 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id C14802777 for ; Sat, 05 Apr 2025 00:42:09 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1743813555.cbbd82c6cb40aa6c1e36515427bd7ef4cc65d6f6.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/nvidia-cuda-toolkit/ X-VCS-Repository: repo/gentoo X-VCS-Files: dev-util/nvidia-cuda-toolkit/Manifest dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-12.8.1.ebuild X-VCS-Directories: dev-util/nvidia-cuda-toolkit/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: cbbd82c6cb40aa6c1e36515427bd7ef4cc65d6f6 X-VCS-Branch: master Date: Sat, 05 Apr 2025 00:42:09 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: d82aff47-97f7-4059-842d-4532cf4c8867 X-Archives-Hash: dcbbaa6b10a3ef582302d5f5f7c9d4e3 commit: cbbd82c6cb40aa6c1e36515427bd7ef4cc65d6f6 Author: Paul Zander gmail com> AuthorDate: Thu Apr 3 14:46:03 2025 +0000 Commit: Sam James gentoo org> CommitDate: Sat Apr 5 00:39:15 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cbbd82c6 dev-util/nvidia-cuda-toolkit: add 12.8.1 Signed-off-by: Paul Zander gmail.com> Signed-off-by: Sam James gentoo.org> dev-util/nvidia-cuda-toolkit/Manifest | 2 + .../nvidia-cuda-toolkit-12.8.1.ebuild | 380 +++++++++++++++++++++ 2 files changed, 382 insertions(+) diff --git a/dev-util/nvidia-cuda-toolkit/Manifest b/dev-util/nvidia-cuda-toolkit/Manifest index 3b7a5246a513..e0a9986d4ca6 100644 --- a/dev-util/nvidia-cuda-toolkit/Manifest +++ b/dev-util/nvidia-cuda-toolkit/Manifest @@ -7,3 +7,5 @@ DIST cuda_12.6.3_560.35.05_linux.run 4446722669 BLAKE2B 9ff67a3fca58af6fcb259a5b DIST cuda_12.6.3_560.35.05_linux_sbsa.run 3760696924 BLAKE2B 06d2ce57911fd73dd64db8bb864b85f0f52a1f21382ac79e681cf4e55302ae57b700cf7a0943fee9924ff6024f056021acec50e3d90c9ee853c0d61121686603 SHA512 ad20647c8dd72937ba74c31c6e04b75d717c16a851972ba2da78cfe11453586702b28a1383f589e4c67825588c29924f87abae9cde964c41a59cf5fe43e7c632 DIST cuda_12.8.0_570.86.10_linux.run 5412604598 BLAKE2B 21ea184fd428ea638934788847e023213c38c1079d489d04bbd1ca277d1c285d57a7ac9c02020cbd73970e703daeec9e806831cf54a427cff90fc036c4da7705 SHA512 7939552d38c39b184946df455233eb9ffe91051656b3091b0414b2acc2939bc35dd92724b584e507976c3b4cd51f489abee2e2d0da27bfebaf8999c3f2c2bb2e DIST cuda_12.8.0_570.86.10_linux_sbsa.run 4636253689 BLAKE2B 53df0ee05a9563bf9db1b813a75d4a81c391cf67c24bc0b9fadf74809ebf1534cbf5762317e2f04e4e7482adf97612d8d3f16d78146abe715a9dc4b8654a1bbf SHA512 bcd91a914d09e72a2f2320d9912a3928a491c8d7062f65d027bc172630944bc0fc319ef2ded10e3c4ade564cf2a4f9a166698dca1d493632ee7ef7ff5d7f1ad5 +DIST cuda_12.8.1_570.124.06_linux.run 5382238770 BLAKE2B 6dff4eb32e97f960bdb2bd57d0dbf0920a9f85c19c26199adcac64eb9d30d7b6f6e2691c7a7a0b5b8249c7860cc685931080a3775c804f6e4e3294c43380e94f SHA512 2ac14ba054bf01924e1953053850f679ebdbc2b9150715398365464eae9d686cde2b82abb8f385b74e4eafa8d68421a9ea216c7647c08956ccba8b2299b50a6e +DIST cuda_12.8.1_570.124.06_linux_sbsa.run 4606631442 BLAKE2B 142c3a231f2a621c4d6a74059b72125baca83d2653ba95c726e3e3c12cf8a0a6b75ced7c0bdaa98450c3d2c2224e88886598191b594ac69be52ba5765bb30592 SHA512 108a75e0ca098b0fd514b3380d42b4752669201dcd68c41f2c1ecf9f29c216ac5937fa33d60e11be06e8a2ad8ae73aa49e6685a363ea77af943e1a1b936b8349 diff --git a/dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-12.8.1.ebuild b/dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-12.8.1.ebuild new file mode 100644 index 000000000000..23b0993b2eb8 --- /dev/null +++ b/dev-util/nvidia-cuda-toolkit/nvidia-cuda-toolkit-12.8.1.ebuild @@ -0,0 +1,380 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# shellcheck disable=SC2317 + +EAPI=8 + +PYTHON_COMPAT=( python3_{10..13} ) +inherit check-reqs toolchain-funcs +inherit python-r1 + +DRIVER_PV="570.124.06" +GCC_MAX_VER="14" +CLANG_MAX_VER="19" + +DESCRIPTION="NVIDIA CUDA Toolkit (compiler and friends)" +HOMEPAGE="https://developer.nvidia.com/cuda-zone" +SRC_URI=" + amd64? ( + https://developer.download.nvidia.com/compute/cuda/${PV}/local_installers/cuda_${PV}_${DRIVER_PV}_linux.run + ) + arm64? ( + https://developer.download.nvidia.com/compute/cuda/${PV}/local_installers/cuda_${PV}_${DRIVER_PV}_linux_sbsa.run + ) +" +S="${WORKDIR}" + +LICENSE="NVIDIA-CUDA" + +SLOT="0/${PV}" # UNSLOTTED +# SLOT="${PV}" # SLOTTED + +KEYWORDS="-* ~amd64 ~arm64 ~amd64-linux ~arm64-linux" +IUSE="debugger examples profiler rdma sanitizer" +RESTRICT="bindist mirror strip test" + +REQUIRED_USE="${PYTHON_REQUIRED_USE}" + +# since CUDA 11, the bundled toolkit driver (== ${DRIVER_PV}) and the +# actual required minimum driver version are different. +RDEPEND=" + || ( + /dev/null || die + eapply -p5 "${FILESDIR}/nvidia-cuda-toolkit-glibc-2.41-r1.patch" + popd >/dev/null || die + + default +} + +src_configure() { + : +} + +src_compile() { + : +} + +src_install() { + local -x SKIP_COMPONENTS=( + "Kernel_Objects" + "Visual_Tools" + "Documentation" # obsolete + "cuda-gdb-src" # not used + ) + + ! use debugger && SKIP_COMPONENTS+=( "cuda-gdb" ) + ! use examples && SKIP_COMPONENTS+=( "Demo_Suite" ) + ! use profiler && SKIP_COMPONENTS+=( "cuda-cupti" "cuda-profiler-api" "nvprof" ) + ! use sanitizer && SKIP_COMPONENTS+=( "compute-sanitizer" ) + + dodir "${CUDA_PATH}" + into "${CUDA_PATH}" + + dofile() { + debug-print-function "${FUNCNAME[0]}" "$@" + + if [[ $# -ne 1 ]] && [[ $# -ne 2 ]]; then + die "${FUNCNAME[0]} must receive one or two arguments" + fi + + local _DESTDIR + _DESTDIR="$(dirname "${CUDA_PATH}/${1%/}")${2:+/${2%/}}" + mkdir -p "${ED}${_DESTDIR}" || die "mkdir ${_DESTDIR} failed" + + local dir + dir="$(dirname "${1}")" + + if test -z "$(find "${dir}" -maxdepth 1 -name "$(basename "$1")" -print -quit)"; then + if [[ -e "${ED}${_DESTDIR}/$(basename "${1}")" ]]; then + return + fi + if [[ "$1" == "targets/x86_64-linux/lib/stubs/libcusolverMg*" ]] || + [[ "$1" == "targets/x86_64-linux/lib/libcusparse.so.*" ]]; then + return + fi + return + fi + + if [[ -e "${ED}${_DESTDIR}/$(basename "${1}")" ]]; then + # skip noisy warnings + if [[ "$(basename "${1}")" == "include" ]] || + [[ "$(basename "${1}")" == "lib64" ]]; then + return + fi + eqawarn "${ED}${_DESTDIR}/$(basename "${1}") exists" + return + fi + + eval mv -i "${1}" "${ED}${_DESTDIR}" || die "mv failed ${PWD} / ${1} -> ${ED} ${_DESTDIR}" + } + + dopcfile() { + [[ $# -eq 0 ]] && return + + dodir "${CUDA_PATH}/pkgconfig" + cat > "${ED}${CUDA_PATH}/pkgconfig/${1}-${2}.pc" <<-EOF || die "dopcfile" + cudaroot=${EPREFIX}${CUDA_PATH} + libdir=\${cudaroot}/targets/${narch}-linux/lib${4} + includedir=\${cudaroot}/targets/${narch}-linux/include + + Name: ${1} + Description: ${3} + Version: ${2} + Libs: -L\${libdir} -l${1} + Cflags: -I\${includedir} + EOF + } + + pushd builds >/dev/null || die + fix_executable_bit=( + cuda_cupti/extras/CUPTI/samples/pc_sampling_utility/pc_sampling_utility_helper.h + cuda_cupti/extras/CUPTI/samples/pc_sampling_continuous/libpc_sampling_continuous.pl + + libcufile/gds/tools/run_gdsio.cfg + ) + + if use amd64; then + fix_executable_bit+=( + cuda_opencl/targets/*/include/CL/cl.hpp + + libcufile/targets/*/lib/libcufile_rdma_static.a + libcufile/targets/*/lib/libcufile_static.a + ) + fi + chmod -x "${fix_executable_bit[@]}" || die "failed chmod" + popd >/dev/null || die + + ebegin "parsing manifest" "${S}/manifests/cuda_"*.xml # {{{ + + "${EPYTHON}" "${FILESDIR}/parse_manifest.py" "${S}/manifests/cuda_"*".xml" &> "${T}/install.sh" \ + || die "failed to parse manifest" + # shellcheck disable=SC1091 + source "${T}/install.sh" || die "failed to source install script" + + eend $? # }}} + + if use debugger; then + if [[ -d "${ED}/${CUDA_PATH}/extras/Debugger/lib64" ]]; then + rmdir "${ED}/${CUDA_PATH}/extras/Debugger/lib64" || die "remove debugger lib64" + fi + + find "${ED}/${CUDA_PATH}/bin" -maxdepth 1 -name "cuda-gdb-*-tui" -print0 | while read -rd $'\0' tui_name; do + impl="$(basename "${tui_name}" | cut -d '-' -f 3 | tr '.' '_')" + + if ! has "${impl}" "${PYTHON_COMPAT[@]}" || ! use "python_targets_${impl}"; then + rm "${tui_name}" || die "tui-name rm ${tui_name}" + sed -e "/$(basename "${tui_name}")\"/d" -i "${ED}/${CUDA_PATH}/bin/cuda-gdb" || die "tui_name sed" + fi + done + fi + + # remove rdma libs (unless USE=rdma) + if ! use rdma; then + rm "${ED}/${CUDA_PATH}/targets/${narch}-linux/lib/libcufile_rdma"* || die "failed to remove rdma files" + fi + + # Add include and lib symlinks + dosym "targets/${narch}-linux/include" "${CUDA_PATH}/include" + dosym "targets/${narch}-linux/lib" "${CUDA_PATH}/lib64" + + find "${ED}/${CUDA_PATH}" -empty -delete || die + + local ldpathextradirs pathextradirs + + use debugger && ldpathextradirs+=":${EPREFIX}${CUDA_PATH}/extras/Debugger/lib64" + use profiler && ldpathextradirs+=":${EPREFIX}${CUDA_PATH}/extras/CUPTI/lib64" + + local revord=$(( 999999 - $(printf "%02d%02d%02d" "$(ver_cut 1)" "$(ver_cut 2)" "$(ver_cut 3)") )) + newenvd - "99cuda${revord}" <<-EOF + PATH=${EPREFIX}${CUDA_PATH}/bin${pathextradirs} + PKG_CONFIG_PATH=${EPREFIX}${CUDA_PATH}/pkgconfig + LDPATH=${EPREFIX}${CUDA_PATH}/lib64:${EPREFIX}${CUDA_PATH}/nvvm/lib64${ldpathextradirs} + EOF + + # CUDA prepackages libraries, don't revdep-build on them + insinto /etc/revdep-rebuild + newins - "80${PN}${revord}" <<-EOF + SEARCH_DIRS_MASK="${EPREFIX}${CUDA_PATH}" + EOF + + # https://bugs.gentoo.org/926116 + insinto /etc/sandbox.d + newins - "80${PN}" <<-EOF + SANDBOX_PREDICT="/proc/self/task" + EOF + + # TODO drop and replace with runtime detection similar to what python does {{{ + # 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.5 10 11 12 13 "${GCC_MAX_VER}" ) + + sed \ + -e "s:CUDA_SUPPORTED_GCC:${cuda_supported_gcc[*]}:g" \ + "${FILESDIR}"/cuda-config.in > "${ED}/${CUDA_PATH}/bin/cuda-config" || die + fperms +x "${CUDA_PATH}/bin/cuda-config" + # }}} + + # skip til cudnn has been changed #950207 + # if [[ "${SLOT}" != "${PV}" ]]; then + # dosym "${CUDA_PATH}" "${CUDA_PATH%"-${PV}"}" + # fi + + fowners -R root:root "${CUDA_PATH}" +} + +pkg_postinst_check() { + if tc-is-gcc && + ver_test "$(gcc-major-version)" -gt "${GCC_MAX_VER}"; then + ewarn + ewarn "gcc > ${GCC_MAX_VER} will not work with CUDA" + ewarn + ewarn "Append --ccbin= pointing to a gcc bindir to the nvcc compiler flags (NVCCFLAGS)" + ewarn "or set NVCC_CCBIN to the same bindir." + ewarn " NVCCFLAGS=\"--ccbin=$(eval echo "${EPREFIX}/usr/*-linux-gnu/gcc-bin/${GCC_MAX_VER}")\"" + ewarn " NVCC_CCBIN=$(eval echo "${EPREFIX}/usr/*-linux-gnu/gcc-bin/${GCC_MAX_VER}")" + ewarn + fi + + if tc-is-clang && + ver_test "$(clang-major-version)" -gt "${CLANG_MAX_VER}"; then + ewarn + ewarn "clang > ${CLANG_MAX_VER} will not work with CUDA" + ewarn + ewarn "Append --ccbin= pointing to a clang bindir to the nvcc compiler flags (NVCCFLAGS)" + ewarn "or set NVCC_CCBIN to the same bindir." + ewarn " NVCCFLAGS=\"--ccbin=$(eval echo "${EPREFIX}/usr/lib/llvm/*/bin${CLANG_MAX_VER}")\"" + ewarn " NVCC_CCBIN=$(eval echo "${EPREFIX}/usr/lib/llvm/*/bin${CLANG_MAX_VER}")" + ewarn + fi +} + +pkg_postinst() { + if [[ ${MERGE_TYPE} != binary ]]; then + pkg_postinst_check + fi + + if use profiler; then + einfo + einfo "nvidia-drivers restricts access to performance counters." + einfo "You'll need to run profiling tools (nvprof) " + 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 +}