Failed to compute shorthash for libnvrtc.so
следовал согласно инструкции по установки c++ pytorch https://pytorch.org/cppdocs/installing.html скачал cuda toolkit с официального сайта 12.1 , скачал пакет libtorch с cuda 12. 1 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)
создал build в терминале и ввел команду cmake -DCMAKE_PREFIX_PATH=C:\libtorch .. получил ответ:
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/v12.1 (found version "12.1")
-- The CUDA compiler identification is NVIDIA 12.1.66
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.1/bin/nvcc.exe - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- Found CUDAToolkit: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.1/include (found version "12.1.66")
-- Caffe2: CUDA detected: 12.1
-- Caffe2: CUDA nvcc is: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.1/bin/nvcc.exe
-- Caffe2: CUDA toolkit directory: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.1
-- Caffe2: Header version is: 12.1
Python CMake Warning at C:/libtorch/share/cmake/Caffe2/public/cuda.cmake:185 (message):
Failed to compute shorthash for libnvrtc.so
Call Stack (most recent call first):
C:/libtorch/share/cmake/Caffe2/Caffe2Config.cmake:87 (include)
C:/libtorch/share/cmake/Torch/TorchConfig.cmake:68 (find_package)
CMakeLists.txt:4 (find_package)
-- USE_CUDNN is set to 0. Compiling without cuDNN support
-- USE_CUSPARSELT is set to 0. Compiling without cuSPARSELt support
-- Autodetected CUDA architecture(s): 7.5
-- Added CUDA NVCC flags for: -gencode;arch=compute_75,code=sm_75
-- Found Torch: C:/libtorch/lib/torch.lib
-- Configuring done (18.4s)
-- Generating done (0.1s)
-- Build files have been written to: C:/example-app/build
PS C:\example-app\build>
не знаю почему, но почему-то все идет не так как нужно, подозреваю что проблема в этом:
Python CMake Warning at C:/libtorch/share/cmake/Caffe2/public/cuda.cmake:185 (message): Failed to compute shorthash for libnvrtc.so
как должно быть:
root@4b5a67132e81:/example-app/build# cmake --build . --config Release
Scanning dependencies of target example-app
[ 50%] Building CXX object CMakeFiles/example-app.dir/example-app.cpp.o
[100%] Linking CXX executable example-app
[100%] Built target example-app
как у меня:
Версия MSBuild 17.7.2+d6990bcfa для .NET Framework
1>Checking Build System
Building Custom Rule C:/example-app/CMakeLists.txt
example-app.cpp
Создается библиотека C:/example-app/build/Release/example-app.lib и объект C:/example-app/build/Release/example-app.exp
example-app.vcxproj -> C:\example-app\build\Release\example-app.exe
Building Custom Rule C:/example-app/CMakeLists.txt
помогите пожалуйста