我用gcc 4.8.4和cuda8.0来解决和nvcc之间的冲突。当我在a.cu中编译以下代码时:
#include <parallel/algorithm>
int main(){
}
使用cmd:nvcc -std=c++11 -arch=sm_20 a.cu -o a.o
,我收到以下错误消息:
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
/usr/include/c++/4.8/tr1/cmath(423): error: function "acosh(float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(439): error: function "asinh(float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(456): error: function "atanh(float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(470): error: function "cbrt(float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(486): error: function "copysign(float, float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(505): error: function "erf(float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(519): error: function "erfc(float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(535): error: function "exp2(float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(549): error: function "expm1(float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(587): error: function "fdim(float, float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(605): error: function "fma(float, float, float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(621): error: function "fmax(float, float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(637): error: function "fmin(float, float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(656): error: function "hypot(float, float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(672): error: function "ilogb(float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(688): error: function "lgamma(float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(702): error: function "llrint(float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(716): error: function "llround(float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(733): error: function "log1p(float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(748): error: function "log2(float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(762): error: function "logb(float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(778): error: function "lrint(float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(792): error: function "lround(float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(806): error: function "nearbyint(float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(820): error: function "nextafter(float, float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(854): error: function "remainder(float, float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(870): error: function "remquo(float, float, int *)" has already been defined
/usr/include/c++/4.8/tr1/cmath(886): error: function "rint(float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(900): error: function "round(float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(914): error: function "scalbln(float, long)" has already been defined
/usr/include/c++/4.8/tr1/cmath(928): error: function "scalbn(float, int)" has already been defined
/usr/include/c++/4.8/tr1/cmath(948): error: function "tgamma(float)" has already been defined
/usr/include/c++/4.8/tr1/cmath(962): error: function "trunc(float)" has already been defined
33 errors detected in the compilation of "/tmp/tmpxft_00001e82_00000000-9_a.cpp1.ii".
我认为这是gcc并行模式STL代码和nvcc之间的冲突。 你有解决方法吗?任何信息都会有所帮助,谢谢!