-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
[C++] Call find_package(Torch REQUIRED) more than one time in downstream project causes CMake configuration error #25004
Comments
@ezyang The current patch I have locally is adding an additional if condition in
It solves the problem but I am not sure whether that's the right way to do it. If you think this is okay, let me know and I will submit a PR. |
This is a bit weird because, it seems to me, that |
|
@ezyang If this is case, I would say the best way (and probably the most reliable and idiomatic way) is to store information about the MKL with which PyTorch was linked somewhere (e.g., |
Or we just leave it as it is and let the user to guard if they truly have the need to call |
Here's a real-world scenario where |
Yes, let's accept the hack for now. Or if someone wants to redo how we do TorchConfig.cmake packaging, I'd also be down too :) |
Can we make the hack simply guard TorchConfig.cmake itself? As this seems to be a "cleaner" guard hacking :) |
Summary: fixes issue pytorch/pytorch#25004 Pull Request resolved: pytorch/pytorch#25167 Differential Revision: D17051290 Pulled By: ezyang fbshipit-source-id: 30c2b6d6ffca2ce8dae45a4a706ce45d6386c672
Summary: This is a similar problem to pytorch/pytorch#25004. After the merge of pytorch/pytorch#25167, I recompiled torch and discovered another similar bug. ezyang please take a look Pull Request resolved: pytorch/pytorch#25257 Differential Revision: D17528116 Pulled By: ezyang fbshipit-source-id: 1657d9ee6dced3548f246010b05e2b3c25c37dee
Summary: This is a similar problem to pytorch#25004. After the merge of pytorch#25167, I recompiled torch and discovered another similar bug. ezyang please take a look Pull Request resolved: pytorch#25257 Differential Revision: D17528116 Pulled By: ezyang fbshipit-source-id: 1657d9ee6dced3548f246010b05e2b3c25c37dee
馃悰 Bug
Please see below minimal code to reproduce the problem
CMakeLists.txt
main.cpp
Expected behavior
After
I expect my downstream cmake configuration to work like usual, but here's the error message I get
I understand it's unusual to have the need to call
find_package(Torch REQUIRED)
twice but calling it twice for other popular libraries like OpenCV, TensorFlow, etc does not result in an error. Can someone please fix this?Environment
cc @ezyang
The text was updated successfully, but these errors were encountered: