aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/util
diff options
context:
space:
mode:
authorGravatar Jonas Adler <jonasadl@kth.se>2015-07-22 12:29:18 +0200
committerGravatar Jonas Adler <jonasadl@kth.se>2015-07-22 12:29:18 +0200
commit815fa0dbf63f112f98fe3ac38483e0248caf9eec (patch)
tree45cff143ff8ffc55edde6caff72d667af6251b8f /Eigen/src/Core/util
parentd259b719d1703e9271612d944e432edd72be1051 (diff)
Fixed some compiler bugs in NVCC, now compiles with CUDA.
(chtz: Manually joined sevaral commits to keep the history clean)
Diffstat (limited to 'Eigen/src/Core/util')
-rw-r--r--Eigen/src/Core/util/Macros.h9
-rw-r--r--Eigen/src/Core/util/Memory.h6
-rw-r--r--Eigen/src/Core/util/Meta.h4
3 files changed, 14 insertions, 5 deletions
diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h
index d187257a6..b90c88ed4 100644
--- a/Eigen/src/Core/util/Macros.h
+++ b/Eigen/src/Core/util/Macros.h
@@ -760,8 +760,13 @@ namespace Eigen {
# define EIGEN_TRY try
# define EIGEN_CATCH(X) catch (X)
#else
-# define EIGEN_THROW_X(X) std::abort()
-# define EIGEN_THROW std::abort()
+# ifdef __CUDA_ARCH__
+# define EIGEN_THROW_X(X) asm("trap;") return {}
+# define EIGEN_THROW asm("trap;"); return {}
+# else
+# define EIGEN_THROW_X(X) std::abort()
+# define EIGEN_THROW std::abort()
+# endif
# define EIGEN_TRY if (true)
# define EIGEN_CATCH(X) else
#endif
diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h
index 62f329984..73287d6ca 100644
--- a/Eigen/src/Core/util/Memory.h
+++ b/Eigen/src/Core/util/Memory.h
@@ -559,18 +559,18 @@ inline Index first_multiple(Index size, Index base)
// use memcpy on trivial types, i.e., on types that does not require an initialization ctor.
template<typename T, bool UseMemcpy> struct smart_copy_helper;
-template<typename T> void smart_copy(const T* start, const T* end, T* target)
+template<typename T> EIGEN_DEVICE_FUNC void smart_copy(const T* start, const T* end, T* target)
{
smart_copy_helper<T,!NumTraits<T>::RequireInitialization>::run(start, end, target);
}
template<typename T> struct smart_copy_helper<T,true> {
- static inline void run(const T* start, const T* end, T* target)
+ EIGEN_DEVICE_FUNC static inline void run(const T* start, const T* end, T* target)
{ memcpy(target, start, std::ptrdiff_t(end)-std::ptrdiff_t(start)); }
};
template<typename T> struct smart_copy_helper<T,false> {
- static inline void run(const T* start, const T* end, T* target)
+ EIGEN_DEVICE_FUNC static inline void run(const T* start, const T* end, T* target)
{ std::copy(start, end, target); }
};
diff --git a/Eigen/src/Core/util/Meta.h b/Eigen/src/Core/util/Meta.h
index 974f11516..7c8932511 100644
--- a/Eigen/src/Core/util/Meta.h
+++ b/Eigen/src/Core/util/Meta.h
@@ -117,6 +117,10 @@ template<typename T> struct enable_if<true,T>
{ typedef T type; };
#if defined(__CUDA_ARCH__)
+#if !defined(__FLT_EPSILON__)
+#define __FLT_EPSILON__ FLT_EPSILON
+#define __DBL_EPSILON__ DBL_EPSILON
+#endif
namespace device {