Closed cmpute closed 4 years ago
Thanks for reporting this. Would you be interested in opening a pull request?
@vincentqb actually I have no experience with Caffe2, so I don't know which part in the CMakeLists.txt of Caffe2 lead to this. Anyone could help?
And I'm also a little bit confused, why is the exported torch
target depends heavily on Caffe2 targets?
Met similar issue. This hard coded target link will results in problems when compiling pytorch extension with custom cuda location.
For example, I installed pytorch and cudatookit via conda. So I compile my custom pytorch extension with CUDA from cudatookit (not in /usr/local/cuda
). But the compiler will try to link /usr/local/cuda/lib64/libcudart.so
which does not exist.
🐛 Bug
Caffe2Targets.cmake
from pytorch installed by conda has hard-coded library path, which will make targets depending on torch unable to build, if the CUDA installation directory is different from/usr/local/cuda
. Specifically in my case, I installed pytorchpy3.6_cuda9.2.148_cudnn7.6.3_0
and the Caffe2 target file contains:To Reproduce
I'm working on an example for pytorch with CMake, you can find it here: https://github.com/cmpute/pytorch-cmake-example.
If I remove the hard-coded libraries in
Caffe2Targets.cmake
, then the compilation of my extension will succeed.Expected behavior
The example is fairly simple, but when you try to build the package, there will be an error:
Environment
conda
,pip
, source): condaThis issue is also reported here: https://github.com/facebookresearch/DensePose/issues/185