<bdo id='VgEwV'></bdo><ul id='VgEwV'></ul>
  • <legend id='VgEwV'><style id='VgEwV'><dir id='VgEwV'><q id='VgEwV'></q></dir></style></legend>

    <small id='VgEwV'></small><noframes id='VgEwV'>

    <i id='VgEwV'><tr id='VgEwV'><dt id='VgEwV'><q id='VgEwV'><span id='VgEwV'><b id='VgEwV'><form id='VgEwV'><ins id='VgEwV'></ins><ul id='VgEwV'></ul><sub id='VgEwV'></sub></form><legend id='VgEwV'></legend><bdo id='VgEwV'><pre id='VgEwV'><center id='VgEwV'></center></pre></bdo></b><th id='VgEwV'></th></span></q></dt></tr></i><div id='VgEwV'><tfoot id='VgEwV'></tfoot><dl id='VgEwV'><fieldset id='VgEwV'></fieldset></dl></div>

    <tfoot id='VgEwV'></tfoot>
      1. 如何让 cmake 找到 CUDA

        时间:2023-08-27
        <i id='oTuRd'><tr id='oTuRd'><dt id='oTuRd'><q id='oTuRd'><span id='oTuRd'><b id='oTuRd'><form id='oTuRd'><ins id='oTuRd'></ins><ul id='oTuRd'></ul><sub id='oTuRd'></sub></form><legend id='oTuRd'></legend><bdo id='oTuRd'><pre id='oTuRd'><center id='oTuRd'></center></pre></bdo></b><th id='oTuRd'></th></span></q></dt></tr></i><div id='oTuRd'><tfoot id='oTuRd'></tfoot><dl id='oTuRd'><fieldset id='oTuRd'></fieldset></dl></div>
          <tbody id='oTuRd'></tbody>

        <small id='oTuRd'></small><noframes id='oTuRd'>

            <tfoot id='oTuRd'></tfoot>
          • <legend id='oTuRd'><style id='oTuRd'><dir id='oTuRd'><q id='oTuRd'></q></dir></style></legend>

              • <bdo id='oTuRd'></bdo><ul id='oTuRd'></ul>
                1. 本文介绍了如何让 cmake 找到 CUDA的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试构建这个项目,它具有 CUDA 作为依赖项.但是cmake脚本在系统上找不到CUDA安装:

                  I am trying to build this project, which has CUDA as a dependency. But the cmake script cannot find the CUDA installation on the system:

                  cls ~/workspace/gpucluster/cluster/build $ cmake ..
                  -- The C compiler identification is GNU 4.7.1
                  -- The CXX compiler identification is GNU 4.7.1
                  -- Check for working C compiler: /usr/bin/gcc
                  -- Check for working C compiler: /usr/bin/gcc -- works
                  -- Detecting C compiler ABI info
                  -- Detecting C compiler ABI info - done
                  -- Check for working CXX compiler: /usr/bin/c++
                  -- Check for working CXX compiler: /usr/bin/c++ -- works
                  -- Detecting CXX compiler ABI info
                  -- Detecting CXX compiler ABI info - done
                  CMake Error at /usr/share/cmake/Modules/FindCUDA.cmake:488 (message):
                    Specify CUDA_TOOLKIT_ROOT_DIR
                  Call Stack (most recent call first):
                    CMakeLists.txt:20 (find_package)
                  

                  -- 配置不完整,出现错误!

                  -- Configuring incomplete, errors occurred!

                  我尝试将它作为环境变量添加到 .bashrc,但没有效果:

                  I've tried adding it as an environment variable to .bashrc, to no effect:

                  export CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-5.5
                  

                  我如何正确指定CUDA_TOOLKIT_ROOT_DIR?

                  推荐答案

                  cmake 提到 CUDA_TOOLKIT_ROOT_DIR 作为 cmake 变量,而不是环境变量.这就是为什么当您将其放入 .bashrc 时它不起作用的原因.如果您查看 FindCUDA.cmake,它会清楚地说明:

                  cmake mentioned CUDA_TOOLKIT_ROOT_DIR as cmake variable, not environment one. That's why it does not work when you put it into .bashrc. If you look into FindCUDA.cmake it clearly says that:

                  如果前缀为 CUDA_TOOLKIT_ROOT_DIR,脚本将提示用户指定无法通过系统路径中 nvcc 的位置来确定并且需要指定给 find_package().要使用不同的已安装版本工具包在运行 cmake 之前设置环境变量 CUDA_BIN_PATH(例如 CUDA_BIN_PATH=/usr/local/cuda1.0 而不是默认的/usr/local/cuda)或在配置后设置 CUDA_TOOLKIT_ROOT_DIR.如果你改变值CUDA_TOOLKIT_ROOT_DIR,各种依赖路径的组件都会被搬迁.

                  The script will prompt the user to specify CUDA_TOOLKIT_ROOT_DIR if the prefix cannot be determined by the location of nvcc in the system path and REQUIRED is specified to find_package(). To use a different installed version of the toolkit set the environment variable CUDA_BIN_PATH before running cmake (e.g. CUDA_BIN_PATH=/usr/local/cuda1.0 instead of the default /usr/local/cuda) or set CUDA_TOOLKIT_ROOT_DIR after configuring. If you change the value of CUDA_TOOLKIT_ROOT_DIR, various components that depend on the path will be relocated.

                  因此将 CUDA_BIN_PATH 放入 .bashrc 或指定 CUDA_TOOLKIT_ROOT_DIR 到 cmake:

                  So put CUDA_BIN_PATH into .bashrc or specify CUDA_TOOLKIT_ROOT_DIR to cmake:

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

                  这篇关于如何让 cmake 找到 CUDA的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:#ifdef DEBUG 与 CMake 独立于平台 下一篇:Catch lib(单元测试)和 CTest(CMake)集成

                  相关文章

                      <legend id='TWRxU'><style id='TWRxU'><dir id='TWRxU'><q id='TWRxU'></q></dir></style></legend>
                      <tfoot id='TWRxU'></tfoot>
                      • <bdo id='TWRxU'></bdo><ul id='TWRxU'></ul>

                      <i id='TWRxU'><tr id='TWRxU'><dt id='TWRxU'><q id='TWRxU'><span id='TWRxU'><b id='TWRxU'><form id='TWRxU'><ins id='TWRxU'></ins><ul id='TWRxU'></ul><sub id='TWRxU'></sub></form><legend id='TWRxU'></legend><bdo id='TWRxU'><pre id='TWRxU'><center id='TWRxU'></center></pre></bdo></b><th id='TWRxU'></th></span></q></dt></tr></i><div id='TWRxU'><tfoot id='TWRxU'></tfoot><dl id='TWRxU'><fieldset id='TWRxU'></fieldset></dl></div>

                      <small id='TWRxU'></small><noframes id='TWRxU'>