pytorch
3d3bff5f - Fix early expansion of CUDA_TOOLKIT_ROOT_DIR in libtorch builds (#27887)

Commit
5 years ago
Fix early expansion of CUDA_TOOLKIT_ROOT_DIR in libtorch builds (#27887) Summary: Fixes https://github.com/pytorch/pytorch/issues/15476, supersedes https://github.com/pytorch/pytorch/issues/23496, supersedes and closes https://github.com/pytorch/pytorch/issues/27607 As explained by rgommers in https://github.com/pytorch/pytorch/issues/23496, linking against the expanded library path for `libculibos` in `cmake/Dependencies.cmake` hard codes the path into the distributed cmake files. Instead, I only link against the targets (e.g. `caffe2::cudnn`) and move the dependency on `libculibos` into the cuda import targets declared in `cmake/public/cuda.cmake`. That file is distributed with the other cmake files and so the variable is expanded on the user's machine. I am now also using `CMAKE_STATIC_LIBRARY_SUFFIX` instead of `.a` to fix the windows issue from https://github.com/pytorch/pytorch/issues/15828. I don't have a windows setup to confirm though. Finally, to get pytorch to compile with the extra libraries enabled, I also had to link `__caffe2_nccl` to `torch_python`; otherwise I was getting include errors as the hard coded include directory was wrong. `nccl` is built into `build` not `third_party/build`. Pull Request resolved: https://github.com/pytorch/pytorch/pull/27887 Differential Revision: D17929440 Pulled By: ezyang fbshipit-source-id: 3db6bd94d758fca2e1d6a64f4f5eea03cc07cf64
Author
Parents
Loading