【发布时间】:2018-10-01 02:58:12
【问题描述】:
我在尝试使用 -std=c++11 标志编译 CUDA 代码时遇到错误。
error: more than one instance of overloaded function "isnan" matches the argument list:
function "isnan(float)"
function "std::isnan(float)"
argument types are: (r32)
(r32 是 typedef 对应于 float)
我找到了this question,其中的答案建议根本不指定 C++11 来解决问题,我不能这样做,因为我正在使用 C++11 的一些功能,例如 constexpr 和 lambdas。有没有办法在打开 C++11 功能的情况下进行编译,并且仍然可以解决这种歧义?
我正在使用以下命令进行编译:
nvcc -I/my/include/path/1 -I/usr/local/cuda/include src/myfile.cu -o build/myfile.o -arch=sm_61 -c --compiler-options -fPIC -Xcudafe -std=c++11
编译器版本为:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Tue_Jan_10_13:22:03_CST_2017
Cuda compilation tools, release 8.0, V8.0.61
任何帮助或建议将不胜感激。谢谢!
【问题讨论】:
-
这是什么CUDA版本?
-
我更新了问题。是CUDA 8.0
-
自 CUDA 8 以来,该工具链已经发布了五个版本。您是否考虑过测试更新的版本?
-
其实我没试过。我将安装最新版本,看看它是否可以编译。
-
我检查了版本 10.0.130,它似乎解决了这个问题。谢谢!如果您将评论作为答案,我将接受它以关闭问题