aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/Core
diff options
context:
space:
mode:
authorGravatar Antonio Sanchez <cantonios@google.com>2021-03-11 11:23:00 -0800
committerGravatar Rasmus Munk Larsen <rmlarsen@google.com>2021-03-15 18:42:04 +0000
commitd24f9f9b5523d3ace069fe0b271f5b694f37153a (patch)
tree9d4bb4779e060b78ffdf730f38aac800ead9ed92 /Eigen/Core
parent14487ed14e7e04cf1d84681274ae9d36fda23a39 (diff)
Fix NVCC+ICC issues.
NVCC does not understand `__forceinline`, so we need to use `inline` when compiling for GPU. ICC specializes `std::complex` operators for `float` and `double` by default, which cannot be used on device and conflict with Eigen's workaround in CUDA/Complex.h. This can be prevented by defining `_OVERRIDE_COMPLEX_SPECIALIZATION_` before including `<complex>`. Added this define to the tests and to `Eigen/Core`, but this will not work if the user includes `<complex>` before `<Eigen/Core>`. ICC also seems to generate a duplicate `Map` symbol in `PlainObjectBase`: ``` error: "Map" has already been declared in the current scope static ConstMapType Map(const Scalar *data) ``` I tracked this down to `friend class Eigen::Map`. Putting the `friend` statements at the bottom of the class seems to resolve this issue. Fixes #2180
Diffstat (limited to 'Eigen/Core')
-rw-r--r--Eigen/Core7
1 files changed, 7 insertions, 0 deletions
diff --git a/Eigen/Core b/Eigen/Core
index 1a60dcba4..5921e15f9 100644
--- a/Eigen/Core
+++ b/Eigen/Core
@@ -40,6 +40,13 @@
#pragma GCC optimize ("-fno-ipa-cp-clone")
#endif
+// Prevent ICC from specializing std::complex operators that silently fail
+// on device. This allows us to use our own device-compatible specializations
+// instead.
+#if defined(EIGEN_COMP_ICC) && defined(EIGEN_GPU_COMPILE_PHASE) \
+ && !defined(_OVERRIDE_COMPLEX_SPECIALIZATION_)
+#define _OVERRIDE_COMPLEX_SPECIALIZATION_ 1
+#endif
#include <complex>
// this include file manages BLAS and MKL related macros