Issues with tutorial "Installing C++ Distributions of PyTorch"

Good evening everybody,

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 :slight_smile:
“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.”

What am I missing ?

Are you sure the three dots after your path to libtorch are right?
What kind of error messages did you get before changing the cmake command?

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 :slight_smile:

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)

The two dots specify the path of your CMakeLists.txt to the parent directory.

I’m not really familiar with Windows, but could you try to add -DCMAKE_GENERATOR_PLATFORM=x64 to your cmake command?

You are right, I should have guessed it for the dots.
Thanks a lot for your answer, i’ll try that at once.

It seems to work as well as -Ax64 yet I still have this warning message :slight_smile:-- 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…

Thanks again for your interest

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

I am also facing the same issues. make does not find the required files.