-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Augment CMakeLists.txt & Fix generated config file #6396
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
Conversation
Apologies for the misleading conclusion I made in the last PR (#6378). I finally realised that LibPNG and LibJPEG were not statically linked to the TorchVision target. It's necessary to instruct CMake to use Because I believe the actual dynamic libraries in use were installed by conda, adding Python target to the linkage dependency will coincidentally provide the correct search path of shared objects for LibPNG and LibJPEG, thus the original generated configuration file is working anyway. |
@laitingsheng Thank you very much for your patience and tenacity to fix this. Your changes seem good to me. The CI is failing due to network problems, so this seems unrelated. I've manually restarted the failing jobs but if that persists we might have to restart all CI jobs to confirm everything works as expected. @fmassa @bmanga If you could have also a look on the propose changes, I would appreciate it. |
My pleasure! The last commit should be working correctly now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM (although I'm not a CMake expert).
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks a lot for your work @laitingsheng.
I've pinged a couple of people that have more experience with CMake to let us know what they think. I'll merge immediately after I get their input. I apologise for any delay, please bear with me; it shouldn't take long.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM as well!
As a followup item, we noticed that the torchtext build failed when CUDA enabled torch
is installed in the build environment (see pytorch/text#1797). The fix involved linking the torchtext.so
lib with specific libraries from torch (see this PR) instead of doing find_package(Torch REQUIRED)
(which is how torchvision is currently setup). I'm wondering if torchvision build ever ran into a similar failure?
@Nayef211 Thanks a lot for giving your insights and expertise. We've never tried that, possibly because of lack of expertise working with CMake. Are there any other benefits from linking against specific torch libraries? I would love to understand the pros/cons to perhaps follow up/adopting a similar approach as TorchText. @laitingsheng Merged, thanks a lot for your contribution! |
@datumbox My pleasure!
@Nayef211 I don't think this is the case for torchvision as torchvision requires CUDA if it's available, which follows what the Torch library requires. I think someone has pointed out that torchtext doesn't need CUDA even if the Torch library in use is compiled and linked against CUDA. If the torch library has been instructed to link against CUDA, the |
@laitingsheng thanks for the insight and I think you're spot on here. I wasn't too familiar with how torchvision was handling building with CUDA. If it requires CUDA if it's available then this error shouldn't affect torchvision. 😄 |
Summary: * Fix generated CMake file * Make optional dependencies consistent Reviewed By: datumbox Differential Revision: D38824245 fbshipit-source-id: d573c2f044396b35ef9d836fee353b0e81cbeecc Co-authored-by: Vasilis Vryniotis <[email protected]>
I hope this simple fix could pass the CI tests (as a follow-up of #6378 and #5602).
Resolves #5863.