-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ''
to cmake common_paths
#12298
Add ''
to cmake common_paths
#12298
Conversation
The current commit message states the mechanical nature of the change: "add such and such string to XXX". It would be best to explain in the commit message why this change is useful. I'm no cmake expert but I think what it's doing is allowing you to pass the value of the Am I understanding correctly? |
@eli-schwartz Yes, your understanding is correct. I will update commit message later. |
This is to allow passing the path share/cmake/ as cmake_prefix_path. This is a case supported by cmake and is relied on by PyTorch. The cmake prefix of PyTorch can be found by running: python -c 'import torch.utils; print(torch.utils.cmake_prefix_path)' you will see something like below from the above command: /home/gaoxiang/.virtualenvs/nvfuser/lib/python3.11/site-packages/torch/share/cmake Inspecting this directory: ❯ tree /home/gaoxiang/.virtualenvs/nvfuser/lib/python3.11/site-packages/torch/share/cmake /home/gaoxiang/.virtualenvs/nvfuser/lib/python3.11/site-packages/torch/share/cmake ├── ATen │ └── ATenConfig.cmake ├── Caffe2 │ ├── Caffe2Config.cmake │ ├── Caffe2Targets.cmake │ ├── Caffe2Targets-release.cmake │ ├── FindCUDAToolkit.cmake │ ├── FindCUSPARSELT.cmake │ ├── Modules_CUDA_fix │ │ ├── FindCUDA.cmake │ │ ├── FindCUDNN.cmake │ │ └── upstream │ │ ├── CMakeInitializeConfigs.cmake │ │ ├── FindCUDA │ │ │ ├── make2cmake.cmake │ │ │ ├── parse_cubin.cmake │ │ │ ├── run_nvcc.cmake │ │ │ └── select_compute_arch.cmake │ │ ├── FindCUDA.cmake │ │ ├── FindPackageHandleStandardArgs.cmake │ │ └── FindPackageMessage.cmake │ └── public │ ├── cuda.cmake │ ├── gflags.cmake │ ├── glog.cmake │ ├── LoadHIP.cmake │ ├── mkl.cmake │ ├── mkldnn.cmake │ ├── protobuf.cmake │ └── utils.cmake ├── Tensorpipe │ ├── TensorpipeTargets.cmake │ └── TensorpipeTargets-release.cmake └── Torch ├── TorchConfig.cmake └── TorchConfigVersion.cmake 9 directories, 28 files However, meson currently filters this directory out by `_preliminary_find_check`. As a result, doing torch_dep = dependency('Torch') will fail, even if you set `cmake_prefix_path` with the value returned by PyTorch. Possibly related issues: https://stackoverflow.com/questions/68884434/libtorch-c-meson-dependency mesonbuild#9740 https://discuss.pytorch.org/t/libtorch-meson-build/139648
7249756
to
3b5b595
Compare
Commit message updated |
Meson has a |
Alternatively writing a custom dependency lookup for pytorch might be even better? |
@tristan957 afaict that's what this PR does. It allows you to set the meson option to that value and have it work -- previously, the value of |
I am actually setting |
Ah ok. Now I get it. Thanks for explaining a little bit more. |
@eli-schwartz are we good to merge it? |
PyTorch is a project built with cmake, and provides cmake packages for applications to link with it. The cmake prefix of PyTorch can be found by running:
python -c 'import torch.utils; print(torch.utils.cmake_prefix_path)'
you will see something like below from the above command:
Inspecting this directory:
However, meson currently filters this directory out by
_preliminary_find_check
. As a result, doingwill fail, even if you set
cmake_prefix_path
with the value returned by PyTorch.Possibly related issues:
https://stackoverflow.com/questions/68884434/libtorch-c-meson-dependency
#9740
https://discuss.pytorch.org/t/libtorch-meson-build/139648