【问题标题】:How to add the path of CUDA compiler in CMake under WSL?WSL下如何在CMake中添加CUDA编译器的路径?
【发布时间】:2019-12-08 05:55:59
【问题描述】:

我在 Windows 上使用 Ubuntu(在 WSL 中),我有 CMake 3.10.1 和 CUDA Toolkit 9.0。当我跑步时

cmake ..

我收到了这个错误:

CMake Error at CMakeLists.txt:5 (project):
  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 "/mnt/d/Open3D-PointNet2-Semantic3D-master/tf_ops/build/CMakeFiles/CMakeOutput.log".
See also "/mnt/d/Open3D-PointNet2-Semantic3D-master/tf_ops/build/CMakeFiles/CMakeError.log".

是否可以在 WSL 中链接 CUDA 和 CMake?如何添加 CUDA 的路径?

【问题讨论】:

    标签: windows cmake cuda windows-subsystem-for-linux


    【解决方案1】:

    你可以使用:

    cmake -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-10.1 ..
    

    只需将路径更改为您安装的位置


    可以使用命令在 WSL 上安装 cuda:

    sudo apt-get install nvidia-cuda-toolkit
    

    cmake 然后可以找到构建的路径。但可执行文件无法在 WSL 上运行,因为 Nvidia 还不支持。

    【讨论】:

    • 我用过:cmake -DCUDA_TOOLKIT_ROOT_DIR="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0" ,现在这里是错误: CMake Error: The source directory "/" does似乎不包含 CMakeLists.txt。
    • @user77540 你应该 cd 到你的构建目录并给出源的相对路径。我写的命令末尾的..
    • 如果你在windows上使用ubuntu,你不想指的是CUDA的windows安装。你应该有一个 CUDA 的 linux 安装。
    • 你能解释更多吗@RobertCrovella
    • @user77540 你知道你不能在你的 WSL 上使用 GPU 吗?
    猜你喜欢
    • 2019-10-07
    • 1970-01-01
    • 2017-01-19
    • 2021-05-24
    • 2015-04-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-06
    相关资源
    最近更新 更多