Skip to content
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

Build broken on ubuntu due to MKL symbols not found #50211

Closed
antocuni opened this issue Jan 7, 2021 · 1 comment
Closed

Build broken on ubuntu due to MKL symbols not found #50211

antocuni opened this issue Jan 7, 2021 · 1 comment
Labels
module: build Build system issues triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@antocuni
Copy link
Contributor

antocuni commented Jan 7, 2021

馃悰 Bug

On my system, pytorch builds fine, but using MKL function fails:

$ python -c 'import torch; torch.tensor([[1.0, 2], [3, 4]]).svd()'
INTEL MKL ERROR: /home/antocuni/.conda/envs/pytorch-cuda-dev/lib/libmkl_def.so: undefined symbol: mkl_sparse_optimize_bsr_trsm_i8.
Intel MKL FATAL ERROR: Cannot load libmkl_def.so.

To Reproduce

Steps to reproduce the behavior:

  1. python setup.py develop
  2. python -c 'import torch; torch.tensor([[1.0, 2], [3, 4]]).svd()'

Depending on which MKL operations is used, the undefined symbol varies.

Expected behavior

Not to crash :)

Environment

I think that the relevant env variable is LDFLAGS:

$ echo $LDFLAGS
-Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/home/antocuni/.conda/envs/pytorch-cuda-dev/lib -Wl,-rpath-link,/home/antocuni/.conda/envs/pytorch-cuda-dev/lib -L/home/antocuni/.conda/envs/pytorch-cuda-dev/lib -Wl,-rpath-link,/usr/local/cuda-11.0.3/lib64 -L/usr/local/cuda-11.0.3/lib64

Note that it contains --as-needed.

I bisected the commits and the culprit seems to be 12ee7b6, added by #50080 . The problem is that if LDFLAGS contains --as-needed, it overrides the --no-as-needed which is added by the if.
An easy workaround is to manually add --no-as-needed at the end of my LDFLAGS, but I claim that since the if clearly tries to take care of it, the PR is wrong.

cc @malfet @seemethere @walterddr

@gchanan gchanan added module: build Build system issues triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module labels Jan 8, 2021
@walterddr
Copy link
Contributor

thanks for reporting the issue. looking into it.

hwangdeyu pushed a commit to hwangdeyu/pytorch that referenced this issue Jan 14, 2021
Summary:
This fixes pytorch#50211

Pull Request resolved: pytorch#50212

Reviewed By: janeyx99

Differential Revision: D25850876

Pulled By: walterddr

fbshipit-source-id: be138db3ae370c45f5fbf3af486cf8b32518df87
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: build Build system issues triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
3 participants