如何禁用所有不需要的 nvcc 编译器警告

How to disable all unwanted nvcc compiler warnings

我在 nvcc 编译器中收到很多警告,例如“已设置但从未使用过 ", "was declared but never referenced", "expression has no effect" 等。在一个 post, someone brute force #prgma for each warning. This is impractical because I have so many warnings. I tried -w, but that didn't work. In another post, someone suggested -Xcompiler "-w" 中,但这对我也不起作用。我怎么能压制所有nvcc 个警告?

根据 documentation--disable-warnings-w 将禁用所有 nvcc(技术上 CUDA 工具链)生成的警告。通常,我建议不要忽略编译器警告。它们的存在是有原因的。