-
Notifications
You must be signed in to change notification settings - Fork 24.7k
Fix USE_STATIC_MKL
lost functionality
#138996
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
base: main
Are you sure you want to change the base?
Fix USE_STATIC_MKL
lost functionality
#138996
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/138996
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New Failure, 1 Unrelated FailureAs of commit 7a9d8b3 with merge base f16053f ( NEW FAILURE - The following job has failed:
FLAKY - The following job failed but was likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
a83f021
to
b920061
Compare
dffb3eb
to
6661809
Compare
6661809
to
03e7cd2
Compare
CMakeLists.txt
Outdated
@@ -330,7 +330,7 @@ cmake_dependent_option( | |||
set(MKLDNN_ENABLE_CONCURRENT_EXEC ${USE_MKLDNN}) | |||
cmake_dependent_option(USE_MKLDNN_CBLAS "Use CBLAS in MKLDNN" OFF "USE_MKLDNN" | |||
OFF) | |||
option(USE_STATIC_MKL "Prefer to link with MKL statically (Unix only)" OFF) | |||
option(USE_STATIC_MKL "Prefer to link with MKL statically (recommanded)." ON) |
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.
rec911ended
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.
@ezyang not understand it. And I'm still fixing CI 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.
There is a typo. But also, we don't want static MKL, this is a deliberate decision
03e7cd2
to
a2799f3
Compare
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.
Before changing the default, let's discuss benefits/drawback of doing it one way vs another. If I'm building locally, dynamic is always preferred, isn't it?
The only time you want to link with MKL statically if you ship binaries, as that makes your life much easier, but downside is bulkier releases, and considering PyPI size limit we want to rely on https://pypi.org/project/mkl/ which requires dynamic linking
Thanks for your reply, then let keep using MKL shared as default config. |
b26c81b
to
9f66386
Compare
Fixes #138994 We can turn off `USE_MIMALLOC_ON_MKL` temporary. Due to it caused #138994 For totally fixed, we need fix `USE_STATIC_MKL` lost functionality issue: #138996, and then get the correctly MKL linking type(shared/static). It still need some time to pass all CI and builder scripts. Pull Request resolved: #139204 Approved by: https://github.com/ezyang
Fixes pytorch#138994 We can turn off `USE_MIMALLOC_ON_MKL` temporary. Due to it caused pytorch#138994 For totally fixed, we need fix `USE_STATIC_MKL` lost functionality issue: pytorch#138996, and then get the correctly MKL linking type(shared/static). It still need some time to pass all CI and builder scripts. Pull Request resolved: pytorch#139204 Approved by: https://github.com/ezyang
@pytorchbot rebase |
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
Successfully rebased |
4495017
to
bb6cdd9
Compare
@pytorchbot rebase |
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
Successfully rebased |
bb6cdd9
to
6a3c1c4
Compare
Status update on 2025/6/19: After rebase code, we still have
I need some information to continue my work:
@atalman could you please engage some torch_xla developer help me to fix the issue? |
@pytorchbot rebase |
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
Successfully rebased |
6a3c1c4
to
c468b41
Compare
@pytorchbot rebase |
@pytorchbot started a rebase job onto refs/remotes/origin/viable/strict. Check the current status here |
* fix USE_STATIC_MKL on Linux. * fix USE_STATIC_MKL on Windows. * keep set USE_STATIC_MKL off. * fix shared mkl version number.
remove debug log. Work around MKL for CUDA.
Successfully rebased |
c468b41
to
1f51b52
Compare
Currently,
USE_STATIC_MKL
is lost functionality to controlstatic
orshared
link mkl of PyTorch. The reason iscmake/Modules/FindMKL.cmake
code ignoreUSE_STATIC_MKL
cmake variable. And search MKL libraries with many work around.This PR is target to fix this issue. It is important to PyTorch
XPU
version build, we expected that:CPU
andCUDA
build, link MKL staticly.XPU
build, link MKL shared link. We would have oneAPI environment, we can re-use shared MKL binaries.The MKL config, we can reference to Intel official online tool: https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl-link-line-advisor.htm
After fixed
USE_STATIC_MKL
option, we need to install correctly MKL version. Otherwise, it shouldn't find MKL binaries. To install MKL:Install MKL
static
version on Windows/Linux:Install MKL
shared
version on Windows/Linux:Changes:
USE_STATIC_MKL
lost functionality on Linux.USE_STATIC_MKL
lost functionality on Windows.USE_STATIC_MKL
default value toON
, we recommanded to linkMKL
statically.TODO:
Setup correct
USE_STATIC_MKL
to CI system.USE_STATIC_MKL
correctly in CI, need to match correct installedMKL
version.cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10