使用nvcc进行编译给出“没有这样的文件或目录". [英] Compiling using nvcc gives "No such file or directory"
问题描述
我正在尝试在Ubuntu上使用nvcc编译CUDA代码.但是,当我这样做时,会得到以下输出:
I'm trying to compile CUDA code using nvcc on Ubuntu. However, when I do, I get this output:
> make
/usr/local/cuda/bin/nvcc -m64 --ptxas-options="-v" -gencode arch=compute_11,code=sm_11 -gencode arch=compute_13,code=sm_13 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -o main main.cu
gcc: No such file or directory
make: *** [main] Error 1
即使当我尝试编译仅包含主要功能的文件时,它仍然无法正常工作:
Even when I'm trying to compile a file with only a main function in it, it still doesn't work:
> /usr/local/cuda/bin/nvcc main.cu
gcc: No such file or directory
nvcc似乎对--version做出响应,因此它肯定存在.我不确定为什么要调用gcc.
nvcc seems to respond to --version, so it's definitely there. I'm not sure why it's invoking gcc though.
推荐答案
nvcc本身不是编译器.它是一个编译器驱动程序",用于协调设备代码,主机代码的编译以及将它们链接在一起的整个过程.在Linux上,它使用gcc编译主机代码.
nvcc is not a compiler in itself. It's a "compiler driver", orchestrating the entire process of compiling device code, host code and linking it together. On Linux, it uses gcc for compiling the host code.
要在Ubuntu上安装gcc,请执行以下操作:
To install gcc on Ubuntu:
$ sudo apt-get --yes install build-essential
$ sudo apt-get --yes install build-essential
这篇关于使用nvcc进行编译给出“没有这样的文件或目录".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!