I’m new to PyTorch and CMake and desperately trying to carry out the tutorial “Installing C++ Distributions of PyTorch”. It has been now 6 hours i’ve been solving problems one after the other.
Now, I’m trying to execute these commands :
"We can now run the following commands to build the application from within the example-app/ folder:
mkdir build
cd build
cmake -DCMAKE_PREFIX_PATH=/absolute/path/to/libtorch …
make
"
First, it took me many hours to solve issues with cmake but the right command i had to write is
“cmake -DCMAKE_PREFIX_PATH=…/libtorch … -Ax64 - DCMAKE_BUILD_TYPE=Debug”
And it finally seems to work fine
but then when I try
“make”
I just get an error message saying “No target specified and no makefile found. Stopped.”
You are right, there are only two dots (what is their role by the way ?) (edit: the third one seems to have been added by the forum since there are only two in my text)
Here are the error message when using the basic command line
CMake Error at D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Caffe2/public/cuda.cmake:283 (message):
CUDA support not available with 32-bit windows. Did you forget to set
Win64 in the generator target?
Call Stack (most recent call first):
D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Caffe2/Caffe2Config.cmake:88 (include)
D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Torch/TorchConfig.cmake:39 (find_package)
CMakeLists.txt:3 (find_package)
It seems to work as well as -Ax64 yet I still have this warning message -- Added CUDA NVCC flags for: -gencode;arch=compute_50,code=sm_50
CMake Warning (dev) at D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Caffe2/public/utils.cmake:57 (if):
Policy CMP0054 is not set: Only interpret if() arguments as variables or
keywords when unquoted. Run “cmake --help-policy CMP0054” for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
Quoted variables like “MSVC” will no longer be dereferenced when the policy
is set to NEW. Since the policy is not set the OLD behavior will be used.
Call Stack (most recent call first):
D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Caffe2/Caffe2Config.cmake:121 (caffe2_interface_library)
D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Torch/TorchConfig.cmake:39 (find_package)
CMakeLists.txt:3 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Torch/TorchConfig.cmake:72 (if):
Policy CMP0054 is not set: Only interpret if() arguments as variables or
keywords when unquoted. Run “cmake --help-policy CMP0054” for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
Quoted variables like “MSVC” will no longer be dereferenced when the policy
is set to NEW. Since the policy is not set the OLD behavior will be used.
Call Stack (most recent call first):
CMakeLists.txt:3 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
Anyway, the “make” command still doesn’t find anything afterward…
Following the Tutorial from the beginning still doesn’t work.
“cmake” command seems to not generate the required files since make can’t find any. Yet I stick to the tutorial…
Here is the result of the cmake command if someone can help me…
– Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.17134.
– Caffe2: CUDA detected: 10.0
– Caffe2: CUDA nvcc is: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0/bin/nvcc.exe
– Caffe2: CUDA toolkit directory: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0
– Caffe2: Header version is: 10.0
– Found cuDNN: v7.4.2 (include: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0/include, library: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0/lib/x64/cudnn.lib)
– Autodetected CUDA architecture(s): 5.0
– Added CUDA NVCC flags for: -gencode;arch=compute_50,code=sm_50
CMake Warning (dev) at D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Caffe2/public/utils.cmake:57 (if):
Policy CMP0054 is not set: Only interpret if() arguments as variables or
keywords when unquoted. Run “cmake --help-policy CMP0054” for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
Quoted variables like “MSVC” will no longer be dereferenced when the policy
is set to NEW. Since the policy is not set the OLD behavior will be used.
Call Stack (most recent call first):
D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Caffe2/Caffe2Config.cmake:121 (caffe2_interface_library)
D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Torch/TorchConfig.cmake:39 (find_package)
CMakeLists.txt:3 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
CMake Warning (dev) at D:/Yggdrasil/Programmation/PyTorch/libtorch/share/cmake/Torch/TorchConfig.cmake:72 (if):
Policy CMP0054 is not set: Only interpret if() arguments as variables or
keywords when unquoted. Run “cmake --help-policy CMP0054” for policy
details. Use the cmake_policy command to set the policy and suppress this
warning.
Quoted variables like “MSVC” will no longer be dereferenced when the policy
is set to NEW. Since the policy is not set the OLD behavior will be used.
Call Stack (most recent call first):
CMakeLists.txt:3 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
– Configuring done
– Generating done
– Build files have been written to: C:/Users/Clément/Documents/Visual Studio 2017/Projects/PyTorchTest/build
maybe is not what you are looking for but for compiling on windows you can use this command cmake --build . --config Release to create .exe with torchlib inside build folder after cmake command.
My issue is that when running “cmake --build . -config Release”, I am prompted with the following error:
C:\bd\Features\PyTorch\libtorch\include\c10/util/variant.h(1187): error C2872: ‘std’: ambiguous symbol [C:\bd\Features
PyTorch\example-app\build\example-app.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\forward_list(15): note: could be ‘std’
C:\bd\Features\PyTorch\libtorch\include\c10/util/variant.h(1187): note: or ‘std’
C:\bd\Features\PyTorch\libtorch\include\c10/util/variant.h(1401): note: see reference to class template instantiation
Does anyone know what is causing this error? I would appreciate any help as I’m completely new to both PyTorch and cmake.