mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-23 23:27:12 -08:00
dev-util/nvidia-cuda-toolkit: drop versions
Signed-off-by: David Seifert <soap@gentoo.org>
This commit is contained in:
@@ -1,15 +1,4 @@
|
||||
DIST cuda_11.8.0_520.61.05_linux.run 4336730777 BLAKE2B cfdb4a51c49ee504e56a4a95de4e477ef207b678527cbb633c1e83e667f1a62c0f67038befd0b10f7ae24cda9c8bc5c54293d06a05b2e45be6cf677e40f71f17 SHA512 e96e1389abed34b5093b3a1d4e6ae9f3d4f8406621b1475f378efae65868657efce22da03b5b4e0a548d9635e406b8690b18b17b186d03ecb3ca0703c5d5787a
|
||||
DIST cuda_12.3.2_545.23.08_linux.run 4368514070 BLAKE2B bfb6239b7669636e2ef424921f5a1dd99409a0351ea7d3453fcec3d484e714d87639e733cfae913b0f222d7af8acb7bebae340ea8af53fb7ab320805abb7b230 SHA512 dce569e42955fc351a6b52b2876948029d5183bb000754f0cdcba754673a280acfd4c9e4d8cf61d572ed045de006e0bbb0e8ff32012e6cc336be9c05fd529340
|
||||
DIST cuda_12.4.1_550.54.15_linux.run 4454730420 BLAKE2B 643513a673e72aeab2e0268c4f91b504132aee378e5e483c46803ed9b1b109274e23bce0cd1022de1220e81dbfb0442c9d84370ad9c6a17e14fe2aaff23ccf13 SHA512 340fab9aad2f3e03fb773c2ec1d4f2c3b1428b350c2072b02263f68f3c521b7ec42086ae7b5e66594a0b91862cc165d8519e4c92e428268bc1e98adcfe106d42
|
||||
DIST cuda_12.5.1_555.42.06_linux.run 4311634770 BLAKE2B 3546faeb24687dd11ad0a61a4f02cfbd97119d9e3cd3e24ea294b81ed488de7dfef03607c69d7b5a8087db10cf794205936add7cfa8ccda207e3aca315be48df SHA512 604843e09717c2af0873b2d5a2e242ff1b99122d515b6a7a29e70c55ab605524744359781f5b642059550b4def57877597111914965efe7d3a1a1387c9dbb1a0
|
||||
DIST cuda_12.6.3_560.35.05_linux.run 4446722669 BLAKE2B 9ff67a3fca58af6fcb259a5b114b3babd842290d0ba5d7761ea30d8c7b33d293f86d32f19c252d12bb49e0ff10da9bf62f3c34cc87f0589bab0e134575852bba SHA512 a93d9d812d3a3f5823622e2274d1d6dbe17a298b33463fdf9f6d211d38766eab76608f9d545e312b2be2b86b3c59fcd92c37c54b38b0e8206191563d00546d62
|
||||
DIST cuda_12.6.3_560.35.05_linux_sbsa.run 3760696924 BLAKE2B 06d2ce57911fd73dd64db8bb864b85f0f52a1f21382ac79e681cf4e55302ae57b700cf7a0943fee9924ff6024f056021acec50e3d90c9ee853c0d61121686603 SHA512 ad20647c8dd72937ba74c31c6e04b75d717c16a851972ba2da78cfe11453586702b28a1383f589e4c67825588c29924f87abae9cde964c41a59cf5fe43e7c632
|
||||
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
|
||||
DIST cuda_12.8.2_570.211.01_linux.run 5396612289 BLAKE2B 3c503193d221ba49b819792aab45b3c819070e299917066fb2f6151dbc42ddaf66d6f0bdca67c096ce74e01d4ccba8b7e0211473402855f6075b0004701aebb9 SHA512 bec5d51c8d06f5714e89b8d3f0a43f342e48269d7b9eb1049e0ecd243556b2495ffd575353015bddb0d15b3f20c53df3616807386291194f3570e1051f0769b3
|
||||
DIST cuda_12.8.2_570.211.01_linux_sbsa.run 4621214881 BLAKE2B 5cd6284b81a5db201f0fdc67b9485bada62214cdabbcb239d3e72dfe0968f14eff7414bf6b76d9991f5b336cb8dcb74c8dce8d94294b439ab85b2961d1acc0d3 SHA512 c8b7805110ad82a3e7bff0dc84a3e8bcdbcfa53b2c57543c2e29b9beb49977bbe3362918a99fcfe3ba09f89bc1224938fc5d023bceef372c7f808ea25f79143a
|
||||
DIST cuda_12.9.1_575.57.08_linux.run 5860276058 BLAKE2B 482aee91731ca490956f3cf375e973b15ddcf69b295693d34488958e2592e5c55dabed589aa4f5f4ad59a50ae00b4523e5ebf760a613b634ca00164d363fb567 SHA512 fc29c5fc1121fb6634f1fe396abe7f34d351686454516269e9143e678ea178f906a35b916b8bb2d96ecfcfc705dda7d0f4547f7e7f00d36e392d981a766b6a56
|
||||
DIST cuda_12.9.1_575.57.08_linux_sbsa.run 5074335372 BLAKE2B 71782c3e7e39503aa914c8e02b7e5e44c856bd98bb9d1d46b90dfb7db4a2becb03ed1467fbca34c2ea1147202deb379198495007d69c7987320e138a63f2164e SHA512 91e3b457b6c36c8c3f07ae6fbd24f3f90b9ea22397059f91655ad68c32b96547e2c732af987a0c5ea63c37c43d48f199d97b9e84068c145633ebf67c34465ac6
|
||||
DIST cuda_12.9.2_575.57.08_linux.run 5877673931 BLAKE2B 716c2d0eb161190fb53413f7ba5f20e5d41f08335160988f9ccbb9378959515c072c80521657c94f0b8466be9359da5a93ff6dde2c8fff597a7b7fee3d00e1b7 SHA512 89166ab4aa84e9575deed7ebbddc822e8fdac99e5977ac5e05ec70b1cb06b92275a63f825cbf26a8518b641e3b17ef5a8425a0b6972f5b142260a31ce9487fb9
|
||||
DIST cuda_12.9.2_575.57.08_linux_sbsa.run 5091308573 BLAKE2B 20bef3cd2145ecd4793dbe1c2e049fda086ec753bbad0d28f92e79660addd8fb374dd6581555bc93b6b7bfa9e4d8a9aa9c9dca461db99b5adc766c8fa7a7fb8e SHA512 1f9191145954ae60dd549fb10d543ca2f20bc44576970a92c17a90f894a709296e54f8125f335463cb98eb1c8dcf75593e684b8b4e284e7a52b491e0a90b5785
|
||||
DIST cuda_13.4.1_linux.run 4214651928 BLAKE2B 5155abc196b1a2bb4460ada008c16a54e586eb5c7e4aec57bc087c4e2a95586da999a8b9c91c7d3b4359bfb3d1e8d7359633aa527bccb2f6acb22fd5578d57b9 SHA512 7bb8c38c4403c2e8518a9ba6b1d128f0d5483288537987bb8d0d44e95373e82ce718d1abbe0dfc63ef50375433c600d6b9e183fca93d1439b47eadd24718b828
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
From cae8ab12c9f981f110bb2e1318d9c5306e3a2d81 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Zander <negril.nx@gmail.com>
|
||||
Date: Sat, 8 Feb 2025 16:34:42 +0100
|
||||
Subject: [PATCH] Updates headers for glibc-2.41
|
||||
|
||||
Match the extern definitions in cuda-crt headers with the changes in glibc-2.41.
|
||||
|
||||
/usr/include/bits/mathcalls.h(79): error: exception specification is
|
||||
incompatible with that of previous function "cospi" (declared at line 2601
|
||||
of
|
||||
/opt/cuda-12.8.0/bin/../targets/x86_64-linux/include/crt/math_functions.h)
|
||||
|
||||
extern double cospi (double __x) noexcept (true); extern double __cospi (double __x) noexcept (true);
|
||||
|
||||
/opt/cuda-12.8.1/bin/../targets/x86_64-linux/include/crt/math_functions.hpp:2982:17: error: 'sinpi' is missing exception specification 'throw()'
|
||||
2982 | __func__(double sinpi(double a))
|
||||
| ^
|
||||
| throw()
|
||||
/opt/cuda-12.8.1/bin/../targets/x86_64-linux/include/crt/func_macro.h:37:16: note: expanded from macro '__func__'
|
||||
37 | inline decl
|
||||
| ^
|
||||
/opt/cuda-12.8.1/bin/../targets/x86_64-linux/include/crt/math_functions.h:6006:17: note: previous declaration is here
|
||||
6006 | __func__(double sinpi(double a));
|
||||
|
||||
See-Also: https://sourceware.org/git/?p=glibc.git;a=commit;h=0ae0af68d8fa3bf6cbe1e4f1de5929ff71de67b3
|
||||
Signed-off-by: Paul Zander <negril.nx@gmail.com>
|
||||
|
||||
diff --git a/builds/cuda_nvcc/targets/x86_64-linux/include/crt/math_functions.h b/builds/cuda_nvcc/targets/x86_64-linux/include/crt/math_functions.h
|
||||
index d8201f9..a9b19d4 100644
|
||||
--- a/builds/cuda_nvcc/targets/x86_64-linux/include/crt/math_functions.h
|
||||
+++ b/builds/cuda_nvcc/targets/x86_64-linux/include/crt/math_functions.h
|
||||
@@ -2553,7 +2553,11 @@ extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float rcbrt
|
||||
*
|
||||
* \note_accuracy_double
|
||||
*/
|
||||
+#if defined(__GLIBC__) && (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 41)
|
||||
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double sinpi(double x) noexcept (true);
|
||||
+#else
|
||||
extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double sinpi(double x);
|
||||
+#endif
|
||||
/**
|
||||
* \ingroup CUDA_MATH_SINGLE
|
||||
* \brief Calculate the sine of the input argument
|
||||
@@ -2576,7 +2580,11 @@ extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double sinpi
|
||||
*
|
||||
* \note_accuracy_single
|
||||
*/
|
||||
+#if defined(__GLIBC__) && (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 41)
|
||||
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float sinpif(float x) noexcept (true);
|
||||
+#else
|
||||
extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float sinpif(float x);
|
||||
+#endif
|
||||
/**
|
||||
* \ingroup CUDA_MATH_DOUBLE
|
||||
* \brief Calculate the cosine of the input argument
|
||||
@@ -2598,7 +2606,11 @@ extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float sinpi
|
||||
*
|
||||
* \note_accuracy_double
|
||||
*/
|
||||
+#if defined(__GLIBC__) && (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 41)
|
||||
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double cospi(double x) noexcept (true);
|
||||
+#else
|
||||
extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double cospi(double x);
|
||||
+#endif
|
||||
/**
|
||||
* \ingroup CUDA_MATH_SINGLE
|
||||
* \brief Calculate the cosine of the input argument
|
||||
@@ -2620,7 +2632,11 @@ extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double cospi
|
||||
*
|
||||
* \note_accuracy_single
|
||||
*/
|
||||
+#if defined(__GLIBC__) && (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 41)
|
||||
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float cospif(float x) noexcept (true);
|
||||
+#else
|
||||
extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float cospif(float x);
|
||||
+#endif
|
||||
/**
|
||||
* \ingroup CUDA_MATH_DOUBLE
|
||||
* \brief Calculate the sine and cosine of the first input argument
|
||||
diff --git a/builds/cuda_nvcc/targets/x86_64-linux/include/crt/math_functions.hpp b/builds/cuda_nvcc/targets/x86_64-linux/include/crt/math_functions.hpp
|
||||
index cc09b91..11eec71 100644
|
||||
--- a/builds/cuda_nvcc/targets/x86_64-linux/include/crt/math_functions.hpp
|
||||
+++ b/builds/cuda_nvcc/targets/x86_64-linux/include/crt/math_functions.hpp
|
||||
@@ -2979,7 +2979,7 @@ __func__(double rcbrt(const double a))
|
||||
return t;
|
||||
}
|
||||
|
||||
-__func__(double sinpi(double a))
|
||||
+__func__(double sinpi(double a)) throw()
|
||||
{
|
||||
int n;
|
||||
|
||||
@@ -3009,7 +3009,7 @@ __func__(double sinpi(double a))
|
||||
return a;
|
||||
}
|
||||
|
||||
-__func__(double cospi(double a))
|
||||
+__func__(double cospi(double a)) throw()
|
||||
{
|
||||
int n;
|
||||
|
||||
@@ -3340,12 +3340,12 @@ __func__(float rcbrtf(const float a))
|
||||
return static_cast<float>(rcbrt(static_cast<double>(a)));
|
||||
}
|
||||
|
||||
-__func__(float sinpif(const float a))
|
||||
+__func__(float sinpif(const float a)) throw()
|
||||
{
|
||||
return static_cast<float>(sinpi(static_cast<double>(a)));
|
||||
}
|
||||
|
||||
-__func__(float cospif(const float a))
|
||||
+__func__(float cospif(const float a)) throw()
|
||||
{
|
||||
return static_cast<float>(cospi(static_cast<double>(a)));
|
||||
}
|
||||
--
|
||||
2.48.1
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
From 00713637a617aea1813ba7f09f0ba7de414415b9 Mon Sep 17 00:00:00 2001
|
||||
From: Paul Zander <negril.nx+gentoo@gmail.com>
|
||||
Date: Sun, 10 Aug 2025 12:31:03 +0200
|
||||
Subject: [PATCH] Updates headers for glibc-2.42
|
||||
|
||||
Match the extern definitions in cuda-crt headers with the changes in glibc-2.42.
|
||||
|
||||
/usr/include/bits/mathcalls.h(206): error: exception specification is
|
||||
incompatible with that of previous function "rsqrtf" (declared at line 657 of
|
||||
/opt/cuda/bin/../targets/x86_64-linux/include/crt/math_functions.h)
|
||||
|
||||
extern float rsqrtf (float __x) noexcept (true); extern float __rsqrtf (float
|
||||
__x) noexcept (true);
|
||||
|
||||
See-Also:
|
||||
https://sourceware.org/git/?p=glibc.git;a=commit;h=77261698b4e938020a1b2032709a54d942ba330f
|
||||
Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
|
||||
|
||||
diff --git a/builds/cuda_crt/targets/x86_64-linux/include/crt/math_functions.h b/builds/cuda_crt/targets/x86_64-linux/include/crt/math_functions.h
|
||||
index 50a6646..d525a86 100644
|
||||
--- a/builds/cuda_crt/targets/x86_64-linux/include/crt/math_functions.h
|
||||
+++ b/builds/cuda_crt/targets/x86_64-linux/include/crt/math_functions.h
|
||||
@@ -626,7 +626,11 @@ extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double __cdecl sqrt(
|
||||
*
|
||||
* \note_accuracy_double
|
||||
*/
|
||||
+#if defined(__GLIBC__) && (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 42)
|
||||
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double rsqrt(double x) noexcept (true);
|
||||
+#else
|
||||
extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double rsqrt(double x);
|
||||
+#endif
|
||||
|
||||
/**
|
||||
* \ingroup CUDA_MATH_SINGLE
|
||||
@@ -650,7 +654,11 @@ extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ double rsqrt
|
||||
*
|
||||
* \note_accuracy_single
|
||||
*/
|
||||
+#if defined(__GLIBC__) && (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 42)
|
||||
+extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float rsqrtf(float x) noexcept (true);
|
||||
+#else
|
||||
extern __DEVICE_FUNCTIONS_DECL__ __device_builtin__ float rsqrtf(float x);
|
||||
+#endif
|
||||
|
||||
#if defined(__QNX__) && !defined(_LIBCPP_VERSION)
|
||||
namespace std {
|
||||
--
|
||||
2.50.1
|
||||
|
||||
@@ -1,324 +0,0 @@
|
||||
# Copyright 1999-2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit check-reqs toolchain-funcs unpacker
|
||||
|
||||
DRIVER_PV="545.23.08"
|
||||
|
||||
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"
|
||||
IUSE="debugger examples nsight profiler rdma vis-profiler sanitizer"
|
||||
RESTRICT="bindist mirror"
|
||||
|
||||
# since CUDA 11, the bundled toolkit driver (== ${DRIVER_PV}) and the
|
||||
# actual required minimum driver version are different.
|
||||
RDEPEND="
|
||||
<sys-devel/gcc-13_pre[cxx]
|
||||
>=x11-drivers/nvidia-drivers-525.60.13
|
||||
examples? (
|
||||
media-libs/freeglut
|
||||
media-libs/glu
|
||||
)
|
||||
nsight? (
|
||||
dev-libs/libpfm
|
||||
dev-libs/wayland
|
||||
dev-qt/qtwayland:6
|
||||
|| (
|
||||
dev-libs/openssl-compat:1.1.1
|
||||
dev-libs/openssl:0/1.1
|
||||
)
|
||||
media-libs/tiff-compat:4
|
||||
virtual/zlib:=
|
||||
)
|
||||
rdma? ( sys-cluster/rdma-core )
|
||||
vis-profiler? (
|
||||
>=virtual/jre-1.8:*
|
||||
)"
|
||||
BDEPEND="nsight? ( dev-util/patchelf )"
|
||||
|
||||
QA_PREBUILT="opt/cuda/*"
|
||||
CHECKREQS_DISK_BUILD="15000M"
|
||||
|
||||
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.5 10 11 12"
|
||||
|
||||
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 $?
|
||||
|
||||
# remove rdma libs (unless USE=rdma)
|
||||
if ! use rdma; then
|
||||
rm -r "${ED}"/${cudadir}/${ncu_dir}/host/target-linux-x64/CollectX || die
|
||||
fi
|
||||
|
||||
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
|
||||
${nsys_dir}/target-linux-x64/CudaGpuInfoDumper
|
||||
)
|
||||
|
||||
# remove rdma libs (unless USE=rdma)
|
||||
if ! use rdma; then
|
||||
rm -r "${ED}"/${cudadir}/${nsys_dir}/target-linux-x64/CollectX || die
|
||||
fi
|
||||
|
||||
dobin builds/integration/nsight-systems/{nsight-sys,nsys,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
|
||||
|
||||
# fix broken RPATHs
|
||||
patchelf --set-rpath '$ORIGIN' "${ED}"/${cudadir}/${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/{libarrow.so,libparquet.so.500.0.0} || die
|
||||
patchelf --set-rpath '$ORIGIN' "${ED}"/${cudadir}/${nsys_dir}/host-linux-x64/{libarrow.so,libparquet.so.500.0.0} || die
|
||||
|
||||
# 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/lib{crypto,ssl}.so* || die
|
||||
rm "${ED}"/${cudadir}/${nsys_dir}/host-linux-x64/lib{crypto,ssl}.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
|
||||
|
||||
if use examples; then
|
||||
local 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
|
||||
else
|
||||
rm -r "${ED}"/${cudadir}/extras/demo_suite || die
|
||||
fi
|
||||
|
||||
# remove rdma libs (unless USE=rdma)
|
||||
if ! use rdma; then
|
||||
rm "${ED}"/${cudadir}/targets/x86_64-linux/lib/libcufile_rdma* || die
|
||||
fi
|
||||
|
||||
# Add include and lib symlinks
|
||||
dosym targets/x86_64-linux/include ${cudadir}/include
|
||||
dosym targets/x86_64-linux/lib ${cudadir}/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
|
||||
|
||||
# https://bugs.gentoo.org/926116
|
||||
insinto /etc/sandbox.d
|
||||
newins - 80${PN} <<-EOF
|
||||
SANDBOX_PREDICT="/proc/self/task"
|
||||
EOF
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
@@ -1,326 +0,0 @@
|
||||
# Copyright 1999-2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit check-reqs toolchain-funcs unpacker
|
||||
|
||||
DRIVER_PV="550.54.15"
|
||||
|
||||
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"
|
||||
IUSE="debugger examples nsight profiler rdma vis-profiler sanitizer"
|
||||
RESTRICT="bindist mirror"
|
||||
|
||||
# since CUDA 11, the bundled toolkit driver (== ${DRIVER_PV}) and the
|
||||
# actual required minimum driver version are different.
|
||||
RDEPEND="
|
||||
<sys-devel/gcc-14_pre[cxx]
|
||||
>=x11-drivers/nvidia-drivers-525.60.13
|
||||
examples? (
|
||||
media-libs/freeglut
|
||||
media-libs/glu
|
||||
)
|
||||
nsight? (
|
||||
dev-libs/libpfm
|
||||
dev-libs/wayland
|
||||
dev-qt/qtwayland:6
|
||||
|| (
|
||||
dev-libs/openssl-compat:1.1.1
|
||||
dev-libs/openssl:0/1.1
|
||||
)
|
||||
media-libs/tiff-compat:4
|
||||
virtual/zlib:=
|
||||
)
|
||||
rdma? ( sys-cluster/rdma-core )
|
||||
vis-profiler? (
|
||||
>=virtual/jre-1.8:*
|
||||
)"
|
||||
BDEPEND="nsight? ( dev-util/patchelf )"
|
||||
|
||||
QA_PREBUILT="opt/cuda/*"
|
||||
CHECKREQS_DISK_BUILD="15000M"
|
||||
|
||||
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.5 10 11 12 13"
|
||||
|
||||
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 $?
|
||||
|
||||
# remove rdma libs (unless USE=rdma)
|
||||
if ! use rdma; then
|
||||
rm -r "${ED}"/${cudadir}/${ncu_dir}/host/target-linux-x64/CollectX || die
|
||||
fi
|
||||
|
||||
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
|
||||
${nsys_dir}/target-linux-x64/CudaGpuInfoDumper
|
||||
)
|
||||
|
||||
# remove rdma libs (unless USE=rdma)
|
||||
if ! use rdma; then
|
||||
rm -r "${ED}"/${cudadir}/${nsys_dir}/target-linux-x64/CollectX || die
|
||||
fi
|
||||
|
||||
dobin builds/integration/nsight-systems/{nsight-sys,nsys,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
|
||||
|
||||
# fix broken RPATHs
|
||||
patchelf --set-rpath '$ORIGIN' \
|
||||
"${ED}"/${cudadir}/${ncu_dir}/host/linux-desktop-glibc_2_11_3-x64/{libarrow.so,libparquet.so.500.0.0} || die
|
||||
patchelf --set-rpath '$ORIGIN' \
|
||||
"${ED}"/${cudadir}/${nsys_dir}/host-linux-x64/{libarrow.so,libparquet.so.500.0.0} || die
|
||||
|
||||
# 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/lib{crypto,ssl}.so* || die
|
||||
rm "${ED}"/${cudadir}/${nsys_dir}/host-linux-x64/lib{crypto,ssl}.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
|
||||
|
||||
if use examples; then
|
||||
local 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
|
||||
else
|
||||
rm -r "${ED}"/${cudadir}/extras/demo_suite || die
|
||||
fi
|
||||
|
||||
# remove rdma libs (unless USE=rdma)
|
||||
if ! use rdma; then
|
||||
rm "${ED}"/${cudadir}/targets/x86_64-linux/lib/libcufile_rdma* || die
|
||||
fi
|
||||
|
||||
# Add include and lib symlinks
|
||||
dosym targets/x86_64-linux/include ${cudadir}/include
|
||||
dosym targets/x86_64-linux/lib ${cudadir}/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
|
||||
|
||||
# https://bugs.gentoo.org/926116
|
||||
insinto /etc/sandbox.d
|
||||
newins - 80${PN} <<-EOF
|
||||
SANDBOX_PREDICT="/proc/self/task"
|
||||
EOF
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
@@ -1,328 +0,0 @@
|
||||
# Copyright 1999-2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit check-reqs toolchain-funcs unpacker
|
||||
|
||||
DRIVER_PV="555.42.06"
|
||||
|
||||
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"
|
||||
IUSE="debugger examples nsight profiler rdma vis-profiler sanitizer"
|
||||
RESTRICT="bindist mirror"
|
||||
|
||||
# since CUDA 11, the bundled toolkit driver (== ${DRIVER_PV}) and the
|
||||
# actual required minimum driver version are different.
|
||||
RDEPEND="
|
||||
<sys-devel/gcc-14_pre[cxx]
|
||||
virtual/libcrypt
|
||||
examples? (
|
||||
media-libs/freeglut
|
||||
media-libs/glu
|
||||
)
|
||||
nsight? (
|
||||
app-crypt/mit-krb5
|
||||
dev-libs/libpfm
|
||||
dev-libs/wayland
|
||||
dev-qt/qtwayland:6
|
||||
>=dev-libs/openssl-3
|
||||
media-libs/tiff-compat:4
|
||||
virtual/zlib:=
|
||||
)
|
||||
rdma? ( sys-cluster/rdma-core )
|
||||
vis-profiler? (
|
||||
>=virtual/jre-1.8:*
|
||||
)"
|
||||
BDEPEND="nsight? ( dev-util/patchelf )"
|
||||
|
||||
QA_PREBUILT="opt/cuda/*"
|
||||
CHECKREQS_DISK_BUILD="15000M"
|
||||
|
||||
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.5 10 11 12 13"
|
||||
|
||||
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 $?
|
||||
|
||||
# remove rdma libs (unless USE=rdma)
|
||||
if ! use rdma; then
|
||||
rm -r "${ED}"/${cudadir}/${ncu_dir}/host/target-linux-x64/CollectX || die
|
||||
fi
|
||||
|
||||
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
|
||||
${nsys_dir}/target-linux-x64/CudaGpuInfoDumper
|
||||
)
|
||||
|
||||
# remove rdma libs (unless USE=rdma)
|
||||
if ! use rdma; then
|
||||
rm -r "${ED}"/${cudadir}/${nsys_dir}/target-linux-x64/CollectX || die
|
||||
fi
|
||||
|
||||
dobin builds/integration/nsight-systems/{nsight-sys,nsys,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
|
||||
|
||||
# fix broken RPATHs
|
||||
patchelf --set-rpath '$ORIGIN' \
|
||||
"${ED}"/${cudadir}/${ncu_dir}/host/{linux-desktop-glibc_2_11_3-x64,target-linux-x64}/{libarrow.so,libparquet.so.500.0.0} || die
|
||||
patchelf --set-rpath '$ORIGIN' \
|
||||
"${ED}"/${cudadir}/${nsys_dir}/{host-linux-x64,target-linux-x64}/{libarrow.so,libparquet.so.500.0.0} || die
|
||||
|
||||
# remove foreign archs (triggers SONAME warning, #749903)
|
||||
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/lib{crypto,ssl}.so* || die
|
||||
rm "${ED}"/${cudadir}/${nsys_dir}/host-linux-x64/lib{crypto,ssl}.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
|
||||
|
||||
if use examples; then
|
||||
local 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
|
||||
else
|
||||
rm -r "${ED}"/${cudadir}/extras/demo_suite || die
|
||||
fi
|
||||
|
||||
# remove rdma libs (unless USE=rdma)
|
||||
if ! use rdma; then
|
||||
rm "${ED}"/${cudadir}/targets/x86_64-linux/lib/libcufile_rdma* || die
|
||||
fi
|
||||
|
||||
# Add include and lib symlinks
|
||||
dosym targets/x86_64-linux/include ${cudadir}/include
|
||||
dosym targets/x86_64-linux/lib ${cudadir}/lib64
|
||||
|
||||
# Remove bad symlinks
|
||||
rm "${ED}"/${cudadir}/targets/x86_64-linux/include/include || die
|
||||
rm "${ED}"/${cudadir}/targets/x86_64-linux/lib/lib64 || die
|
||||
|
||||
# Remove dead gdb plugins
|
||||
if use debugger; then
|
||||
rm "${ED}"/${cudadir}/bin/cuda-gdb-python3.{8,9}-tui || die
|
||||
fi
|
||||
|
||||
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
|
||||
|
||||
# https://bugs.gentoo.org/926116
|
||||
insinto /etc/sandbox.d
|
||||
newins - 80${PN} <<-EOF
|
||||
SANDBOX_PREDICT="/proc/self/task"
|
||||
EOF
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
@@ -1,386 +0,0 @@
|
||||
# Copyright 1999-2026 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
|
||||
EAPI=8
|
||||
|
||||
PYTHON_COMPAT=( python3_{12..14} )
|
||||
inherit check-reqs edo toolchain-funcs
|
||||
inherit python-r1
|
||||
|
||||
DRIVER_PV="560.35.05"
|
||||
GCC_MAX_VER="13"
|
||||
CLANG_MAX_VER="18"
|
||||
|
||||
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"
|
||||
IUSE="clang debugger examples nsight 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="
|
||||
!clang? (
|
||||
<sys-devel/gcc-$(( GCC_MAX_VER + 1 ))_pre[cxx]
|
||||
)
|
||||
clang? (
|
||||
<llvm-core/clang-$(( CLANG_MAX_VER + 1 ))_pre
|
||||
)
|
||||
sys-process/numactl
|
||||
debugger? (
|
||||
${PYTHON_DEPS}
|
||||
)
|
||||
examples? (
|
||||
media-libs/freeglut
|
||||
media-libs/glu
|
||||
)
|
||||
nsight? (
|
||||
dev-util/nsight-compute
|
||||
dev-util/nsight-systems
|
||||
)
|
||||
rdma? (
|
||||
sys-cluster/rdma-core
|
||||
)
|
||||
"
|
||||
BDEPEND="
|
||||
$(python_gen_any_dep '
|
||||
dev-python/defusedxml[${PYTHON_USEDEP}]
|
||||
')
|
||||
"
|
||||
|
||||
# CUDA_PATH="/opt/cuda-${PV}" #950207
|
||||
CUDA_PATH="/opt/cuda"
|
||||
QA_PREBUILT="${CUDA_PATH#/}/*"
|
||||
|
||||
python_check_deps() {
|
||||
python_has_version "dev-python/defusedxml[${PYTHON_USEDEP}]"
|
||||
}
|
||||
|
||||
cuda-toolkit_check_reqs() {
|
||||
if use amd64; then
|
||||
export CHECKREQS_DISK_BUILD="4908M"
|
||||
elif use arm64; then
|
||||
export CHECKREQS_DISK_BUILD="4852M"
|
||||
fi
|
||||
|
||||
"check-reqs_pkg_${EBUILD_PHASE}"
|
||||
}
|
||||
|
||||
cuda_verify() {
|
||||
# only works with unpacked sources
|
||||
[[ "${EBUILD_PHASE}" != prepare ]] && return
|
||||
|
||||
# run self checks
|
||||
local compiler_versions GCC_HAS_VER CLANG_HAS_VER
|
||||
compiler_versions="$(
|
||||
grep -oP "unsupported (GNU|clang) version.*(gcc versions later than|clang version must be less than) [0-9]*" \
|
||||
"${S}"/builds/cuda_nvcc/targets/*/include/crt/host_config.h
|
||||
)"
|
||||
|
||||
GCC_HAS_VER="$( echo "${compiler_versions}" | grep gcc | grep -oP "(?<=than )[0-9]*")"
|
||||
if [[ "${GCC_MAX_VER}" -ne "${GCC_HAS_VER}" ]]; then
|
||||
eqawarn "check GCC_MAX_VER is ${GCC_MAX_VER} and should be ${GCC_HAS_VER}"
|
||||
fi
|
||||
|
||||
CLANG_HAS_VER="$(( $(echo "${compiler_versions}" | grep clang | grep -oP "(?<=than )[0-9]*") - 1 ))"
|
||||
if [[ "${CLANG_MAX_VER}" -ne "${CLANG_HAS_VER}" ]]; then
|
||||
eqawarn "check CLANG_MAX_VER is ${CLANG_MAX_VER} and should be ${CLANG_HAS_VER}"
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_pretend() {
|
||||
cuda-toolkit_check_reqs
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
cuda-toolkit_check_reqs
|
||||
|
||||
if [[ "${MERGE_TYPE}" == binary ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# we need python for manifest parsing and to determine the supported python versions for cuda-gdb
|
||||
python_setup
|
||||
|
||||
if use amd64; then
|
||||
narch=x86_64
|
||||
elif use arm64; then
|
||||
narch=sbsa
|
||||
else
|
||||
die "unknown arch ${ARCH}"
|
||||
fi
|
||||
|
||||
export narch
|
||||
}
|
||||
|
||||
src_unpack() {
|
||||
cuda_verify
|
||||
|
||||
local exclude=(
|
||||
"cuda-installer"
|
||||
"*-uninstaller"
|
||||
"NVIDIA-Linux-${narch}-${DRIVER_PV}.run"
|
||||
"builds/cuda_documentation"
|
||||
"builds/cuda_nsight"
|
||||
"builds/cuda_nvvp"
|
||||
"builds/nsight_compute"
|
||||
"builds/nsight_systems"
|
||||
"builds/nvidia_fs"
|
||||
)
|
||||
|
||||
edob -m "Extracting ${A}" \
|
||||
bash "${DISTDIR}/${A}" --tar xf -X <(printf "%s\n" "${exclude[@]}")
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
pushd "builds/cuda_nvcc/targets/${narch}-linux" >/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}.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 -r "${CUDA_PATH}/targets/${narch}-linux/include" "${CUDA_PATH}/include"
|
||||
dosym -r "${CUDA_PATH}/targets/${narch}-linux/lib" "${CUDA_PATH}/$(get_libdir)"
|
||||
|
||||
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}/$(get_libdir):${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 -r "${CUDA_PATH}" "${CUDA_PATH%"-${PV}"}"
|
||||
# fi
|
||||
|
||||
fowners -R root:root "${CUDA_PATH}"
|
||||
}
|
||||
|
||||
pkg_postinst_check() {
|
||||
# Due to requiring specific compiler versions here, we check more then we have to, for the sake of clarity.
|
||||
# tc-getCC defaults to gcc, so clang-major-version is checked using gcc and fails on gcc-profiles. # 959420
|
||||
# We therefore force gcc and clang for the check.
|
||||
|
||||
if tc-is-gcc || ! use clang; then
|
||||
if ver_test "$(CC=gcc 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
|
||||
fi
|
||||
|
||||
if tc-is-clang || use clang; then
|
||||
if ver_test "$(CC=clang 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/${CLANG_MAX_VER}/bin")\""
|
||||
ewarn " NVCC_CCBIN=$(eval echo "${EPREFIX}/usr/lib/llvm/${CLANG_MAX_VER}/bin")"
|
||||
ewarn
|
||||
fi
|
||||
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
|
||||
}
|
||||
@@ -1,386 +0,0 @@
|
||||
# Copyright 1999-2026 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
|
||||
EAPI=8
|
||||
|
||||
PYTHON_COMPAT=( python3_{12..14} )
|
||||
inherit check-reqs edo 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"
|
||||
IUSE="clang debugger examples nsight 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="
|
||||
!clang? (
|
||||
<sys-devel/gcc-$(( GCC_MAX_VER + 1 ))_pre[cxx]
|
||||
)
|
||||
clang? (
|
||||
<llvm-core/clang-$(( CLANG_MAX_VER + 1 ))_pre
|
||||
)
|
||||
sys-process/numactl
|
||||
debugger? (
|
||||
${PYTHON_DEPS}
|
||||
)
|
||||
examples? (
|
||||
media-libs/freeglut
|
||||
media-libs/glu
|
||||
)
|
||||
nsight? (
|
||||
dev-util/nsight-compute
|
||||
dev-util/nsight-systems
|
||||
)
|
||||
rdma? (
|
||||
sys-cluster/rdma-core
|
||||
)
|
||||
"
|
||||
BDEPEND="
|
||||
$(python_gen_any_dep '
|
||||
dev-python/defusedxml[${PYTHON_USEDEP}]
|
||||
')
|
||||
"
|
||||
|
||||
# CUDA_PATH="/opt/cuda-${PV}" #950207
|
||||
CUDA_PATH="/opt/cuda"
|
||||
QA_PREBUILT="${CUDA_PATH#/}/*"
|
||||
|
||||
python_check_deps() {
|
||||
python_has_version "dev-python/defusedxml[${PYTHON_USEDEP}]"
|
||||
}
|
||||
|
||||
cuda-toolkit_check_reqs() {
|
||||
if use amd64; then
|
||||
export CHECKREQS_DISK_BUILD="6608M"
|
||||
elif use arm64; then
|
||||
export CHECKREQS_DISK_BUILD="6354M"
|
||||
fi
|
||||
|
||||
"check-reqs_pkg_${EBUILD_PHASE}"
|
||||
}
|
||||
|
||||
cuda_verify() {
|
||||
# only works with unpacked sources
|
||||
[[ "${EBUILD_PHASE}" != prepare ]] && return
|
||||
|
||||
# run self checks
|
||||
local compiler_versions GCC_HAS_VER CLANG_HAS_VER
|
||||
compiler_versions="$(
|
||||
grep -oP "unsupported (GNU|clang) version.*(gcc versions later than|clang version must be less than) [0-9]*" \
|
||||
"${S}"/builds/cuda_nvcc/targets/*/include/crt/host_config.h
|
||||
)"
|
||||
|
||||
GCC_HAS_VER="$( echo "${compiler_versions}" | grep gcc | grep -oP "(?<=than )[0-9]*")"
|
||||
if [[ "${GCC_MAX_VER}" -ne "${GCC_HAS_VER}" ]]; then
|
||||
eqawarn "check GCC_MAX_VER is ${GCC_MAX_VER} and should be ${GCC_HAS_VER}"
|
||||
fi
|
||||
|
||||
CLANG_HAS_VER="$(( $(echo "${compiler_versions}" | grep clang | grep -oP "(?<=than )[0-9]*") - 1 ))"
|
||||
if [[ "${CLANG_MAX_VER}" -ne "${CLANG_HAS_VER}" ]]; then
|
||||
eqawarn "check CLANG_MAX_VER is ${CLANG_MAX_VER} and should be ${CLANG_HAS_VER}"
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_pretend() {
|
||||
cuda-toolkit_check_reqs
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
cuda-toolkit_check_reqs
|
||||
|
||||
if [[ "${MERGE_TYPE}" == binary ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# we need python for manifest parsing and to determine the supported python versions for cuda-gdb
|
||||
python_setup
|
||||
|
||||
if use amd64; then
|
||||
narch=x86_64
|
||||
elif use arm64; then
|
||||
narch=sbsa
|
||||
else
|
||||
die "unknown arch ${ARCH}"
|
||||
fi
|
||||
|
||||
export narch
|
||||
}
|
||||
|
||||
src_unpack() {
|
||||
cuda_verify
|
||||
|
||||
local exclude=(
|
||||
"cuda-installer"
|
||||
"*-uninstaller"
|
||||
"NVIDIA-Linux-${narch}-${DRIVER_PV}.run"
|
||||
"builds/cuda_documentation"
|
||||
"builds/cuda_nsight"
|
||||
"builds/cuda_nvvp"
|
||||
"builds/nsight_compute"
|
||||
"builds/nsight_systems"
|
||||
"builds/nvidia_fs"
|
||||
)
|
||||
|
||||
edob -m "Extracting ${A}" \
|
||||
bash "${DISTDIR}/${A}" --tar xf -X <(printf "%s\n" "${exclude[@]}")
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
pushd "builds/cuda_nvcc/targets/${narch}-linux" >/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}.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 -r "${CUDA_PATH}/targets/${narch}-linux/include" "${CUDA_PATH}/include"
|
||||
dosym -r "${CUDA_PATH}/targets/${narch}-linux/lib" "${CUDA_PATH}/$(get_libdir)"
|
||||
|
||||
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}/$(get_libdir):${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 -r "${CUDA_PATH}" "${CUDA_PATH%"-${PV}"}"
|
||||
# fi
|
||||
|
||||
fowners -R root:root "${CUDA_PATH}"
|
||||
}
|
||||
|
||||
pkg_postinst_check() {
|
||||
# Due to requiring specific compiler versions here, we check more then we have to, for the sake of clarity.
|
||||
# tc-getCC defaults to gcc, so clang-major-version is checked using gcc and fails on gcc-profiles. # 959420
|
||||
# We therefore force gcc and clang for the check.
|
||||
|
||||
if tc-is-gcc || ! use clang; then
|
||||
if ver_test "$(CC=gcc 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
|
||||
fi
|
||||
|
||||
if tc-is-clang || use clang; then
|
||||
if ver_test "$(CC=clang 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/${CLANG_MAX_VER}/bin")\""
|
||||
ewarn " NVCC_CCBIN=$(eval echo "${EPREFIX}/usr/lib/llvm/${CLANG_MAX_VER}/bin")"
|
||||
ewarn
|
||||
fi
|
||||
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
|
||||
}
|
||||
@@ -1,407 +0,0 @@
|
||||
# Copyright 1999-2026 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
# shellcheck disable=SC2153,SC2154,SC2317,SC2329
|
||||
|
||||
EAPI=8
|
||||
|
||||
PYTHON_COMPAT=( python3_{12..14} )
|
||||
inherit check-reqs edo toolchain-funcs
|
||||
inherit python-r1
|
||||
|
||||
DRIVER_PV="570.211.01"
|
||||
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"
|
||||
IUSE="clang debugger examples nsight 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="
|
||||
!clang? (
|
||||
<sys-devel/gcc-$(( GCC_MAX_VER + 1 ))_pre[cxx]
|
||||
)
|
||||
clang? (
|
||||
<llvm-core/clang-$(( CLANG_MAX_VER + 1 ))_pre
|
||||
)
|
||||
sys-process/numactl
|
||||
debugger? (
|
||||
${PYTHON_DEPS}
|
||||
)
|
||||
examples? (
|
||||
media-libs/freeglut
|
||||
media-libs/glu
|
||||
)
|
||||
nsight? (
|
||||
dev-util/nsight-compute
|
||||
dev-util/nsight-systems
|
||||
)
|
||||
rdma? (
|
||||
sys-cluster/rdma-core
|
||||
)
|
||||
"
|
||||
BDEPEND="
|
||||
$(python_gen_any_dep '
|
||||
dev-python/defusedxml[${PYTHON_USEDEP}]
|
||||
')
|
||||
"
|
||||
|
||||
# CUDA_PATH="/opt/cuda-${PV}" #950207
|
||||
CUDA_PATH="/opt/cuda"
|
||||
QA_PREBUILT="${CUDA_PATH#/}/*"
|
||||
|
||||
python_check_deps() {
|
||||
python_has_version "dev-python/defusedxml[${PYTHON_USEDEP}]"
|
||||
}
|
||||
|
||||
cuda-toolkit_check_reqs() {
|
||||
if use amd64; then
|
||||
local CHECKREQS_DISK_BUILD="6608M"
|
||||
elif use arm64; then
|
||||
local CHECKREQS_DISK_BUILD="6355M"
|
||||
fi
|
||||
|
||||
"check-reqs_pkg_${EBUILD_PHASE}"
|
||||
}
|
||||
|
||||
cuda_verify() {
|
||||
# only works with unpacked sources
|
||||
[[ "${EBUILD_PHASE}" != prepare ]] && return
|
||||
|
||||
# run self checks
|
||||
local compiler_versions GCC_HAS_VER CLANG_HAS_VER
|
||||
compiler_versions="$(
|
||||
grep -oP "unsupported (GNU|clang) version.*(gcc versions later than|clang version must be less than) [0-9]*" \
|
||||
"${S}"/builds/cuda_nvcc/targets/*/include/crt/host_config.h
|
||||
)"
|
||||
|
||||
GCC_HAS_VER="$( echo "${compiler_versions}" | grep gcc | grep -oP "(?<=than )[0-9]*")"
|
||||
if [[ "${GCC_MAX_VER}" -ne "${GCC_HAS_VER}" ]]; then
|
||||
eqawarn "check GCC_MAX_VER is ${GCC_MAX_VER} and should be ${GCC_HAS_VER}"
|
||||
fi
|
||||
|
||||
CLANG_HAS_VER="$(( $(echo "${compiler_versions}" | grep clang | grep -oP "(?<=than )[0-9]*") - 1 ))"
|
||||
if [[ "${CLANG_MAX_VER}" -ne "${CLANG_HAS_VER}" ]]; then
|
||||
eqawarn "check CLANG_MAX_VER is ${CLANG_MAX_VER} and should be ${CLANG_HAS_VER}"
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_pretend() {
|
||||
cuda-toolkit_check_reqs
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
cuda-toolkit_check_reqs
|
||||
|
||||
if [[ "${MERGE_TYPE}" == binary ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# we need python for manifest parsing and to determine the supported python versions for cuda-gdb
|
||||
python_setup
|
||||
|
||||
if use amd64; then
|
||||
narch="x86_64"
|
||||
elif use arm64; then
|
||||
narch="sbsa"
|
||||
else
|
||||
die "unknown arch ${ARCH}"
|
||||
fi
|
||||
|
||||
export narch
|
||||
}
|
||||
|
||||
src_unpack() {
|
||||
cuda_verify
|
||||
|
||||
local exclude=(
|
||||
"cuda-installer"
|
||||
"*-uninstaller"
|
||||
"NVIDIA-Linux-${narch}-${DRIVER_PV}.run"
|
||||
"builds/cuda_documentation"
|
||||
"builds/cuda_nsight"
|
||||
"builds/cuda_nvvp"
|
||||
"builds/nsight_compute"
|
||||
"builds/nsight_systems"
|
||||
"builds/nvidia_fs"
|
||||
)
|
||||
|
||||
edob -m "Extracting ${A}" \
|
||||
bash "${DISTDIR}/${A}" --tar xf -X <(printf "%s\n" "${exclude[@]}")
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
pushd "builds/cuda_nvcc/targets/${narch}-linux" >/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}"
|
||||
|
||||
# Add include and lib symlinks
|
||||
dosym -r "${CUDA_PATH}/targets/${narch}-linux/include" "${CUDA_PATH}/include"
|
||||
dosym -r "${CUDA_PATH}/targets/${narch}-linux/lib" "${CUDA_PATH}/$(get_libdir)"
|
||||
|
||||
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/${narch}-linux/lib/stubs/libcusolverMg*" ]] ||
|
||||
[[ "$1" == "targets/${narch}-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}.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
|
||||
# intentionally -f to support SKIP_COMPONENTS
|
||||
rm -f "${ED}/${CUDA_PATH}/targets/${narch}-linux/lib/libcufile_rdma"* || die "failed to remove rdma files"
|
||||
fi
|
||||
|
||||
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}/$(get_libdir):${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}" )
|
||||
|
||||
mkdir -p "${ED}/${CUDA_PATH}/bin" || die
|
||||
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 -r "${CUDA_PATH}" "${CUDA_PATH%"-${PV}"}"
|
||||
# fi
|
||||
|
||||
fowners -R root:root "${CUDA_PATH}"
|
||||
}
|
||||
|
||||
pkg_postinst_check() {
|
||||
# Due to requiring specific compiler versions here, we check more then we have to, for the sake of clarity.
|
||||
# tc-getCC defaults to gcc, so clang-major-version is checked using gcc and fails on gcc-profiles. # 959420
|
||||
# We therefore force gcc and clang for the check.
|
||||
|
||||
if tc-is-gcc || ! use clang; then
|
||||
if ver_test "$(CC=gcc 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
|
||||
fi
|
||||
|
||||
if tc-is-clang || use clang; then
|
||||
if ver_test "$(CC=clang 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/${CLANG_MAX_VER}/bin")\""
|
||||
ewarn " NVCC_CCBIN=$(eval echo "${EPREFIX}/usr/lib/llvm/${CLANG_MAX_VER}/bin")"
|
||||
ewarn
|
||||
fi
|
||||
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
|
||||
}
|
||||
|
||||
pkg_info () {
|
||||
debugvar () {
|
||||
for i in "$@"; do
|
||||
[[ -v "${i}" ]] && echo "${i}=\"${!i}\""
|
||||
done
|
||||
}
|
||||
debugvar \
|
||||
CUDACXX \
|
||||
CUDAHOSTCXX \
|
||||
CUDAHOSTLD \
|
||||
CUDAARCHS \
|
||||
CUDAFLAGS \
|
||||
CUDA_PATH \
|
||||
CUDA_VERBOSE \
|
||||
NVCCFLAGS \
|
||||
NVCC_PREPEND_FLAGS \
|
||||
NVCC_APPPEND_FLAGS
|
||||
}
|
||||
@@ -1,389 +0,0 @@
|
||||
# Copyright 1999-2026 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
# shellcheck disable=SC2317
|
||||
|
||||
EAPI=8
|
||||
|
||||
PYTHON_COMPAT=( python3_{12..14} )
|
||||
inherit check-reqs edo toolchain-funcs
|
||||
inherit python-r1
|
||||
|
||||
DRIVER_PV="575.57.08"
|
||||
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"
|
||||
IUSE="clang debugger examples nsight 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="
|
||||
!clang? (
|
||||
<sys-devel/gcc-$(( GCC_MAX_VER + 1 ))_pre[cxx]
|
||||
)
|
||||
clang? (
|
||||
<llvm-core/clang-$(( CLANG_MAX_VER + 1 ))_pre
|
||||
)
|
||||
sys-process/numactl
|
||||
debugger? (
|
||||
${PYTHON_DEPS}
|
||||
)
|
||||
examples? (
|
||||
media-libs/freeglut
|
||||
media-libs/glu
|
||||
)
|
||||
nsight? (
|
||||
dev-util/nsight-compute
|
||||
dev-util/nsight-systems
|
||||
)
|
||||
rdma? (
|
||||
sys-cluster/rdma-core
|
||||
)
|
||||
"
|
||||
BDEPEND="
|
||||
$(python_gen_any_dep '
|
||||
dev-python/defusedxml[${PYTHON_USEDEP}]
|
||||
')
|
||||
"
|
||||
|
||||
# CUDA_PATH="/opt/cuda-${PV}" #950207
|
||||
CUDA_PATH="/opt/cuda"
|
||||
QA_PREBUILT="${CUDA_PATH#/}/*"
|
||||
|
||||
python_check_deps() {
|
||||
python_has_version "dev-python/defusedxml[${PYTHON_USEDEP}]"
|
||||
}
|
||||
|
||||
cuda-toolkit_check_reqs() {
|
||||
if use amd64; then
|
||||
export CHECKREQS_DISK_BUILD="7228M"
|
||||
elif use arm64; then
|
||||
export CHECKREQS_DISK_BUILD="6998M"
|
||||
fi
|
||||
|
||||
"check-reqs_pkg_${EBUILD_PHASE}"
|
||||
}
|
||||
|
||||
cuda_verify() {
|
||||
# only works with unpacked sources
|
||||
[[ "${EBUILD_PHASE}" != prepare ]] && return
|
||||
|
||||
# run self checks
|
||||
local compiler_versions GCC_HAS_VER CLANG_HAS_VER
|
||||
compiler_versions="$(
|
||||
grep -oP "unsupported (GNU|clang) version.*(gcc versions later than|clang version must be less than) [0-9]*" \
|
||||
"${S}"/builds/cuda_nvcc/targets/*/include/crt/host_config.h
|
||||
)"
|
||||
|
||||
GCC_HAS_VER="$( echo "${compiler_versions}" | grep gcc | grep -oP "(?<=than )[0-9]*")"
|
||||
if [[ "${GCC_MAX_VER}" -ne "${GCC_HAS_VER}" ]]; then
|
||||
eqawarn "check GCC_MAX_VER is ${GCC_MAX_VER} and should be ${GCC_HAS_VER}"
|
||||
fi
|
||||
|
||||
CLANG_HAS_VER="$(( $(echo "${compiler_versions}" | grep clang | grep -oP "(?<=than )[0-9]*") - 1 ))"
|
||||
if [[ "${CLANG_MAX_VER}" -ne "${CLANG_HAS_VER}" ]]; then
|
||||
eqawarn "check CLANG_MAX_VER is ${CLANG_MAX_VER} and should be ${CLANG_HAS_VER}"
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_pretend() {
|
||||
cuda-toolkit_check_reqs
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
cuda-toolkit_check_reqs
|
||||
|
||||
if [[ "${MERGE_TYPE}" == binary ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# we need python for manifest parsing and to determine the supported python versions for cuda-gdb
|
||||
python_setup
|
||||
|
||||
if use amd64; then
|
||||
narch=x86_64
|
||||
elif use arm64; then
|
||||
narch=sbsa
|
||||
else
|
||||
die "unknown arch ${ARCH}"
|
||||
fi
|
||||
|
||||
export narch
|
||||
}
|
||||
|
||||
src_unpack() {
|
||||
cuda_verify
|
||||
|
||||
local exclude=(
|
||||
"cuda-installer"
|
||||
"*-uninstaller"
|
||||
"NVIDIA-Linux-${narch}-${DRIVER_PV}.run"
|
||||
"builds/cuda_documentation"
|
||||
"builds/cuda_nsight"
|
||||
"builds/cuda_nvvp"
|
||||
"builds/nsight_compute"
|
||||
"builds/nsight_systems"
|
||||
"builds/nvidia_fs"
|
||||
)
|
||||
|
||||
edob -m "Extracting ${A}" \
|
||||
bash "${DISTDIR}/${A}" --tar xf -X <(printf "%s\n" "${exclude[@]}")
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
pushd "builds/cuda_nvcc/targets/${narch}-linux" >/dev/null || die
|
||||
eapply -p5 "${FILESDIR}/nvidia-cuda-toolkit-glibc-2.41-r1.patch"
|
||||
popd >/dev/null || die
|
||||
pushd "builds/cuda_nvcc/targets/${narch}-linux" >/dev/null || die
|
||||
eapply -p5 "${FILESDIR}/nvidia-cuda-toolkit-glibc-2.42.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}.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 -r "${CUDA_PATH}/targets/${narch}-linux/include" "${CUDA_PATH}/include"
|
||||
dosym -r "${CUDA_PATH}/targets/${narch}-linux/lib" "${CUDA_PATH}/$(get_libdir)"
|
||||
|
||||
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}/$(get_libdir):${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 -r "${CUDA_PATH}" "${CUDA_PATH%"-${PV}"}"
|
||||
# fi
|
||||
|
||||
fowners -R root:root "${CUDA_PATH}"
|
||||
}
|
||||
|
||||
pkg_postinst_check() {
|
||||
# Due to requiring specific compiler versions here, we check more then we have to, for the sake of clarity.
|
||||
# tc-getCC defaults to gcc, so clang-major-version is checked using gcc and fails on gcc-profiles. # 959420
|
||||
# We therefore force gcc and clang for the check.
|
||||
|
||||
if tc-is-gcc || ! use clang; then
|
||||
if ver_test "$(CC=gcc 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
|
||||
fi
|
||||
|
||||
if tc-is-clang || use clang; then
|
||||
if ver_test "$(CC=clang 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/${CLANG_MAX_VER}/bin")\""
|
||||
ewarn " NVCC_CCBIN=$(eval echo "${EPREFIX}/usr/lib/llvm/${CLANG_MAX_VER}/bin")"
|
||||
ewarn
|
||||
fi
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user