cuda 9.1 和 eigen手动适配

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/O1_1O/article/details/80066236

计算机视觉应用中,经常用到eigen库,也会用到cuda库,因为eigen库没有及时follow cuda的更新,导致cuda 9.0和9.1最新的版本,会出eigen兼容问题,报错如下:
note:如果使用cmake build,注意下面的顺序,一定放到include_directories开始

include_directories(${CUDA_INCLUDE_DIRS})

include_directories(${EIGEN3_INCLUDE_DIRS})

因为eigen是头文件自包含的lib;对于装有多个eigen版本,或者使用其他版本eigen的库,一样会有问题

In file included from /usr/local/cuda/include/common_functions.h:50:0,
                 from /usr/local/cuda/include/cuda_runtime.h:115,
                 from <command-line>:0:
/usr/local/cuda/include/crt/common_functions.h:64:24: error: token ""__CUDACC_VER__ is no longer supported.  Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."" is not valid in preprocessor expressions
 #define __CUDACC_VER__ "__CUDACC_VER__ is no longer supported.  Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."
                        ^
/usr/include/eigen3/Eigen/src/Core/util/Macros.h:364:33: note: in expansion of macro ‘__CUDACC_VER__’
 #if defined(__CUDACC_VER__) &&  __CUDACC_VER__ >= 70500 && __cplusplus > 199711L
                                 ^
In file included from /usr/local/cuda/include/common_functions.h:50:0,
                 from /usr/local/cuda/include/cuda_runtime.h:115,
                 from <command-line>:0:
/usr/local/cuda/include/crt/common_functions.h:64:24: error: token ""__CUDACC_VER__ is no longer supported.  Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."" is not valid in preprocessor expressions
 #define __CUDACC_VER__ "__CUDACC_VER__ is no longer supported.  Use __CUDACC_VER_MAJOR__, __CUDACC_VER_MINOR__, and __CUDACC_VER_BUILD__ instead."
                        ^
/usr/include/eigen3/Eigen/src/Core/util/Macros.h:364:33: note: in expansion of macro ‘__CUDACC_VER__’
 #if defined(__CUDACC_VER__) &&  __CUDACC_VER__ >= 70500 && __cplusplus > 199711L
                                 ^
CMake Error at cuda_compile_1_generated_estimate.cu.o.cmake:219 (message):
  Error generating
  /home/chengxiang/cainiao/workspace/cudaICP/build/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_estimate.cu.o


CMake Error at cuda_compile_1_generated_pyrdown.cu.o.cmake:219 (message):
  Error generating
  /home/chengxiang/cainiao/workspace/cudaICP/build/CMakeFiles/cuda_compile_1.dir/src/cuda/./cuda_compile_1_generated_pyrdown.cu.o
展开阅读全文

没有更多推荐了,返回首页