环境:ubuntu16.04   cuda10.0    eigen3.3.7   pcl1.8.1

编译过程中一直受下面问题困扰,

usr\include\eigen3\Eigen\src/Core/arch/CUDA/Half.h(212): error : more than one instance of overloaded function “__hadd” matches the argument list:

这其实是eigen3的一个bug,修改方法如下:

参考:https://blog.csdn.net/weixin_43878709/article/details/99707379

            https://bitbucket.org/eigen/eigen/commits/52517c8764ad/

找到   Eigen/src/Core/arch/CUDA/Half.h文件,从第212行开始,对于里面的两个函数进行如下改变

 EIGEN_STRONG_INLINE __device__ half operator + (const half& a, const half& b) {
+#if defined(EIGEN_CUDACC_VER) && EIGEN_CUDACC_VER >= 90000
+  return __hadd(::__half(a), ::__half(b));
+#else
   return __hadd(a, b);
+#endif
}
...
...

EIGEN_STRONG_INLINE __device__ half operator / (const half& a, const half& b) {
+#if defined(EIGEN_CUDACC_VER) && EIGEN_CUDACC_VER >= 90000
+  return __hdiv(a, b);
+#else
   float num = __half2float(a);
   float denom = __half2float(b);
   return __float2half(num / denom);
+#endif
 
}

附图一张

 

eigen3 与 cuda10.0兼容问题

相关文章: