找不到CMAKE_CUDA_COMPILER

时间:2019-03-07 13:21:37

标签: cmake cuda

我正在尝试为CMake生成一个构建系统,但是这向我抛出了一个错误,我好几天都没有设法修复。我已经安装了VC 2017和CUDA最新版本。

在我的目录中,我创建了构建目录并运行:

cmake ..

此后,它开始创建它,但是找不到CUDA编译器

C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build>cmake ..

-- Building for: Visual Studio 15 2017
-- The CXX compiler identification is MSVC 19.16.27027.1
-- The CUDA compiler identification is unknown
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:5 (project):

>  No CMAKE_CUDA_COMPILER could be found.

>-- Configuring incomplete, errors occurred!
See also "C:/Users/lenovo/Documents/Fax/4/Lasersko skeniranje/Projekat/Open3D-PointNet2-Semantic3D/tf_ops/build/CMakeFiles/CMakeOutput.log".

日志文件显示:

    Compiling the CUDA compiler identification source file "CMakeCUDACompilerId.cu" failed.
Compiler:  
Build flags: 
Id flags:  -v;--keep;--keep-dir;tmp

The output was:
1
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 07-Mar-19 14:14:03.
Project "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" on node 1 (default targets).
PrepareForBuild:
  Creating directory "Debug\".
  Creating directory "Debug\CompilerIdCUDA.tlog\".
InitializeBuildStatus:
  Creating "Debug\CompilerIdCUDA.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
AddCudaCompileDeps:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.exe /E /nologo /showIncludes /TP /D__CUDACC__ /D_MBCS /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" /I. /FIcuda_runtime.h /c "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CMakeCUDACompilerId.cu" 
Project "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (1) is building "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (1:2) on node 1 (CudaBuildCore target(s)).
CudaBuildCore:
  Compiling CUDA source file CMakeCUDACompilerId.cu...
  cmd.exe /C "C:\Users\lenovo\AppData\Local\Temp\tmp5b923de4e22e4f04be6ba6f85d34ca98.cmd"
  "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"  -G   --keep-dir Debug -maxrregcount=0  --machine 32 --compile -cudart static  -g   -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc141.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CMakeCUDACompilerId.cu"

  C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"  -G   --keep-dir Debug -maxrregcount=0  --machine 32 --compile -cudart static  -g   -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc141.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CMakeCUDACompilerId.cu" 
  nvcc fatal   : 32 bit compilation is only supported for Microsoft Visual Studio 2013 and earlier
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\BuildCustomizations\CUDA 10.1.targets(757,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"  -G   --keep-dir Debug -maxrregcount=0  --machine 32 --compile -cudart static  -g   -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc141.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CMakeCUDACompilerId.cu"" exited with code 1. [C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj]
Done Building Project "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (CudaBuildCore target(s)) -- FAILED.
Done Building Project "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (default targets) -- FAILED.

Build FAILED.

"C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (default target) (1) ->
"C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (CudaBuildCore target) (1:2) ->
(CudaBuildCore target) -> 
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\BuildCustomizations\CUDA 10.1.targets(757,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"  -G   --keep-dir Debug -maxrregcount=0  --machine 32 --compile -cudart static  -g   -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc141.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CMakeCUDACompilerId.cu"" exited with code 1. [C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj]

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:02.74


Compiling the CUDA compiler identification source file "CMakeCUDACompilerId.cu" failed.
Compiler:  
Build flags: 
Id flags:  -v;--keep;--keep-dir;tmp

The output was:
1
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 07-Mar-19 14:14:06.
Project "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" on node 1 (default targets).
PrepareForBuild:
  Creating directory "Debug\".
  Creating directory "Debug\CompilerIdCUDA.tlog\".
InitializeBuildStatus:
  Creating "Debug\CompilerIdCUDA.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
AddCudaCompileDeps:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.exe /E /nologo /showIncludes /TP /D__CUDACC__ /D_MBCS /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin" /I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" /I. /FIcuda_runtime.h /c "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CMakeCUDACompilerId.cu" 
Project "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (1) is building "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (1:2) on node 1 (CudaBuildCore target(s)).
CudaBuildCore:
  Compiling CUDA source file CMakeCUDACompilerId.cu...
  cmd.exe /C "C:\Users\lenovo\AppData\Local\Temp\tmp6a6113e32a54449682bdc11103da68f9.cmd"
  "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"  -G   --keep-dir Debug -maxrregcount=0  --machine 32 --compile -cudart static  -g   -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc141.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CMakeCUDACompilerId.cu"

  C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"  -G   --keep-dir Debug -maxrregcount=0  --machine 32 --compile -cudart static  -g   -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc141.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CMakeCUDACompilerId.cu" 
  nvcc fatal   : 32 bit compilation is only supported for Microsoft Visual Studio 2013 and earlier
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\BuildCustomizations\CUDA 10.1.targets(757,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"  -G   --keep-dir Debug -maxrregcount=0  --machine 32 --compile -cudart static  -g   -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc141.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CMakeCUDACompilerId.cu"" exited with code 1. [C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj]
Done Building Project "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (CudaBuildCore target(s)) -- FAILED.
Done Building Project "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (default targets) -- FAILED.

Build FAILED.

"C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (default target) (1) ->
"C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj" (CudaBuildCore target) (1:2) ->
(CudaBuildCore target) -> 
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\BuildCustomizations\CUDA 10.1.targets(757,9): error MSB3721: The command ""C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin\nvcc.exe" -gencode=arch=compute_35,code=\"sm_35,compute_35\" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86" -x cu  -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include"  -G   --keep-dir Debug -maxrregcount=0  --machine 32 --compile -cudart static  -g   -D_MBCS -Xcompiler "/EHsc /W0 /nologo /Od /FdDebug\vc141.pdb /FS /Zi /RTC1 /MDd " -o Debug\CMakeCUDACompilerId.cu.obj "C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CMakeCUDACompilerId.cu"" exited with code 1. [C:\Users\lenovo\Documents\Fax\4\Lasersko skeniranje\Projekat\Open3D-PointNet2-Semantic3D\tf_ops\build\CMakeFiles\3.13.3\CompilerIdCUDA\CompilerIdCUDA.vcxproj]

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:02.65

有什么主意吗?我似乎无法解决问题...我正在运行Win10

3 个答案:

答案 0 :(得分:1)

根据日志,问题是编译nvcc fatal : 32 bit compilation is only supported for Microsoft Visual Studio 2013 and earlier时的CMakeCUDACompilerId.cu,CMake在内部使用它来确保编译器正常工作。

由于某些原因,CMake决定以32位编译该文件,现在不再支持。由于未指定CMake版本,因此建议您更新CMake。

答案 1 :(得分:1)

看起来您应该手动指定nvcc 的完整路径。不过,我不喜欢这个主意。

您可以这样做:

cmake -DCMAKE_CUDA_COMPILER:PATH=/usr/local/cuda/bin/nvcc ...other cmake options...

这将按预期进行编译,只是不会自动添加include文件夹。我仍在研究如何处理第二部分而不包含FindCUDA.cmake文件。

答案 2 :(得分:0)

尝试 cmake -G "Microsoft Visual Studio 15 2017 Win64" ..