"CMakeCUDACompilerId.cu" failed что делать?
устанавливал дистрибутивы pytorch через cmake cmake
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
project(example-app)
find_package(Torch REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS}")
add_executable(example-app example-app.cpp)
target_link_libraries(example-app "${TORCH_LIBRARIES}")
set_property(TARGET example-app PROPERTY CXX_STANDARD 17)
# The following code block is suggested to be used on Windows.
# According to https://github.com/pytorch/pytorch/issues/25457,
# the DLLs need to be copied to avoid memory errors.
if (MSVC)
file(GLOB TORCH_DLLS "${TORCH_INSTALL_PREFIX}/lib/*.dll")
add_custom_command(TARGET example-app
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${TORCH_DLLS}
$<TARGET_FILE_DIR:example-app>)
endif (MSVC)
вывод в командной строке:
PS C:\example-app> cd build
PS C:\example-app\build> cmake -DCMAKE_PREFIX_PATH=C:\libtorch ..
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.22621.
-- The C compiler identification is MSVC 19.37.32825.0
-- The CXX compiler identification is MSVC 19.37.32825.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found CUDA: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.8 (found version "11.8")
CMake Error at C:/Program Files/CMake/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake:780 (message):
Compiling the CUDA compiler identification source file
"CMakeCUDACompilerId.cu" failed.
Compiler:
Build flags:
Id flags: --keep;--keep-dir;tmp -v
The output was:
1
Версия MSBuild 17.7.2+d6990bcfa для .NET Framework
Сборка начата 06.11.2023 10:47:38.
Проект
"C:\example-app\build\CMakeFiles\3.28.0-rc2\CompilerIdCUDA\CompilerIdCUDA.vcxproj"
в узле 1 (целевые объекты по умолчанию).
PrepareForBuild:
Создание каталога "Debug\".
Создание каталога "Debug\CompilerIdCUDA.tlog\".
InitializeBuildStatus:
Создание "Debug\CompilerIdCUDA.tlog\unsuccessfulbuild", так как было задано "AlwaysCreate".
Обращение к "Debug\CompilerIdCUDA.tlog\unsuccessfulbuild".
AddCudaCompileDeps:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.37.32822\bin\HostX64\x64\cl.exe /E /nologo /showIncludes /TP /D__CUDACC__ /D__CUDACC_VER_MAJOR__=12 /D__CUDACC_VER_MINOR__=3 /D_MBCS /Iinclude /Ibin /Iinclude /I. /FIcuda_runtime.h /c C:\example-app\build\CMakeFiles\3.28.0-rc2\CompilerIdCUDA\CMakeCUDACompilerId.cu
C:\Program Files\Microsoft Visual
Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA
12.3.targets(606,9): error : The CUDA Toolkit v12.3 directory '' does not
exist. Please verify the CUDA Toolkit is installed properly or define the
CudaToolkitDir property to resolve this error.
[C:\example-app\build\CMakeFiles\3.28.0-rc2\CompilerIdCUDA\CompilerIdCUDA.vcxproj]
Сборка проекта
"C:\example-app\build\CMakeFiles\3.28.0-rc2\CompilerIdCUDA\CompilerIdCUDA.vcxproj"
завершена (целевые объекты по умолчанию)
с ошибкой.
Ошибка сборки.
"C:\example-app\build\CMakeFiles\3.28.0-rc2\CompilerIdCUDA\CompilerIdCUDA.vcxproj"
(целевой объект по умолчанию) (1) ->
(Целевой объект ValidateCudaBuild) ->
C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\CUDA 12.3.targets(606,9): error : The CUDA Toolkit v12.3 directory '' does not exist. Please verify the CUDA Toolkit is installed properly or define the CudaToolkitDir property to resolve this error. [C:\example-app\build\CMakeFiles\3.28.0-rc2\CompilerIdCUDA\CompilerIdCUDA.vcxproj]
Предупреждений: 0
Ошибок: 1
Прошло времени 00:00:00.35
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake:8 (CMAKE_DETERMINE_COMPILER_ID_BUILD)
C:/Program Files/CMake/share/cmake-3.28/Modules/CMakeDetermineCompilerId.cmake:53 (__determine_compiler_id_test)
C:/Program Files/CMake/share/cmake-3.28/Modules/CMakeDetermineCUDACompiler.cmake:135 (CMAKE_DETERMINE_COMPILER_ID)
C:/libtorch/share/cmake/Caffe2/public/cuda.cmake:47 (enable_language)
C:/libtorch/share/cmake/Caffe2/Caffe2Config.cmake:87 (include)
C:/libtorch/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
CMakeLists.txt:4 (find_package)
-- Configuring incomplete, errors occurred!
PS C:\example-app\build>
Помогите разобраться с этой проблемой, действовал строго согласно туториалу по установке на сайте https://pytorch.org/cppdocs/installing.html# Установлена cuda toolkit v11.8 с официального сайта cuda , в переменных среды path путь к cuda указан