From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2D02B1584AD for ; Sun, 27 Apr 2025 23:39:45 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 134B434300B for ; Sun, 27 Apr 2025 23:39:45 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 8F6A01104BA; Sun, 27 Apr 2025 23:39:38 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id 858F01104BA for ; Sun, 27 Apr 2025 23:39:38 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 368F8341465 for ; Sun, 27 Apr 2025 23:39:38 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id C5B342668 for ; Sun, 27 Apr 2025 23:39:36 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1745797142.53912f0bc6963ecd02b2ba5e62fa85e69809791c.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: media-gfx/openvdb/ X-VCS-Repository: repo/gentoo X-VCS-Files: media-gfx/openvdb/openvdb-11.0.0-r1.ebuild X-VCS-Directories: media-gfx/openvdb/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 53912f0bc6963ecd02b2ba5e62fa85e69809791c X-VCS-Branch: master Date: Sun, 27 Apr 2025 23:39:36 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 7dd03598-beff-4547-bc28-18ed58b422b2 X-Archives-Hash: a902dccd0d0c624ae5121b2e7b143b11 commit: 53912f0bc6963ecd02b2ba5e62fa85e69809791c Author: Paul Zander gmail com> AuthorDate: Sun Apr 27 23:12:58 2025 +0000 Commit: Sam James gentoo org> CommitDate: Sun Apr 27 23:39:02 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=53912f0b media-gfx/openvdb: fix cuda build and tests Closes: https://bugs.gentoo.org/930155 Signed-off-by: Paul Zander gmail.com> Signed-off-by: Sam James gentoo.org> media-gfx/openvdb/openvdb-11.0.0-r1.ebuild | 120 ++++++++++++++++++++--------- 1 file changed, 82 insertions(+), 38 deletions(-) diff --git a/media-gfx/openvdb/openvdb-11.0.0-r1.ebuild b/media-gfx/openvdb/openvdb-11.0.0-r1.ebuild index 19fba296fe8b..62d7736e4229 100644 --- a/media-gfx/openvdb/openvdb-11.0.0-r1.ebuild +++ b/media-gfx/openvdb/openvdb-11.0.0-r1.ebuild @@ -56,7 +56,7 @@ RDEPEND=" sys-libs/zlib:= ) cuda? ( - >=dev-util/nvidia-cuda-toolkit-11 + dev-util/nvidia-cuda-toolkit:= ) ) python? ( @@ -114,43 +114,68 @@ PATCHES=( "${FILESDIR}/${PN}-11.0.0-cmake_fixes.patch" ) -cuda_set_CUDAHOSTCXX() { - local compiler - tc-is-gcc && compiler="gcc" - tc-is-clang && compiler="clang" - [[ -z "$compiler" ]] && die "no compiler specified" - - 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 -x NVCC_CCBIN + 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]*")" - )" - )" - )" - version="<${version}" - do ! echo "int main(){}" | nvcc "-ccbin ${CUDAHOSTCXX_test}" - -x cu &>/dev/null; done - - export CUDAHOSTCXX + + NVCC_CCBIN="${compiler}-$(ver_cut 1 "${package_version/#<${package}-/}")" + + [[ "${NVCC_CCBIN}" != "${NVCC_CCBIN_default}" ]] && break + done + ebegin "testing ${NVCC_CCBIN}" + done + eend $? + + echo "${NVCC_CCBIN}" + export NVCC_CCBIN } -cuda_get_host_arch() { - [[ -z "${CUDAARCHS}" ]] && einfo "trying to determine host CUDAARCHS" - : "${CUDAARCHS:=$(__nvcc_device_query)}" - einfo "building for CUDAARCHS = ${CUDAARCHS}" +cuda_get_host_native_arch() { + [[ -n ${CUDAARCHS} ]] && echo "${CUDAARCHS}" - export CUDAARCHS + __nvcc_device_query || die "failed to query the native device" } pkg_setup() { @@ -210,7 +235,7 @@ my_src_configure() { # -DOPENVDB_DOXYGEN_HOUDINI="no" -DUSE_BLOSC="$(usex blosc)" - # -DUSE_CCACHE="no" + -DUSE_CCACHE="no" -DUSE_COLORED_OUTPUT="yes" # OpenEXR is only needed by the vdb_render tool and defaults to OFF -DUSE_EXR="$(usex openexr "$(usex utils)")" @@ -265,11 +290,25 @@ my_src_configure() { if use cuda; then cuda_add_sandbox -w - cuda_set_CUDAHOSTCXX - cuda_get_host_arch + + local -x CUDAARCHS + : "${CUDAARCHS:="$(cuda_get_host_native_arch)"}" + + local -x CUDAHOSTCXX CUDAHOSTLD + CUDAHOSTCXX="$(cuda_get_host_compiler)" + CUDAHOSTLD="$(tc-getCXX)" + + 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 # NOTE tbb includes immintrin.h, which breaks nvcc so we pretend they are already included - export CUDAFLAGS="-D_AVX512BF16VLINTRIN_H_INCLUDED -D_AVX512BF16INTRIN_H_INCLUDED" + # export CUDAFLAGS="-D_AVX512BF16VLINTRIN_H_INCLUDED -D_AVX512BF16INTRIN_H_INCLUDED" fi if use utils; then @@ -346,6 +385,11 @@ my_src_test() { cuda_add_sandbox -w fi + local -x GTEST_FILTER="!TestUtil.testCpuTimer" + local -x CMAKE_SKIP_TESTS=( + "^pytest$" + ) + cmake_src_test }