NVCC 致命:未知选项'--threads'



我已经安装了CUDA-11.3和NVIDIA驱动程序版本465,CMAKE版本3.16.3。我试图编译工具包中包含的示例来验证安装,但出现了以下错误。

make[1]: Entering directory '/home/user/NVIDIA_CUDA-11.3_Samples/0_Simple/simpleSeparateCompilation'
/usr/local/cuda/bin/nvcc -ccbin g++ -I../../common/inc  -m64    -dc --threads 0 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_37,code=sm_37 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_52,code=sm_52 -gencode arch=compute_60,code=sm_60 -gencode arch=compute_61,code=sm_61 -gencode arch=compute_70,code=sm_70 -gencode arch=compute_75,code=sm_75 -gencode arch=compute_80,code=sm_80 -gencode arch=compute_86,code=sm_86 -gencode arch=compute_86,code=compute_86 -o simpleDeviceLibrary.o -c simpleDeviceLibrary.cu
nvcc fatal   : Unknown option '--threads'
make[1]: *** [Makefile:321: simpleDeviceLibrary.o] Error 1
make[1]: Leaving directory '/home/user/NVIDIA_CUDA-11.3_Samples/0_Simple/simpleSeparateCompilation'
make: *** [Makefile:51: 0_Simple/simpleSeparateCompilation/Makefile.ph_build] Error 2

--threads选项(控制nvcc在编译期间尝试生成的线程数(仅添加到nvcc11.3中。

OP无意中使用nvcc11.1尝试使用提供的Makefiles编译CUDA 11.3工具包中的样本,其中包括此选项。这导致了无法识别的选项错误和生成失败。

如果你有这个问题,请仔细检查你的编译器是否足够新,可以接受这个编译器选项,并且搜索路径/symlinks/modulefiles等是否真的更新到指向那个编译器版本。

最新更新