From 695e49d1bd953aa7a314fb69acf11c68a0777304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20S=C3=A1nchez?= Date: Tue, 29 Oct 2024 18:38:14 +0000 Subject: [PATCH] Fix NVCC builds for CUDA 10+. --- Eigen/src/Core/RandomImpl.h | 2 ++ Eigen/src/Core/util/DisableStupidWarnings.h | 2 +- Eigen/src/Core/util/IndexedViewHelper.h | 2 +- Eigen/src/Core/util/Macros.h | 9 +-------- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/Eigen/src/Core/RandomImpl.h b/Eigen/src/Core/RandomImpl.h index e82da9660..76e43f5dc 100644 --- a/Eigen/src/Core/RandomImpl.h +++ b/Eigen/src/Core/RandomImpl.h @@ -115,6 +115,7 @@ struct random_float_impl { } }; +#if !EIGEN_COMP_NVCC // random implementation for long double // this specialization is not compatible with double-double scalars template { }; template <> struct random_float_impl : random_longdouble_impl<> {}; +#endif template struct random_default_impl { diff --git a/Eigen/src/Core/util/DisableStupidWarnings.h b/Eigen/src/Core/util/DisableStupidWarnings.h index 32a427d85..ab0c542d0 100644 --- a/Eigen/src/Core/util/DisableStupidWarnings.h +++ b/Eigen/src/Core/util/DisableStupidWarnings.h @@ -83,7 +83,7 @@ #endif #endif -#if defined __NVCC__ +#if defined __NVCC__ && defined __CUDACC__ // MSVC 14.16 (required by CUDA 9.*) does not support the _Pragma keyword, so // we instead use Microsoft's __pragma extension. #if defined _MSC_VER diff --git a/Eigen/src/Core/util/IndexedViewHelper.h b/Eigen/src/Core/util/IndexedViewHelper.h index 59486ea50..fd8215e66 100644 --- a/Eigen/src/Core/util/IndexedViewHelper.h +++ b/Eigen/src/Core/util/IndexedViewHelper.h @@ -69,7 +69,7 @@ static constexpr auto lastp1 = last + fix<1>; #else // Using a FixedExpr<1> expression is important here to make sure the compiler // can fully optimize the computation starting indices with zero overhead. -static constexpr lastp1_t lastp1(last + fix<1>()); +static constexpr lastp1_t lastp1; #endif /** \var end diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h index 226844f64..fb5605164 100644 --- a/Eigen/src/Core/util/Macros.h +++ b/Eigen/src/Core/util/Macros.h @@ -1083,14 +1083,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void ignore_unused_variable(cons #define EIGEN_USING_STD(FUNC) using std::FUNC; #endif -#if EIGEN_COMP_MSVC_STRICT && EIGEN_COMP_NVCC -// Wwhen compiling with NVCC, using the base operator is necessary, -// otherwise we get duplicate definition errors -// For later MSVC versions, we require explicit operator= definition, otherwise we get -// use of implicitly deleted operator errors. -// (cf Bugs 920, 1000, 1324, 2291) -#define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) using Base::operator=; -#elif EIGEN_COMP_CLANG // workaround clang bug (see http://forum.kde.org/viewtopic.php?f=74&t=102653) +#if EIGEN_COMP_CLANG // workaround clang bug (see http://forum.kde.org/viewtopic.php?f=74&t=102653) #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \ using Base::operator=; \ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) { \