报错 The CUDA compiler identification is unknown;No CMAKE_CUDA_COMPILER could be found.

 在cmake的编译过程中,可能会报找不到cuda编译器的错误,如下

-- The CUDA compiler identification is unknown
CMake Error at CMakeLists.txt:3 (enable_language):
  No CMAKE_CUDA_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CUDACXX" or the CMake cache entry CMAKE_CUDA_COMPILER to the full
  path to the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!
See also "/home/aaeon/work/yolo-tensorrt/build/CMakeFiles/CMakeOutput.log".
See also "/home/aaeon/work/yolo-tensorrt/build/CMakeFiles/CMakeError.log".

解决办法就是找到cuda编译器所在位置,然后指定给cmake。

1、找到cuda安装所在位置

查看/usr/local,该文件夹下一般保存有你下载的cuda文件以及一个cuda软连接文件,如图

 其中的cuda-10.2就是我自己下载的cuda,版本是10.2;而cuda则是指向cuda-10.2的软连接文件。

当你下载多个版本的cuda时,cuda软连接文件指向其中一个你指定的cuda版本,具体哪个版本,可以输入nvcc --version查看。

2、指定cuda编译器

cmake -D CMAKE_CUDA_COMPILER="/usr/local/cuda/bin/nvcc" CMmakeLists.txt

版权声明:本文为CSDN博主「wangxinRS」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_30841655/article/details/120523225

wangxinRS

我还没有学会写个人说明!

暂无评论

发表评论

相关推荐

Jetson nano上使用ncnn部署yolox

序言 之前一篇文章写yolox的训练,这篇文章写一下关于部署,yolox之所以刚出来就这么火爆,不仅是精度高、速度快,很大程度上还是因为直接把部署的代码叶开源了,可谓是从训

torch.nn.CrossEntropyLoss用法

前言 早上想花一个小时参照网上其他教程,修改模型结构,写一个手写识别数字的出来,结果卡在了这个上面,loss一直降不下来,然后我就去查看了一下CrossEntropyLos