I am trying to compile a test program with Pytorch in C++. Ideally I would like to load a model and perform inference using C++. I downloaded libtorch 1.10.2 with no GPU (I double checked it), however I get an error as there is no CUDA toolkit.
I am developing on an old Macbook Pro 9.2 running Linux Mint 20.2 x86_64.
Has anyone solved this?
My project dir:
inference |-inference.cpp |-CMakeLists.txt |-build/ |-libtorch/
I am running this command:
cmake -DCMAKE_PREFIX_PATH=/home/gmguarino/Documenti/Exercises/C++/inference/libtorch ..
And getting the following error:
CUDA_TOOLKIT_ROOT_DIR not found or specified -- Could NOT find CUDA (missing: CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY) CMake Warning at .venv/lib/python3.8/site-packages/torch/share/cmake/Caffe2/public/cuda.cmake:31 (message): Caffe2: CUDA cannot be found. Depending on whether you are building Caffe2 or a Caffe2 dependent library, the next warning / error will give you more info. Call Stack (most recent call first): .venv/lib/python3.8/site-packages/torch/share/cmake/Caffe2/Caffe2Config.cmake:88 (include) libtorch/share/cmake/Torch/TorchConfig.cmake:68 (find_package) CMakeLists.txt:17 (find_package) CMake Error at .venv/lib/python3.8/site-packages/torch/share/cmake/Caffe2/Caffe2Config.cmake:90 (message): Your installed Caffe2 version uses CUDA but I cannot find the CUDA libraries. Please set the proper CUDA prefixes and / or install CUDA. Call Stack (most recent call first): libtorch/share/cmake/Torch/TorchConfig.cmake:68 (find_package) CMakeLists.txt:17 (find_package)