-3

我一直在 Visual C++ CUDA 项目中使用 Boost。我regex.hpp在一个.cu文件中使用它,它以这种方式包含它工作正常:

#include < boost / regex.hpp >

现在,我需要使用abs.hpp,我以这种方式包括在内:

#include < boost / ratio / detail / mpl / abs.hpp >

并且在编译时失败。我正在使用 Windows 8 64 位、Visual Studio 2012、Boost 1.53.0 和 CUDA 5.5。

只有将其放入我的代码中,我才会收到此错误: #include < boost / ratio / detail / mpl / abs.hpp >

无需使用更多与 Boost 相关的说明。我的项目中有几个.cpp.cu文件。如果我把那个包含在一个.cpp文件中,它编译得很好。如果我将它包含在 a 中.cu,则会出现此错误:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\boost/ratio/detail/mpl/abs.hpp(68): error C2675: unary '-' : 'T' 未定义此运算符或转换为预定义运算符可接受的类型

感谢您提供的任何帮助,并对我的英语感到抱歉,这不是我的母语!

4

1 回答 1

1

Nvidia 提供了许多内置的数学函数。您通常不能在 CUDA 内核中使用为 CPU 编写的函数,因为它们可能会缺少__device__装饰器。

于 2013-08-29T19:27:01.110 回答