From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/vtk/
Date: Thu, 5 Dec 2024 18:01:46 +0000 (UTC) [thread overview]
Message-ID: <1733421674.afea716210fdc48b59dfc58f107fc7086b53562b.sam@gentoo> (raw)
commit: afea716210fdc48b59dfc58f107fc7086b53562b
Author: Paul Zander <negril.nx+gentoo <AT> gmail <DOT> com>
AuthorDate: Thu Dec 5 12:16:31 2024 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Dec 5 18:01:14 2024 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=afea7162
sci-libs/vtk: 9.3.1 update cuda handling
Allow cuda-12.6
Closes: https://bugs.gentoo.org/938673
Closes: https://bugs.gentoo.org/930031
Signed-off-by: Paul Zander <negril.nx+gentoo <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>
sci-libs/vtk/vtk-9.3.1.ebuild | 211 +++++++++++++++++++++++++++++++++---------
1 file changed, 165 insertions(+), 46 deletions(-)
diff --git a/sci-libs/vtk/vtk-9.3.1.ebuild b/sci-libs/vtk/vtk-9.3.1.ebuild
index 895bd1487f9e..0eea06d8c49f 100644
--- a/sci-libs/vtk/vtk-9.3.1.ebuild
+++ b/sci-libs/vtk/vtk-9.3.1.ebuild
@@ -51,7 +51,7 @@ REQUIRED_USE="
boost cgns ffmpeg freetype gdal imaging las mysql netcdf odbc opencascade openvdb pdal
postgres rendering views
)
- cuda? ( video_cards_nvidia vtkm !tbb )
+ cuda? ( video_cards_nvidia vtkm )
java? ( rendering )
minimal? ( !rendering )
!minimal? ( cgns netcdf rendering )
@@ -156,6 +156,7 @@ PATCHES=(
"${FILESDIR}/${PN}-9.3.0-opencascade.patch"
"${FILESDIR}/${PN}-9.3.0-ThrustPatches.patch"
"${FILESDIR}/${PN}-9.3.0-ThirdParty-gcc15.patch"
+ "${FILESDIR}/${PN}-9.3.0-update-for-cuda-12.6.patch"
)
DOCS=( CONTRIBUTING.md README.md )
@@ -186,55 +187,154 @@ vtk_check_reqs() {
"check-reqs_pkg_${EBUILD_PHASE}"
}
-vtk_check_compiler() {
- [[ -z "$1" ]] && die "no compiler specified"
- local compiler="$1"
- local package="sys-devel/${compiler}"
- local version="${package}"
- local CUDAHOSTCXX_test
- while
- CUDAHOSTCXX="${CUDAHOSTCXX_test}"
- version=$(best_version "${version}")
- if [[ -z "${version}" ]]; then
- if [[ -z "${CUDAHOSTCXX}" ]]; then
- die "could not find supported version of ${package}"
+cuda_get_host_compiler() {
+ if [[ -n "${NVCC_CCBIN}" ]]; then
+ echo "${NVCC_CCBIN}"
+ return
+ fi
+
+ if [[ -n "${CUDAHOSTCXX}" ]]; then
+ echo "${CUDAHOSTCXX}"
+ return
+ fi
+
+ einfo "Trying to find working CUDA host compiler"
+
+ if ! tc-is-gcc && ! tc-is-clang; then
+ die "$(tc-get-compiler-type) compiler is not supported"
+ fi
+
+ local compiler compiler_type compiler_version
+ local package package_version
+ local NVCC_CCBIN_default
+
+ compiler_type="$(tc-get-compiler-type)"
+ compiler_version="$("${compiler_type}-major-version")"
+
+ # try the default compiler first
+ NVCC_CCBIN="$(tc-getCXX)"
+ NVCC_CCBIN_default="${NVCC_CCBIN}-${compiler_version}"
+
+ compiler="${NVCC_CCBIN/%-${compiler_version}}"
+
+ # store the package so we can re-use it later
+ package="sys-devel/${compiler_type}"
+ package_version="${package}"
+
+ ebegin "testing ${NVCC_CCBIN_default} (default)"
+
+ while ! nvcc -v -ccbin "${NVCC_CCBIN}" - -x cu <<<"int main(){}" &>> "${T}/cuda_get_host_compiler.log" ; do
+ eend 1
+
+ while true; do
+ # prepare next version
+ if ! package_version="<$(best_version "${package_version}")"; then
+ die "could not find a supported version of ${compiler}"
fi
- break
- fi
- CUDAHOSTCXX_test="$(
- dirname "$(
- realpath "$(
- which "${compiler}-$(echo "${version}" | grep -oP "(?<=${package}-)[0-9]*")"
- )"
- )"
+
+ NVCC_CCBIN="${compiler}-$(ver_cut 1 "${package_version/#<${package}-/}")"
+
+ [[ "${NVCC_CCBIN}" != "${NVCC_CCBIN_default}" ]] && break
+ done
+ ebegin "testing ${NVCC_CCBIN}"
+ done
+ eend $?
+
+ # clean temp file
+ rm -f a.out
+
+ echo "${NVCC_CCBIN}"
+ export NVCC_CCBIN
+}
+
+cuda_get_host_native_arch() {
+ [[ -n ${CUDAARCHS} ]] && echo "${CUDAARCHS}"
+
+ __nvcc_device_query || die "failed to query the native device"
+}
+
+vtk_add_sandbox() {
+ local WRITE=()
+
+ # mesa via virtx will make use of udmabuf if it exists
+ [[ -c "/dev/udmabuf" ]] && WRITE+=( "/dev/udmabuf" )
+
+ readarray -t dris <<<"$(
+ for dri in /sys/class/drm/*/dev; do
+ realpath "/dev/char/$(cat "${dri}")"
+ eqawarn "dri ${dri} $(cat "${dri}") $(realpath "/dev/char/$(cat "${dri}")")"
+ done
+ )"
+
+ [[ -n "${dris[*]}" ]] && WRITE+=( "${dris[@]}" )
+
+ if [[ -d /sys/module/nvidia ]]; then
+ # /dev/nvidia{0-9}
+ readarray -t nvidia_devs <<<"$(
+ find /dev -regextype posix-extended -regex '/dev/nvidia(|-(nvswitch|vgpu))[0-9]*'
)"
- version="<${version}"
- do ! echo "int main(){}" | nvcc "-ccbin=${CUDAHOSTCXX_test}" - -x cu &>/dev/null; done
+ [[ -n "${nvidia_devs[*]}" ]] && WRITE+=( "${nvidia_devs[@]}" )
+
+ WRITE+=(
+ "/dev/nvidiactl"
+ "/dev/nvidia-modeset"
+
+ "/dev/nvidia-vgpuctl"
+
+ "/dev/nvidia-nvlink"
+ "/dev/nvidia-nvswitchctl"
+
+ "/dev/nvidia-uvm"
+ "/dev/nvidia-uvm-tools"
+
+ # "/dev/nvidia-caps/nvidia-cap%d"
+ "/dev/nvidia-caps/"
+ # "/dev/nvidia-caps-imex-channels/channel%d"
+ "/dev/nvidia-caps-imex-channels/"
+ )
+ fi
+
+ # for portage
+ WRITE+=( "/proc/self/task/" )
+
+ local dev
+ for dev in "${WRITE[@]}"; do
+ [[ ! -e "${dev}" ]] && return
+
+ [[ -w "${dev}" ]] && return
+
+ eqawarn "addwrite ${dev}"
+ addwrite "${dev}"
+ if [[ ! -d "${dev}" ]] && [[ ! -w "${dev}" ]]; then
+ eerror "can not access ${dev} after addwrite"
+ fi
+ done
}
pkg_pretend() {
[[ ${MERGE_TYPE} != binary ]] && has openmp && tc-check-openmp
- if [[ $(tc-is-gcc) && $(gcc-majorversion) = 11 ]] && use cuda ; then
- # FIXME: better use eerror?
- ewarn "GCC 11 is know to fail building with CUDA support in some cases."
- ewarn "See bug #820593"
- fi
-
vtk_check_reqs
+
+ # When building binpkgs you probably want to include all targets
+ if use cuda && [[ ${MERGE_TYPE} == "buildonly" ]] && [[ -n "${CUDA_GENERATION}" || -n "${CUDA_ARCH_BIN}" ]]; then
+ local info_message="When building a binary package it's recommended to unset CUDA_GENERATION and CUDA_ARCH_BIN"
+ einfo "$info_message so all available architectures are build."
+ fi
}
pkg_setup() {
[[ ${MERGE_TYPE} != binary ]] && has openmp && tc-check-openmp
- if [[ $(tc-is-gcc) && $(gcc-majorversion) = 11 ]] && use cuda ; then
- # FIXME: better use eerror?
- ewarn "GCC 11 is know to fail building with CUDA support in some cases."
- ewarn "See bug #820593"
- fi
-
vtk_check_reqs
+ if use cuda && [[ ! -e /dev/nvidia-uvm ]]; then
+ # NOTE We try to load nvidia-uvm and nvidia-modeset here,
+ # so __nvcc_device_query does not fail later.
+
+ nvidia-modprobe -m -u -c 0 || true
+ fi
+
use java && java-pkg-opt-2_pkg_setup
use python && python-single-r1_pkg_setup
use web && webapp_pkg_setup
@@ -436,15 +536,36 @@ src_configure() {
if use cuda; then
cuda_add_sandbox -w
- tc-is-gcc && vtk_check_compiler "gcc"
- tc-is-clang && vtk_check_compiler "clang"
- [[ -z "${CUDAARCHS}" ]] && einfo "trying to determine host CUDAARCHS"
- : "${CUDAARCHS:=$(__nvcc_device_query)}"
- einfo "building for CUDAARCHS = ${CUDAARCHS}"
+ addwrite "/proc/self/task"
+
+ if ! test -w /dev/nvidiactl; then
+ # eqawarn "Can't access the GPU at /dev/nvidiactl."
+ # eqawarn "User $(id -nu) is not in the group \"video\"."
+ if [[ -z "${CUDA_GENERATION}" ]] && [[ -z "${CUDA_ARCH_BIN}" ]]; then
+ # build all targets
+ mycmakeargs+=(
+ -DCUDA_GENERATION=""
+ )
+ fi
+ else
+ local -x CUDAARCHS
+ : "${CUDAARCHS:="$(cuda_get_host_native_arch)"}"
+ fi
- export CUDAARCHS
- export CUDAHOSTCXX
- unset NVCCFLAGS
+ # set NVCC_CCBIN
+ local -x CUDAHOSTCXX CUDAHOSTLD
+ CUDAHOSTCXX="$(cuda_get_host_compiler)"
+ CUDAHOSTLD="$(tc-getCXX)"
+ export NVCC_CCBIN="${CUDAHOSTCXX}"
+
+ if tc-is-gcc; then
+ # Filter out IMPLICIT_LINK_DIRECTORIES picked up by CMAKE_DETERMINE_COMPILER_ABI(CUDA)
+ # See /usr/share/cmake/Help/variable/CMAKE_LANG_IMPLICIT_LINK_DIRECTORIES.rst
+ CMAKE_CUDA_IMPLICIT_LINK_DIRECTORIES_EXCLUDE=$(
+ "${CUDAHOSTLD}" -E -v - <<<"int main(){}" |& \
+ grep LIBRARY_PATH | cut -d '=' -f 2 | cut -d ':' -f 1
+ )
+ fi
fi
if use debug; then
@@ -695,9 +816,7 @@ src_compile() {
}
src_test() {
- if use cuda; then
- cuda_add_sandbox -w
- fi
+ vtk_add_sandbox
# don't work at all
REALLY_BAD_TESTS=(
next reply other threads:[~2024-12-05 18:02 UTC|newest]
Thread overview: 105+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-05 18:01 Sam James [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-01-07 23:41 [gentoo-commits] repo/gentoo:master commit in: sci-libs/vtk/ Sam James
2025-01-07 23:40 Sam James
2025-01-05 20:35 Sam James
2024-12-05 18:01 Sam James
2024-12-05 18:01 Sam James
2024-12-05 18:01 Sam James
2024-12-05 18:01 Sam James
2024-12-05 18:01 Sam James
2024-12-05 18:01 Sam James
2024-12-05 18:01 Sam James
2024-12-05 18:01 Sam James
2024-12-05 18:01 Sam James
2024-09-07 9:15 Sam James
2024-09-06 20:36 Eli Schwartz
2024-09-04 11:45 Sebastian Pipping
2024-06-01 17:23 Andrew Ammerlaan
2024-05-07 13:12 Andrew Ammerlaan
2024-05-07 12:52 Andrew Ammerlaan
2024-04-12 12:40 Andrew Ammerlaan
2024-04-11 9:54 Andrew Ammerlaan
2024-04-06 6:49 Arthur Zamarin
2024-03-16 16:19 Arthur Zamarin
2023-12-01 9:58 Andrew Ammerlaan
2023-11-16 15:11 Florian Schmaus
2023-06-28 21:11 Sam James
2023-06-28 21:11 Sam James
2023-03-04 13:51 Arthur Zamarin
2023-01-23 9:36 Andrew Ammerlaan
2023-01-23 9:36 Andrew Ammerlaan
2022-12-16 1:40 Sam James
2022-10-12 23:09 Sam James
2022-10-04 14:58 Joonas Niilola
2022-08-23 12:04 Andrew Ammerlaan
2022-06-26 8:49 Sam James
2022-06-26 7:11 Sam James
2022-05-19 12:12 Joonas Niilola
2022-05-18 16:58 Andrew Ammerlaan
2022-05-15 17:11 Andrew Ammerlaan
2022-04-06 17:30 Piotr Karbowski
2022-03-06 0:00 Sam James
2022-01-28 7:53 Sam James
2021-12-14 8:36 Joonas Niilola
2021-12-02 1:25 Sam James
2021-10-29 22:23 Sam James
2021-10-27 15:09 Sam James
2021-09-05 9:54 Andrew Ammerlaan
2021-08-27 20:23 Andrew Ammerlaan
2021-08-27 20:23 Andrew Ammerlaan
2021-08-02 20:52 Ionen Wolkens
2021-07-17 18:18 David Seifert
2021-07-07 20:05 Ionen Wolkens
2021-06-25 13:05 Andrew Ammerlaan
2021-06-25 13:05 Andrew Ammerlaan
2021-06-15 14:42 Sam James
2021-06-15 14:42 Sam James
2021-06-15 14:42 Sam James
2021-06-15 14:42 Sam James
2021-06-10 3:38 Sam James
2021-06-02 1:24 Sam James
2021-03-26 0:57 Michael Orlitzky
2021-02-22 18:57 Sam James
2020-12-27 0:48 Andreas Sturmlechner
2020-12-27 0:17 Andreas Sturmlechner
2020-12-26 23:46 Andreas Sturmlechner
2020-07-16 1:06 Sam James
2020-06-06 10:04 Andreas Sturmlechner
2020-06-06 9:42 Andreas Sturmlechner
2020-06-06 9:42 Andreas Sturmlechner
2020-06-06 9:42 Andreas Sturmlechner
2020-06-06 9:42 Andreas Sturmlechner
2020-06-05 21:53 Andreas K. Hüttel
2020-06-05 21:15 Andreas K. Hüttel
2020-05-12 15:34 Matthias Maier
2020-05-12 5:58 Matthias Maier
2020-05-01 17:58 Matthias Maier
2020-05-01 16:48 Matthias Maier
2020-05-01 16:48 Matthias Maier
2020-04-26 11:00 David Seifert
2020-04-05 19:47 Andreas Sturmlechner
2020-04-05 19:47 Andreas Sturmlechner
2020-02-26 16:56 Andreas Sturmlechner
2020-02-09 16:36 Michał Górny
2020-02-04 13:10 Michał Górny
2019-09-14 16:33 Richard Yao
2018-10-27 14:09 Pacho Ramos
2018-10-13 10:07 Mikle Kolyada
2018-09-09 19:10 Amy Liffey
2018-02-28 18:48 Mart Raudsepp
2018-01-30 18:44 Jonathan Scruggs
2018-01-24 19:53 David Seifert
2017-12-22 10:55 Michael Weber
2017-11-17 18:47 David Seifert
2017-11-06 1:58 Andreas Sturmlechner
2017-11-06 1:58 Andreas Sturmlechner
2017-11-06 1:58 Andreas Sturmlechner
2017-07-04 15:49 Agostino Sarubbo
2017-07-04 10:17 Agostino Sarubbo
2017-05-06 22:20 David Seifert
2017-01-26 20:12 David Seifert
2016-12-20 19:16 Tobias Klausmann
2016-11-06 20:15 David Seifert
2016-11-06 20:15 David Seifert
2016-09-07 18:00 Patrice Clement
2016-08-21 17:41 Pacho Ramos
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1733421674.afea716210fdc48b59dfc58f107fc7086b53562b.sam@gentoo \
--to=sam@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox