Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile Failed (Eigen errors) #7

Open
syedharoonalam opened this issue Jul 29, 2016 · 31 comments
Open

Compile Failed (Eigen errors) #7

syedharoonalam opened this issue Jul 29, 2016 · 31 comments

Comments

@syedharoonalam
Copy link

Hi, I am getting following Eigen errors when compiling the project:

Error 16 error : calling a host function("Eigen::DenseBase<Eigen::Matrix<float, (int)29, (int)1, (int)2, (int)29, (int)1> > ::Zero") from a device function("blockReduceSum<(int)29> ") is not allowed

Error 73 error : calling a host function("Eigen::DenseCoeffsBase<Eigen::Matrix<float, (int)29, (int)1, (int)2, (int)29, (int)1> , (int)1> ::operator []") from a device function("Reduction::SquareUpperTriangularProduct<(int)0, (int)0, (int)6> ::apply") is not allowed

Error 18 error : calling a host function("Eigen::DenseCoeffsBase<Eigen::Matrix<float, (int)29, (int)1, (int)2, (int)29, (int)1> , (int)1> ::operator []") from a device function("warpReduceSum<(int)29> ") is not allowed

Error 25 error : calling a host function("Eigen::Matrix<float, (int)29, (int)1, (int)2, (int)29, (int)1> ::Matrix") from a device function("Reduction::operator ()") is not allowed

Error 15 error : calling a host function("Eigen::Matrix<float, (int)29, (int)1, (int)2, (int)29, (int)1> ::MatrixEigen::CwiseNullaryOp<Eigen::internal::scalar_constant_op<float , Eigen::Matrix<float, (int)29, (int)1, (int)2, (int)29, (int)1> > > ") from a device function("blockReduceSum<(int)29> ") is not allowed

Error 51 error : calling a host function("Eigen::MatrixBase<Eigen::Matrix<float, (int)3, (int)3, (int)2, (int)3, (int)3> > ::operator *<Eigen::Matrix<float, (int)3, (int)1, (int)2, (int)3, (int)1> > ") from a device function("Reduction::operator ()") is not allowed

I have built and installed Eigen from source files (CUDA supported). Tried using both github.com/stevenlovegrove/eigen and Eigen 3.3. Also I have installed Eigen, Pangolin, Sophus and ICPCUDA all in Release mode for x64 platform.

Any suggestions ?

@mp3guy
Copy link
Owner

mp3guy commented Jul 29, 2016

What OS, version of CUDA and compiler?

@syedharoonalam
Copy link
Author

Windows 10, CUDA 7.0, VS 2013

@mp3guy
Copy link
Owner

mp3guy commented Jul 29, 2016

There are some issues with building Eigen within CUDA on Windows, you have to only include the minimal Eigen headers.

@syedharoonalam
Copy link
Author

I built Eigen with CUDA separately, that part worked. But, calling it in kernal of this project doesn't seems to be working.

@syedharoonalam
Copy link
Author

By the way, what is recommended OS, CUDA and compiler for this project ?

I built Eigen again, and now getting error of: declaration is incompatible with "void Eigen::BDCSVD..
and if I comment this template I get attached errors.
errors

My guess is its wise to switch OS, please suggest.

@mp3guy
Copy link
Owner

mp3guy commented Aug 1, 2016

I would switch to Ubuntu, the build has not been fully tested on Windows.

@steevo87
Copy link

steevo87 commented Aug 2, 2016

Hi, i've got a similar set of errors on Ubuntu 14.04 LTS, gcc 4.8.4 and CUDA V7.5.17.

home/aslab/pkg/ICPCUDA/src/Cuda/estimate.cu(56): error: calling a _host_ function("Eigen::Matrix<float, (int)29, (int)1, (int)2, (int)29, (int)1> ::operator =") from a _device_ function("blockReduceSum<(int)29> ") is not allowed

I'm wondering if it's because I haven't compiled stevenlovegrove/eigen properly. In the CMake GUI it seems to have found all of the Eigen stuff except for CUDA_SDK_ROOT_DIR - is that a problem? I have checked all of the CUDA-related checkboxes except for CUDA_BUILD_EMULATION which causes a problem.

Then for ICPCUDA in CMake I have set the EIGEN_INCLUDE_DIRS to my local build (since I don't want to overwrite the system Eigen installation with the forked version).

@syedharoonalam
Copy link
Author

CUDA_SDK_ROOT_DIR wont be a problem. Steven mentioned that they used CUDA 8.0 (pre production), you may try with that. If it works please let me know as well. I am shifting from Windows to Ubuntu.

@steevo87
Copy link

steevo87 commented Aug 9, 2016

Thanks for the tip - I tried CUDA 8.0 on a separate partition and it all seems to work well. However, because I hadn't tried CUDA 7.5 on that partition I can't 100% guarantee that it was the version of CUDA that made the difference (though it does seem that way).

@axelus111
Copy link

axelus111 commented Aug 9, 2016

Hi, similiar Problems over here.

Running Kubuntu 14.04 with cuda 7.5 (nvcc 7.5.17)
Error Output is like this:


~/git/ICPCUDA/src/Cuda/pyrdown.cu(149): error: calling a __host__ function("Eigen::Matrix<float, (int)3, (int)1, (int)2, (int)3, (int)1> ::Matrix") from a __global__ function("computeNmapKernel") is not allowed

~/git/ICPCUDA/src/Cuda/pyrdown.cu(149): error: calling a __host__ function("Eigen::Matrix<float, (int)3, (int)1, (int)2, (int)3, (int)1> ::Matrix") from a __global__ function("computeNmapKernel") is not allowed

and so on

Tried Cuda 8.0 with no difference, tried some eigen versions (3.0.0, 3.3-beta1 and some others) with also no success. btw. exp-branch seems to compile but i can't finish the testrun (no assosiations.txt file in the testdate so the test runs an infinite loop)

any idea what this could be about?

@syedharoonalam
Copy link
Author

I have successfully compiled using Ubuntu 14.04 and CUDA 7.5.18. If you are getting EIgen errors, make sure you are building Eigen with CUDA support.

@steevo87
Copy link

I just got it working with CUDA 7.5.17 too - it turns out that I need to install (sudo make install) my CUDA-enabled Eigen headers.

I'm not sure why it wouldn't work when I directed Pangolin, Sophus and ICPCUDA to my local CUDA-enabled Eigen headers using the CMake EIGEN3_INCLUDE_DIR field - maybe I missed one of them or re-built them in the wrong order..

@axelus111
Copy link

Hi, I ve got it working to installing eigen in /usr/include instead of /usr/local/include. No matter where i've pointed to the eigen lib in cmake, it has always used the install in /usr/include

@antithing
Copy link

I am getting these same errors, has anyone successfully compiled this on windows?

@wine3603
Copy link

wine3603 commented Mar 15, 2017

same problem with CUDA 8.0 ubunto 14.04 Eigen 3.2.0, @steevo87 @syedharoonalam could you tell me how to remake eigen with cuda support ?

@wine3603
Copy link

wine3603 commented Mar 17, 2017

just found the newest Eigen 3.3.3 involved cuda supporting.
As pointed by @axelus111 , no matter where ever you set the eigen dir, it always use the eigen from /usr/include firstly.
So either you remove eigen 3.2.0 by
sudo apt-get remove libeigen3-dev
and then point eigen dir to 3.3.3 in cmake-gui, or install eigen 3.3.3 into /usr/include/
Then remake ICPCUDA , it will pass with a lot of warnings.

@antithing
Copy link

Hi all, I am on windows, and have Eigen 3.3. I am down to 2 errors, but cannot figure out how to solve them...

Error "operator=" has already been declared in the current scope ICP d:\libs\eigen-eigen-b30b87236a1b\eigen\src\Core\Block.h 111
Error "operator=" has already been declared in the current scope ICP d:\libs\eigen-eigen-b30b87236a1b\eigen\src\Core\Ref.h 155

Does anyone have any ideas here?

Thanks!

@randi120
Copy link

@syedharoonalam
I just ran into the same Eigen problems void Eigen::BDCSVD from windows.
The environment: Eigen 3.3.3 (has CUDA support), CUDA 8, Windows 7.

The issue for me was including <Eigen/Geometry> inside CUDA code. As @mp3guy suggested, switching to minimal <Eigen/Core> is the answer.

If you still need Geometry support (as I did), you can wrap the header and comment out the problematic includes (SVD and Geometry/Scaling). This assumes that you are not using them and is really nvcc not properly parsing Eigen's code ( eg. you are not doing SVDs on device)

Anyways, instead of including <Eigen/Geometry> create a file geometry_wrapper.h
and do something like:

#ifndef __CUDACC__ 
#  include <Eigen/Geometry> 
#else 
#  ifndef WIN32 	
#    include <Eigen/Geometry> 
#  else //this is the case for CUDA on Windows
     [COPY includes from <Eigen/Geometry> here, and comment out the problematic ones]
#  endif
#endif

This should be okay for all other OS/compilers, as it only changes CUDA on windows.

@Buzzroid
Copy link

Buzzroid commented Jun 22, 2017

@randi120 Could you please post your real geometry_wrapper.h for us?

@randi120
Copy link

@Buzzroid, I did not run into these problems with ICPCUDA, so I am not sure if you are having issues with the same headers, that's why I did not post the wrapper in the earlier response (it might not be a one-size fits all kind of solution).

But if you think it could be helpful, see below for the geometry_wrapper.h file

#ifndef __CUDACC__ 
#  include <Eigen/Geometry> 
#else 
#  ifndef WIN32 	
#    include <Eigen/Geometry> 
#  else //this is the case for CUDA on Windows
//    RC: the code below code comes from Eigen's 3.3.3 <Eigen/Geometry> 
//    with problematic headers commented out (SVD and Scaling)
//    we are not using either functionality on device but for some reason nvcc tries to parse these headers (at least on windows) and fails.
#    ifndef EIGEN_GEOMETRY_MODULE_H
#      define EIGEN_GEOMETRY_MODULE_H
#      include <Eigen/Core>
#      include <Eigen/src/Core/util/DisableStupidWarnings.h>
//#      include <Eigen/SVD>
#      include <Eigen/LU>
#      include <limits>
#      include <Eigen/src/Geometry/OrthoMethods.h>
#      include <Eigen/src/Geometry/EulerAngles.h>
#      include <Eigen/src/Geometry/Homogeneous.h>
#      include <Eigen/src/Geometry/RotationBase.h>
#      include <Eigen/src/Geometry/Rotation2D.h>
#      include <Eigen/src/Geometry/Quaternion.h>
#      include <Eigen/src/Geometry/AngleAxis.h>
#      include <Eigen/src/Geometry/Transform.h>
#      include <Eigen/src/Geometry/Translation.h>
//#      include <Eigen/src/Geometry/Scaling.h>
#      include <Eigen/src/Geometry/Hyperplane.h>
#      include <Eigen/src/Geometry/ParametrizedLine.h>
#      include <Eigen/src/Geometry/AlignedBox.h>
#      include <Eigen/src/Geometry/Umeyama.h>
#      if defined EIGEN_VECTORIZE_SSE && !defined EIGEN_VECTORIZE_AVX
#        include <Eigen/src/Geometry/arch/Geometry_SSE.h>
#      endif
#      include <Eigen/src/Core/util/ReenableStupidWarnings.h>
#    endif // EIGEN_GEOMETRY_MODULE_H
#  endif
#endif

@Buzzroid
Copy link

@randi120 Thanks for the post.
I've tried but failed with the same errors.

By the way, it seems that Eigen itself has some issues or bugs.
There is a bug report regarding this:
http://eigen.tuxfamily.org/bz/show_bug.cgi?id=1412

@Buzzroid
Copy link

@randi120 Oh, It seems that your solution works.

Here's what I've done:

  • Block including the eigen header files in two places: ICPOdometry.h and Cuda/internal.h
  • Include "geometry_wrapper.h" in the places

Thank @randi120 again.

@randi120
Copy link

@Buzzroid I am glad it works.
Hopefully Eigen fixes that bug (thanks for that, I didn't know about it) and then the wrapper won't be needed.

@polar99
Copy link

polar99 commented Jul 17, 2017

@randi120 The eigen errors are solved. But I got "undefined symbol 'M_PI' in sophus.hpp". And I have compiled Sophus successfully.
My platform: VS2015, CUDA8.0
Could you help me to solve this problem?

@arpit15
Copy link

arpit15 commented Aug 14, 2017

@randi120 I am facing the same problem in ubuntu 14.04 and eigen 3.3.4. Can you kindly send a pull request or share your changes in a more detailed manner? I will hugely helpful for people stumbling above on this error.

Thanks
Arpit

@randi120
Copy link

@stephengreat, I am sure you figured this one out. Sometimes windows gets a little silly
You can try adding add_definitions(-D_USE_MATH_DEFINES) to a top-level cmake file.

If that doesn't work, I would modify the source file directly.

#ifndef M_PI
    #define M_PI 3.14159265358979323846
#endif

@randi120
Copy link

randi120 commented Aug 14, 2017

@arpit15, I am hesitant to create a pull request for code I have never used. As I mentioned above, I did not run into these issues with ICPCUDA. However, this thread was one of the top hits, and once I got something to work (on my own code), I figure it would be worth sharing here.

That said, a possible fix for ICPCUDA could be:

  1. create a file geometry_wrapper.h. Paste the code from my earlier post into the file.
  2. (As stated by @Buzzroid) replace the lines #include <Eigen/Geometry> in ICPOdometry.h and Cuda/internal.h with #include "geometry_wrapper.h".

EDIT: I missed the "ubuntu 14.04". Since that is the the case,
try changing the line # ifndef WIN32 to # ifdef WIN32.
This will include <Eigen/Geometry> on windows (which you don't care about), and Ubuntu should go into the else clause (which is what you care about)

Hope that helps.

@arpit15
Copy link

arpit15 commented Aug 15, 2017

@randi120 thanks for the details notes. Unfortunately I am still facing the same error on my system.

@RicheyHuang
Copy link

@axelus111 Thanks for your tips! It works! Just change the CMAKE_INSTALL_PREFIX of eigen from "/usr/local" to "/usr" in the Cmake-GUI and keep the rest unchanged. Then I compile successfully!

@Zzj-pcl
Copy link

Zzj-pcl commented May 26, 2019

Windows 10, CUDA 7.0, VS 2013

Have you run successfully on VS2017 or VS2015?

@Zzj-pcl
Copy link

Zzj-pcl commented May 26, 2019

@randi120 The eigen errors are solved. But I got "undefined symbol 'M_PI' in sophus.hpp". And I have compiled Sophus successfully.
My platform: VS2015, CUDA8.0
Could you help me to solve this problem?

Have you run successfully on VS2017 or VS2015?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests