Repository navigation
Closed
Description
I'm trying to package your module as an rpm package. So I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w- install .whl file in </install/prefix>
- run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-threadpoolctl-3.0.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-threadpoolctl-3.0.0-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/threadpoolctl-3.0.0
plugins: mock-3.6.1, cov-3.0.0, flake8-1.0.7, isort-2.0.0
collected 59 items
tests/test_threadpoolctl.py .......s.ss.ssss.ss.sss.........F..sssssss.sssss..sss...F.. [100%]
================================================================================= FAILURES =================================================================================
_____________________________________________________________________ test_threadpool_controller_limit _____________________________________________________________________
def test_threadpool_controller_limit():
# Check that using the limit method of ThreadpoolController only impact its
# library controllers.
blas_controller = ThreadpoolController().select(user_api="blas")
original_openmp_info = ThreadpoolController().select(user_api="openmp").info()
with blas_controller.limit(limits=1):
blas_controller = ThreadpoolController().select(user_api="blas")
openmp_info = ThreadpoolController().select(user_api="openmp").info()
assert all(
lib_controller.num_threads == 1
for lib_controller in blas_controller.lib_controllers
)
# original_blas_controller contains only blas libraries so no opemp library
# should be impacted.
> assert openmp_info == original_openmp_info
E AssertionError: assert [{'filepath':...ibgomp', ...}] == [{'filepath':...ibgomp', ...}]
E At index 0 diff: {'user_api': 'openmp', 'internal_api': 'openmp', 'prefix': 'libgomp', 'filepath': '/usr/lib64/libgomp.so.1.0.0', 'version': None, 'num_threads': 1} != {'user_api': 'openmp', 'internal_api': 'openmp', 'prefix': 'libgomp', 'filepath': '/usr/lib64/libgomp.so.1.0.0', 'version': None, 'num_threads': 12}
E Use -v to get the full diff
tests/test_threadpoolctl.py:212: AssertionError
____________________________________________________________________________ test_architecture _____________________________________________________________________________
def test_architecture():
expected_openblas_architectures = (
# XXX: add more as needed by CI or developer laptops
"armv8",
"Haswell",
"SkylakeX",
"Sandybridge",
)
expected_blis_architectures = (
# XXX: add more as needed by CI or developer laptops
"skx",
"haswell",
)
for lib_info in threadpool_info():
if lib_info["internal_api"] == "openblas":
> assert lib_info["architecture"] in expected_openblas_architectures
E AssertionError: assert 'Zen' in ('armv8', 'Haswell', 'SkylakeX', 'Sandybridge')
tests/test_threadpoolctl.py:565: AssertionError
========================================================================= short test summary info ==========================================================================
SKIPPED [2] tests/test_threadpoolctl.py:109: Requires libiomp runtime
SKIPPED [2] tests/test_threadpoolctl.py:109: Requires libomp runtime
SKIPPED [2] tests/test_threadpoolctl.py:109: Requires vcomp runtime
SKIPPED [2] tests/test_threadpoolctl.py:109: Requires libmkl_rt runtime
SKIPPED [2] tests/test_threadpoolctl.py:109: Requires mkl_rt runtime
SKIPPED [2] tests/test_threadpoolctl.py:109: Requires libblis runtime
SKIPPED [3] tests/test_threadpoolctl.py:253: Requires cython extensions to be compiled
SKIPPED [4] tests/test_threadpoolctl.py:271: Requires cython extensions to be compiled
SKIPPED [1] tests/test_threadpoolctl.py:352: need at least 2 shipped openblas library
SKIPPED [4] tests/test_threadpoolctl.py:362: Requires cython extensions to be compiled
SKIPPED [1] tests/test_threadpoolctl.py:450: requires MKL and the environment variable MKL_THREADING_LAYER set
SKIPPED [1] tests/test_threadpoolctl.py:465: requires BLIS and the environment variable BLIS_ENABLE_THREADING set
SKIPPED [1] tests/test_threadpoolctl.py:473: Requires cython extensions to be compiled
FAILED tests/test_threadpoolctl.py::test_threadpool_controller_limit - AssertionError: assert [{'filepath':...ibgomp', ...}] == [{'filepath':...ibgomp', ...}]
FAILED tests/test_threadpoolctl.py::test_architecture - AssertionError: assert 'Zen' in ('armv8', 'Haswell', 'SkylakeX', 'Sandybridge')
================================================================= 2 failed, 30 passed, 27 skipped in 1.09s =================================================================Metadata
Metadata
Assignees
Labels
No labels
Activity
jeremiedbb commentedon Dec 31, 2021
Thanks for the report. The second failure is expected (I'll submit a PR for that) but the first one is really surprising: I didn't know any version of the supported blas that impact the openmp internal variables. Can you report the result of
python -m threadpoolctl -i numpy scipy.linalg?kloczek commentedon Dec 31, 2021
Do you want me to test that PR? :)
Where I can find that scipy.linalg file?
ogrisel commentedon Jan 5, 2022
This is not a file, but a Python module from the scipy package. You just have to install scipy with one of the following commands depending on which distribution your are using (I assume a linux based distro in your case, no a conda based one, but I put the conda commands for completeness):
apt install python3-scipy(debian based distros)pip install scipy(pypi.org)conda install scipy(anaconda)conda install -c conda-forge scipy(conda-forge)ogrisel commentedon Jan 5, 2022
On redhat-like systems, installing scipy can probably be achieved with
dnf installbut I am not sure about the package naming conventions on redhat.ogrisel commentedon Jan 5, 2022
Note that I reproduce the problem when running with numpy/scipy from
conda-forgewith openblas built with openmp...Also, on my macos machine I have:
I opened #113.
kloczek commentedon Jan 5, 2022
It must be some kind of misunderstanding or miscommunication.
I have no problem with installation of the
scipy.Reported issue is not about installation
scipy.This ticket is about
scipytest suite two failing units (only two) when module installable resources are generated using pep517 based build whenscipymodule is not installed in its final/normally used location (which is typical when whole build and testing needs to be performed from non-root account).So .. please do not tell me to install Debian :P
kloczek commentedon Jan 5, 2022
Correction: because I'm discussing as well some issues with
scipymaintainers I was almost sure that I'm commenting under thescipyticket (which is not the case of course).We can postpone tis conversation until I'll try to resolve
scipybuild issue (I have reference to this ticket in thethreadpoolctlmodule spec file so sooner or later I'll back to this conversation :)Sorry my (small) mistake :P
ogrisel commentedon Jan 5, 2022
No problem.
jeremiedbb commentedon Feb 7, 2022
#114 has solved the issue described here, and we made a new release of threadpoolctl. I think this issue can be closed. Thanks @kloczek for the help.
kloczek commentedon Apr 11, 2022
Just tested 3.1.0 and it look way better 😄
It is one small warning about missing setup of the
asyncio_mode.Thank you 😃