CUDA incorrectly parsed and invalid options forwarded by cmake
@cpuhrsch is already working on this.
Since Feb 24, 2020.
- Dominant language
- Python
- Stars
- 17.9k
- Forks
- 7.3k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 13
Description
I am trying to build the C++ API on Windows 10 with CUDA 10.1 for Visual Studio 2019.
Part of cmake seems to indicate that it uses CUDA 10.2, then counter indicates it uses CUDA 10.1
(I am targeting 10.1, all my env is configured to point to it)
Output from cmake:
Environment variable CUDA_ROOT is set to:
%DEVELOP%/cuda/cuda-10.1
For compatibility, CMake is ignoring the variable.
Call Stack (most recent call first):
E:/develop/torch/torch-1.5.0a-source-20200208/share/cmake/Caffe2/Caffe2Config.cmake:88 (include)
E:/develop/torch/torch-1.5.0a-source-20200208/share/cmake/Torch/TorchConfig.cmake:40 (find_package)
CMakeLists.txt:13 (find_package)
This warning is for project developers. Use -Wno-dev to suppress it.
Caffe2: CUDA detected: 10.2
Caffe2: CUDA nvcc is: E:/develop/cuda/cuda-10.1/bin/nvcc.exe
Caffe2: CUDA toolkit directory: E:/develop/cuda/cuda-10.1
Caffe2: Header version is: 10.1
CMake Warning (dev) at E:/develop/torch/torch-1.5.0a-source-20200208/share/cmake/Caffe2/public/cuda.cmake:106 (find_package):
Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
Run "cmake --help-policy CMP0074" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
CMake variable CUDNN_ROOT is set to:
E:/develop/cuda/cudnn-10.1
Environment variable CUDNN_ROOT is set to:
%DEVELOP%/cuda/cuda-10.1/../cudnn-10.1
Resulting Visual Studio 2019 solution doesn't have the proper options forwarded :
(for example, I should have compute_61;sm_61)

And although cmake seemed to indicate it correctly found my CUDA 10.1 in the end, it still points to CUDA 10.2 when trying to compile:

I have managed to compile https://github.com/pytorch/pytorch without issue using CUDA 10.1, so I really think this is not a ENV/config issue of CUDA, but a cmake parsing problem.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.