aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/main.h
diff options
context:
space:
mode:
authorGravatar Rasmus Munk Larsen <rmlarsen@google.com>2019-05-31 15:26:06 -0700
committerGravatar Rasmus Munk Larsen <rmlarsen@google.com>2019-05-31 15:26:06 -0700
commitb08527b0c1ffdbd44347ca3a7869f10b0cb3cbb6 (patch)
tree0e96b895f59e4a77ca9880d2e219ffbde11680ac /test/main.h
parent56144005811e3e5a76031ba0aac8a4e1fa3e3396 (diff)
Clean up CUDA/NVCC version macros and their use in Eigen, and a few other CUDA build failures.
Diffstat (limited to 'test/main.h')
-rw-r--r--test/main.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/test/main.h b/test/main.h
index 1fe631ca9..93e894460 100644
--- a/test/main.h
+++ b/test/main.h
@@ -52,15 +52,17 @@
#endif
// Same for cuda_fp16.h
-#if defined(__CUDACC_VER_MAJOR__) && (__CUDACC_VER_MAJOR__ >= 9)
-#define EIGEN_TEST_CUDACC_VER ((__CUDACC_VER_MAJOR__ * 10000) + (__CUDACC_VER_MINOR__ * 100))
-#elif defined(__CUDACC_VER__)
-#define EIGEN_TEST_CUDACC_VER __CUDACC_VER__
+#if defined(__CUDACC__) && !defined(EIGEN_NO_CUDA)
+ // Means the compiler is either nvcc or clang with CUDA enabled
+ #define EIGEN_CUDACC __CUDACC__
+#endif
+#if defined(EIGEN_CUDACC)
+#include <cuda.h>
+ #define EIGEN_CUDA_SDK_VER (CUDA_VERSION * 10)
#else
-#define EIGEN_TEST_CUDACC_VER 0
+ #define EIGEN_CUDA_SDK_VER 0
#endif
-
-#if EIGEN_TEST_CUDACC_VER >= 70500
+#if EIGEN_CUDA_SDK_VER >= 70500
#include <cuda_fp16.h>
#endif