NVCC and Boost 1.60 error: identifier "__float128" is undefined

NVCC and Boost 1.60 error: identifier "__float128" is undefined

我正在尝试从 BVLC (https://github.com/BVLC/caffe) 编译 caffe,但我 运行 遇到了一个奇怪的错误:

NVCC src/caffe/util/math_functions.cu
/usr/local/boost/config/suffix.hpp(510): error: identifier "__float128" is undefined

当 运行ning nvcc on boost 时,它似乎在抱怨 __float128 类型。

我用谷歌搜索并找到了一个 devtalk.nvidia forum post 但我真的不明白如何解决这个问题。

我什至打开了 a github issue 但还没有收到回复。

我在 Debian 8 上使用带有 gcc-4.8.4 的 nvcc-6.5 boost 1.60(我手动安装了 boost)并且违规行似乎在行 #510:

 506 // same again for __float128:                                                                                                          
 507 #if defined(BOOST_HAS_FLOAT128) && defined(__cplusplus)                                                                                
 508 namespace boost {                                                                                                                      
 509 #  ifdef __GNUC__                                                                                                                      
 510    __extension__ typedef __float128 float128_type;                                                                                     
 511 #  else                                                                                                                                
 512    typedef __float128 float128_type;                                                                                                   
 513 #  endif                                                                                                                               
 514 }                                                                                                                                      
 515 #endif    

A similar issue in fftw3 似乎暗示 nvcc 自认为是 __GNUC__ 从而造成问题?

是否有一些解决方法?

根据 bug report for boost 这实际上是 boost 1.60 的问题。

您有多种选择:

  • 在 link 中提到 nvcc(来自 CUDA 7.5)如果使用 -std=c++11 可以处理 __float128。您需要检查这是否是 caffee.
  • 的选项
  • 您可以尝试将 boost 降级到 1.59(问题行是在 1.60 中引入的)。
  • 应用 link 中提到的补丁。

我遇到了同样的问题。构建和安装 boost 1.61 解决了这个问题。