New user self-registration is disabled due to spam. Please email eigen-core-team @ lists.tuxfamily.org if you need an account.
Before reporting a bug, please make sure that your Eigen version is up-to-date!
Bug 735 - Templates issues with cuda 5.5 and visual 2012 (dev branch)
Summary: Templates issues with cuda 5.5 and visual 2012 (dev branch)
Status: NEW
Alias: None
Product: Eigen
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: x86 - 64-bit Windows
: Normal Unknown
Assignee: Nobody
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-31 11:45 UTC by gautier.ciaudo
Modified: 2015-07-17 14:25 UTC (History)
6 users (show)



Attachments

Description gautier.ciaudo 2014-01-31 11:45:09 UTC
Trying to compile a program using Cuda 5.5 and visual 2012. This is my log :

c:\****\eigen-dev\eigen\src/Core/util/Meta.h(103): error
: identifier "__FLT_EPSILON__" is undefined

c:\****\eigen-dev\eigen\src/Core/util/Meta.h(108): error
: identifier "__DBL_EPSILON__" is undefined

c:\****\eigen-dev\eigen\src/Core/util/Memory.h(92): warn
ing: integer conversion resulted in a change of sign

c:\****\eigen-dev\eigen\src/Core/Block.h(105): error: "o
perator=" has already been declared in the current scope
          detected during instantiation of class "Eigen::Block<XprType, BlockRow
s, BlockCols, InnerPanel> [with XprType=VectorType, BlockRows=<expression>, Bloc
kCols=<expression>, InnerPanel=false]"
c:\****\eigen-dev\eigen\src/Core/VectorBlock.h(58): here


c:\****\eigen-dev\eigen\src/Core/Ref.h(123): error: "ope
rator=" has already been declared in the current scope
          detected during instantiation of class "Eigen::RefBase<Derived> [with
Derived=Eigen::Ref<PlainObjectType, Options, StrideType>]"
(184): here

c:\****\eigen-dev\eigen\src/Core/products/Parallelizer.h
(20): warning: variable "m_maxThreads" was set but never used

c:\****\eigen-dev\eigen\src/Core/ArrayWrapper.h(133): wa
rning: __declspec attributes ignored

c:\****\eigen-dev\eigen\src/Geometry/RotationBase.h(76):
 error: function template "Eigen::operator*(const Eigen::EigenBase<OtherDerived>
 &, const Eigen::Quaternion<_Scalar, _Options> &)" has already been defined
          detected during:
            instantiation of class "Eigen::RotationBase<Derived, _Dim> [with Der
ived=Eigen::Quaternion<_Scalar, _Options>, _Dim=3]"
c:\****\eigen-dev\eigen\src/Geometry/Quaternion.h(35): h
ere
            instantiation of class "Eigen::QuaternionBase<Derived> [with Derived
=Eigen::Quaternion<_Scalar, _Options>]"
c:\****\eigen-dev\eigen\src/Geometry/Quaternion.h(232):
here

For the first two errors it is just a windows include problem I guess. For the next ones, it seems to have issues with templates.
Comment 1 Steven Lovegrove 2014-12-19 17:36:37 UTC
Just including <Eigen/Eigen> in a .cu file produces similar problems for me with Cuda 6.5, Visual Studio 2013. I've tried several branches of Eigen, including 3.2 development branch and nvcc_fix, all with the same issues.

MSVC Output follows:

c:\dev\sysroot32\usr\include\eigen\src/Core/util/Meta.h(103): error : identifier "__FLT_EPSILON__" is undefined
  
c:\dev\sysroot32\usr\include\eigen\src/Core/util/Meta.h(108): error : identifier "__DBL_EPSILON__" is undefined
  
c:\dev\sysroot32\usr\include\eigen\src/Core/Block.h(105): error : "operator=" has already been declared in the current scope
            detected during instantiation of class "Eigen::Block<XprType, BlockRows, BlockCols, InnerPanel> [with XprType=VectorType, BlockRows=<expression>, BlockCols=<expression>, InnerPanel=false]" 
  c:\dev\sysroot32\usr\include\eigen\src/Core/VectorBlock.h(58): here
 
c:\dev\sysroot32\usr\include\eigen\src/Core/Ref.h(123): error : "operator=" has already been declared in the current scope
            detected during instantiation of class "Eigen::RefBase<Derived> [with Derived=Eigen::Ref<PlainObjectType, Options, StrideType>]" 
  (188): here
  
c:\dev\sysroot32\usr\include\eigen\src/Core/products/Parallelizer.h(20): warning : variable "m_maxThreads" was set but never used
  
c:\dev\sysroot32\usr\include\eigen\src/Core/ArrayWrapper.h(133): warning : __declspec attributes ignored
Comment 2 Jonas Adler 2015-07-17 11:56:58 UTC
I have also had this issue historically, and I managed to fix them myself. Now I am able to include <Eigen/Core> in Cuda files and compile without warnings.

My fork with this solution is given in the following repo

https://github.com/Berzerka/eigen

It seems that the needed fixes was to move some code from implementation files to DenseBase (due to compiler bugs in nvcc), it seems this has already been done in some other cases, so if this is deemed an acceptable change we could maybe move my commits into the dev branch?
Comment 3 Christoph Hertzberg 2015-07-17 12:11:23 UTC
Could you please provide a patch (or pull request) against the current head?
Comment 4 Jonas Adler 2015-07-17 14:25:53 UTC
I have provided a pull request, it will likely need some polishing.

Note You need to log in before you can comment on or make changes to this bug.