-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Build fails on Mac; Linker missing Metal and Objc libraries #8222
Comments
CC @qqaatw this seems to be an MPS-related issue - is this something you can help with? Thanks! |
I'll take a look at this. @FabianSchuetze which commands did you use to build from source? Do you only want to build the c++ lib or with python binding? |
Thanks a lot, @qqaatw . I appreciate that. The command I run was:
which resulted in the following log:
And then building results in the following linker errors:
I do not need the python bindings. If I turn mps builds off |
@FabianSchuetze Yes, thank you for providing the context. @NicolasHug We have two ways to fix this:
I can do either way, which one would you prefer? To give more context, CUDA uses the second approach. |
Thanks, @qqaatw , for the help. |
I think first approach is better because:
Q: How does it work now in CI/CD? Or we build without MPS by default? |
We build and test the MPS backend, but it gets built through setup.py instead of relying on cmake: Lines 208 to 209 in 315f315
|
In that case, I think it makes even more sense for TorchVision build system to define the dependencies it wants to use to implement the features it wants, as they can be different from PyTorch dependencies |
Hello @malfet, I agree with your points here. But I'm curious that why we want to force all extensions link with |
Fixes #8222 I think we don't have tests for cmake build. It was built successfully on my Mac.
Thanks for working on this issue. |
Summary: Fixes #8222 I think we don't have tests for cmake build. It was built successfully on my Mac. Reviewed By: vmoens Differential Revision: D55062801 fbshipit-source-id: 9b2cd66104b5c2a8493c957518521c0b416c2823
🐛 Describe the bug
When I build the library from source according to the instructions I get the following linker errors:
I use cmake to set up the build like so:
/opt/homebrew/bin/cmake -DCMAKE_PREFIX_PATH=
python3 -c 'import torch;print(torch.utils.cmake_prefix_path)'-DWITH_MPS=1
. Torchvision builds when I turn MPS builds off.What can I do to build the project from source with MPS successfully?
Versions
Collecting environment information...
PyTorch version: 2.1.0
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A
OS: macOS 13.4.1 (arm64)
GCC version: Could not collect
Clang version: 14.0.3 (clang-1403.0.22.14.1)
CMake version: version 3.27.1
Libc version: N/A
Python version: 3.9.6 (default, May 7 2023, 23:32:44) [Clang 14.0.3 (clang-1403.0.22.14.1)] (64-bit runtime)
Python platform: macOS-13.4.1-arm64-arm-64bit
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
CPU:
Apple M2 Max
Versions of relevant libraries:
[pip3] numpy==1.25.2
[pip3] torch==2.1.0
[pip3] torchdata==0.7.0
[pip3] torchtext==0.16.0
[pip3] torchvision==0.16.0
[conda] Could not collect
The text was updated successfully, but these errors were encountered: