CUDA:重载函数"isnan"的多个实例

CUDA: more than one instance of overloaded function `isnan`

本文关键字:quot 实例 isnan 重载 CUDA 函数      更新时间:2023-10-16

我在尝试使用-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)

(r32floattypedef(

我发现了这个问题,其中的答案建议简单地不指定 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 8 发布编译器的问题,但它已针对 CUDA 9 版本进行了修复,任何遇到此问题的人都应该升级到 CUDA 9 或更高版本。

[此答案是根据评论收集而成的,并作为社区维基答案添加]