Skip to content

MKL warning on Python 3.10 unittest linux CI #7372

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

Open
NicolasHug opened this issue Mar 1, 2023 · 4 comments
Open

MKL warning on Python 3.10 unittest linux CI #7372

NicolasHug opened this issue Mar 1, 2023 · 4 comments

Comments

@NicolasHug
Copy link
Member

Unit-tests on Linux CPU / tests (3.10) / linux-job is failing because import torchvision is causing the following warning:

2023-02-21T17:06:25.6104129Z Error: mkl-service + Intel(R) MKL: MKL_THREADING_LAYER=INTEL is incompatible with libgomp.so.1 library.
2023-02-21T17:06:25.6104506Z 	Try to import numpy first or set the threading layer accordingly. Set MKL_SERVICE_FORCE_INTEL to force it.

This is an issue likely due to the way the CI is setup as the issue is not reproducible in different settings e.g. #7299 (comment) or #7299 (comment)

@malfet
Copy link
Contributor

malfet commented Mar 1, 2023

I finally have a reproducer:

$ python -c 'import numpy, subprocess, sys; subprocess.check_call([sys.executable, "-c", "import torch"])'

But removing numpy makes everything work as expected. This happens because libtorch_cpu.so inside those packages, depends on MKL, but on libgomp.so, instead of libomp.so.

But it behaves the same for 1.13, so this is not a new problem.

Even simpler reproducer that affects all our conda builds (why numpy sets this environment variable is a bit unclear to me):

$ MKL_THREADING_LAYER=INTEL python -c "import torch"

@malfet
Copy link
Contributor

malfet commented Mar 1, 2023

Following fixes the test issues:

diff --git a/test/test_transforms.py b/test/test_transforms.py
index 03b385e..8ff61ce 100644
--- a/test/test_transforms.py
+++ b/test/test_transforms.py
@@ -2283,6 +2283,7 @@ def test_functional_deprecation_warning(import_statement, from_private):
         import_statement = import_statement.replace("functional", "_functional")
         source = f"""
         import warnings
+        import numpy
 
         with warnings.catch_warnings():
             warnings.simplefilter("error")
@@ -2291,6 +2292,7 @@ def test_functional_deprecation_warning(import_statement, from_private):
     else:
         source = f"""
         import pytest
+        import numpy
         with pytest.warns(UserWarning, match="removed in 0.17"):
             {import_statement}
         """

@NicolasHug
Copy link
Member Author

But it behaves the same for 1.13, so this is not a new problem

But this is still a significant issue, right? If every single user on 3.10 gets a warning depending on whether or not they import numpy, this seems like a pretty bad UX?

@malfet
Copy link
Contributor

malfet commented Mar 6, 2023

But it behaves the same for 1.13, so this is not a new problem

But this is still a significant issue, right? If every single user on 3.10 gets a warning depending on whether or not they import numpy, this seems like a pretty bad UX?

Indeed, it should be fixed, though it would prefer to understand what is causing this as well. As in the same environment, both import numpy; import torch; and import torch; import numpy work fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants