aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/util
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2013-02-07 19:06:14 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2013-02-07 19:06:14 +0100
commit5adcc6c7b48b7a213af91bc123a02ab87751228e (patch)
tree5e0ee840a8fb9acbbb48c5c48f1bffe0ca3cfe2a /Eigen/src/Core/util
parente4ec63aee7233f5b934abc0b1d9ceada79a844ee (diff)
Add support for NVCC5: most of the Core and part of LU are callable from CUDA code.
Still a lot to do.
Diffstat (limited to 'Eigen/src/Core/util')
-rw-r--r--Eigen/src/Core/util/Macros.h2
-rw-r--r--Eigen/src/Core/util/XprHelper.h33
2 files changed, 18 insertions, 17 deletions
diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h
index 933a34c9d..bf6a9293c 100644
--- a/Eigen/src/Core/util/Macros.h
+++ b/Eigen/src/Core/util/Macros.h
@@ -396,7 +396,7 @@
#define EIGEN_MAKE_CWISE_BINARY_OP(METHOD,FUNCTOR) \
template<typename OtherDerived> \
- EIGEN_STRONG_INLINE const CwiseBinaryOp<FUNCTOR<Scalar>, const Derived, const OtherDerived> \
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp<FUNCTOR<Scalar>, const Derived, const OtherDerived> \
(METHOD)(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const \
{ \
return CwiseBinaryOp<FUNCTOR<Scalar>, const Derived, const OtherDerived>(derived(), other.derived()); \
diff --git a/Eigen/src/Core/util/XprHelper.h b/Eigen/src/Core/util/XprHelper.h
index 3d1290cd2..f115d3779 100644
--- a/Eigen/src/Core/util/XprHelper.h
+++ b/Eigen/src/Core/util/XprHelper.h
@@ -16,8 +16,8 @@
// so currently we simply disable this optimization for gcc 4.3
#if (defined __GNUG__) && !((__GNUC__==4) && (__GNUC_MINOR__==3))
#define EIGEN_EMPTY_STRUCT_CTOR(X) \
- EIGEN_STRONG_INLINE X() {} \
- EIGEN_STRONG_INLINE X(const X& ) {}
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE X() {} \
+ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE X(const X& ) {}
#else
#define EIGEN_EMPTY_STRUCT_CTOR(X)
#endif
@@ -50,19 +50,19 @@ template<typename T, int Value> class variable_if_dynamic
{
public:
EIGEN_EMPTY_STRUCT_CTOR(variable_if_dynamic)
- explicit variable_if_dynamic(T v) { EIGEN_ONLY_USED_FOR_DEBUG(v); assert(v == T(Value)); }
- static T value() { return T(Value); }
- void setValue(T) {}
+ EIGEN_DEVICE_FUNC explicit variable_if_dynamic(T v) { EIGEN_ONLY_USED_FOR_DEBUG(v); eigen_assert(v == T(Value)); }
+ EIGEN_DEVICE_FUNC static T value() { return T(Value); }
+ EIGEN_DEVICE_FUNC void setValue(T) {}
};
template<typename T> class variable_if_dynamic<T, Dynamic>
{
T m_value;
- variable_if_dynamic() { assert(false); }
+ EIGEN_DEVICE_FUNC variable_if_dynamic() { eigen_assert(false); }
public:
- explicit variable_if_dynamic(T value) : m_value(value) {}
- T value() const { return m_value; }
- void setValue(T value) { m_value = value; }
+ EIGEN_DEVICE_FUNC explicit variable_if_dynamic(T value) : m_value(value) {}
+ EIGEN_DEVICE_FUNC T value() const { return m_value; }
+ EIGEN_DEVICE_FUNC void setValue(T value) { m_value = value; }
};
/** \internal like variable_if_dynamic but for DynamicIndex
@@ -71,19 +71,19 @@ template<typename T, int Value> class variable_if_dynamicindex
{
public:
EIGEN_EMPTY_STRUCT_CTOR(variable_if_dynamicindex)
- explicit variable_if_dynamicindex(T v) { EIGEN_ONLY_USED_FOR_DEBUG(v); assert(v == T(Value)); }
- static T value() { return T(Value); }
- void setValue(T) {}
+ EIGEN_DEVICE_FUNC explicit variable_if_dynamicindex(T v) { EIGEN_ONLY_USED_FOR_DEBUG(v); eigen_assert(v == T(Value)); }
+ EIGEN_DEVICE_FUNC static T value() { return T(Value); }
+ EIGEN_DEVICE_FUNC void setValue(T) {}
};
template<typename T> class variable_if_dynamicindex<T, DynamicIndex>
{
T m_value;
- variable_if_dynamicindex() { assert(false); }
+ EIGEN_DEVICE_FUNC variable_if_dynamicindex() { eigen_assert(false); }
public:
- explicit variable_if_dynamicindex(T value) : m_value(value) {}
- T value() const { return m_value; }
- void setValue(T value) { m_value = value; }
+ EIGEN_DEVICE_FUNC explicit variable_if_dynamicindex(T value) : m_value(value) {}
+ EIGEN_DEVICE_FUNC T value() const { return m_value; }
+ EIGEN_DEVICE_FUNC void setValue(T value) { m_value = value; }
};
template<typename T> struct functor_traits
@@ -340,6 +340,7 @@ template<typename T, int n=1, typename PlainObject = typename eval<T>::type> str
};
template<typename T>
+EIGEN_DEVICE_FUNC
T* const_cast_ptr(const T* ptr)
{
return const_cast<T*>(ptr);