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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_linalg_matrix_power fails due to tolerance issues when built against lapack 3.12.0 #9560

Open
1 of 2 tasks
badshah400 opened this issue May 7, 2024 · 1 comment
Open
1 of 2 tasks
Labels
bug - numerically incorrect Bugs: numerical behaviour is incorrect

Comments

@badshah400
Copy link

Reporting a bug

Description

This came up when trying to update packages for lapack on openSUSE to its latest version 3.12.0. I understand numba depends on Lapack indirectly via numpy, and we find that when running the test-suite:

~> python3.11 -m numba.runtests -v -b --exclude-tags=long_running -m 4 -- numba.tests

test_linalg_matrix_power fails with the following log. Previously we were building against lapack 3.9.0, with otherwise identical versions of packages/libraries,1 and the tests all succeeded.

[ 2481s] FAIL: test_linalg_matrix_power (numba.tests.test_linalg.TestLinalgMatrixPower.test_linalg_matrix_power)
[ 2481s] ----------------------------------------------------------------------
[ 2481s] Traceback (most recent call last):
[ 2481s]   File "/usr/lib64/python3.12/site-packages/numba/tests/test_linalg.py", line 2440, in test_linalg_matrix_power
[ 2481s]     check(a, pwr)
[ 2481s]   File "/usr/lib64/python3.12/site-packages/numba/tests/test_linalg.py", line 2428, in check
[ 2481s]     np.testing.assert_allclose(got, expected, rtol=res, atol=res)
[ 2481s]   File "/usr/lib64/python3.12/site-packages/numpy/testing/_private/utils.py", line 1504, in assert_allclose
[ 2481s]     assert_array_compare(compare, actual, desired, err_msg=str(err_msg),
[ 2481s]   File "/usr/lib64/python3.12/contextlib.py", line 81, in inner
[ 2481s]     return func(*args, **kwds)
[ 2481s]            ^^^^^^^^^^^^^^^^^^^
[ 2481s]   File "/usr/lib64/python3.12/site-packages/numpy/testing/_private/utils.py", line 797, in assert_array_compare
[ 2481s]     raise AssertionError(msg)
[ 2481s] AssertionError: 
[ 2481s] Not equal to tolerance rtol=5e-15, atol=5e-15
[ 2481s] 
[ 2481s] Mismatched elements: 1 / 25 (4%)
[ 2481s] Max absolute difference: 1.12132525e-14
[ 2481s] Max relative difference: 3.46189033e-14
[ 2481s]  x: array([[-0.644914,  0.433068,  0.244191,  0.299553,  0.497169],
[ 2481s]        [ 0.360293, -0.456952,  0.328252, -0.061924,  0.741485],
[ 2481s]        [ 0.241062, -0.141202,  0.180883,  0.9199  , -0.207403],...
[ 2481s]  y: array([[-0.644914,  0.433068,  0.244191,  0.299553,  0.497169],
[ 2481s]        [ 0.360293, -0.456952,  0.328252, -0.061924,  0.741485],
[ 2481s]        [ 0.241062, -0.141202,  0.180883,  0.9199  , -0.207403],...
[ 2481s] 
[ 2481s] Stderr:
[ 2481s] /usr/lib64/python3.12/site-packages/numba/tests/test_linalg.py:399: NumbaPerformanceWarning: np.dot() is faster on contiguous arrays, called on (Array(float64, 2, 'A', False, aligned=True), Array(float64, 2, 'A', False, aligned=True))
[ 2481s]   return np.linalg.matrix_power(a, n)
[ 2481s] /usr/lib64/python3.12/site-packages/numba/tests/test_linalg.py:399: NumbaPerformanceWarning: np.dot() is faster on contiguous arrays, called on (Array(float64, 2, 'C', False, aligned=True), Array(float64, 2, 'A', False, aligned=True))
[ 2481s]   return np.linalg.matrix_power(a, n)

Thanks in advance for any suggestions and/or fixes.

Footnotes

  1. Package versions used:

    • GCC 13.2.1
    • Lapack 3.12.0
    • Numba: 0.59.1
    • Numpy 1.26.4
    • Python 3.10 / 3.11 / 3.12
    • Scipy 1.13.0
@stuartarchibald
Copy link
Contributor

Thanks for the report, and apologies for the delay in responding. It looks like there's some minor numerical difference the results being checked in the matrix_power tests, the Numba buildfarm has also picked up on it: #9602 (comment). Perhaps subscribe to that issue for updates as it will be fixed as part of the upcoming Numba 0.60.0 release. Thanks again!

@stuartarchibald stuartarchibald added the bug - numerically incorrect Bugs: numerical behaviour is incorrect label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug - numerically incorrect Bugs: numerical behaviour is incorrect
Projects
None yet
Development

No branches or pull requests

2 participants