Compiling using nvcc gives “No such file or directory”

耗尽温柔 提交于 2021-02-17 06:04:10

问题


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 seems to respond to --version, so it's definitely there. I'm not sure why it's invoking gcc though.


回答1:


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.

To install gcc on Ubuntu:

$ sudo apt-get --yes install build-essential



来源:https://stackoverflow.com/questions/20157465/compiling-using-nvcc-gives-no-such-file-or-directory

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!