8000 TST: Add test case for gh-6896 by rmcgibbo · Pull Request #6897 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

TST: Add test case for gh-6896 #6897

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

Closed
wants to merge 3 commits into from

Conversation

rmcgibbo
Copy link
Contributor
@rmcgibbo rmcgibbo commented Dec 29, 2015

@ihaque does this trigger the same error on your hardware?

(#6896)

@ihaque
Copy link
ihaque commented Dec 29, 2015

yes:

$ python nptest.py 
Traceback (most recent call last):
  File "nptest.py", line 17, in <module>
    test_eig_vs_eigh_above_560()
  File "nptest.py", line 15, in test_eig_vs_eigh_above_560
    assert_array_almost_equal(w1, w3)
  File "/usr/local/lib/python2.7/site-packages/numpy/testing/utils.py", line 892, in assert_array_almost_equal
    precision=decimal)
  File "/usr/local/lib/python2.7/site-packages/numpy/testing/utils.py", line 713, in assert_array_compare
    raise AssertionError(msg)
AssertionError: 
Arrays are not almost equal to 6 decimals

(mismatch 2.14285714286%)
 x: array([ -1.362924e+07 +0.000000e+00j,  -7.088316e-09 +0.000000e+00j,
        -6.146752e-09 -1.686265e-09j,  -6.146752e-09 +1.686265e-09j,
        -5.768770e-09 -2.599434e-09j,  -5.768770e-09 +2.599434e-09j,...
 y: array([ -1.362924e+07,  -1.143458e+05,  -7.863574e+04,  -6.208133e+04,
        -3.462642e+00,  -1.908110e+00,  -1.316926e+00,  -1.005356e+00,
        -1.043933e-07,  -1.011683e-07,  -9.085910e-08,  -8.703499e-08,...

src:

$ cat nptest.py 
from numpy.testing import assert_array_almost_equal
from numpy import linalg, arange, float64, array, dot, transpose
import numpy as np
def test_eig_vs_eigh_above_560():
        # gh-6896
        N = 560

        A = np.arange(N*N).reshape(N, N)
        A = A + A.T

        w1 = np.sort(linalg.eig(A)[0])
        w2 = np.sort(linalg.eigh(A, UPLO='U')[0])
        w3 = np.sort(linalg.eigh(A, UPLO='L')[0])
        assert_array_almost_equal(w1, w2)
        assert_array_almost_equal(w1, w3)

test_eig_vs_eigh_above_560()

@charris charris changed the title Add test case for gh-6896 TST: Add test case for gh-6896 Jan 4, 2016
@@ -90,6 +90,20 @@ def test_svd_no_uv(self):
assert_equal(np.linalg.matrix_rank(a), 1)
assert_array_less(1, np.linalg.norm(a, ord=2))

def test_eig_vs_eigh_above_560(self):
# gh-6896
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a bit more documentation about what is being tested and where it currently fails?

8000

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay done. It's still somewhat of a mystery to me.

@charris
Copy link
Member
charris commented Jan 4, 2016

OK, now I'm thinking how to make the known failure on OS X useful. IIRC, L works. Or is it the other way round? So maybe record both tests results and raise something like '*' fails, use '*' for UPLO. If the current default fails, we should also change that.

@charris
Copy link
Member
charris commented Jan 4, 2016

Scratch changing the default, that is bound to break someone's code.

@rmcgibbo
Copy link
Contributor Author
rmcgibbo commented Jan 4, 2016

My thought in adding the test was that, in part, it would help gather information about the conditions under which the error occurs. If I recall correctly, the error triggered on @ihaque's Mac, but not on mine, and we really weren't sure what the relevant difference was. (I think they were a different point release of 10.10, but does Apple really change Accelerate between 10.10 point releases?)

@ihaque
Copy link
ihaque commented Jan 4, 2016

@rmcgibbo what's your mac's hardware? wonder if there's a different dispatch path for AVX or something like that.

@rmcgibbo
Copy link
Contributor Author
rmcgibbo commented Jan 4, 2016

@ihaque I tried two machines, neither gives the bug.

  • MacBookPro11,1 (Retina 13-inch, Mid 2014, 2.6 GHz Core i5, dual core). CPU supports AVX1, AVX2. OS is 10.10.3
  • Macmini5,3 (Mid 2011, 2 GHz Core i7, quad core). CPU supports AVX1, but not AVX2. OS is 10.11.2.

@ihaque
Copy link
ihaque commented Jan 4, 2016

Hmm. My hardware is MacBookPro12,1, (Retina 13-inch early 2015, 3.1GHz i7 dual), and I've seen the problem on both 10.10.4 and 10.10.5.

@rmcgibbo
Copy link
Contributor Author
rmcgibbo commented Jan 4, 2016

@ihaque another platform I thought of trying is travis-ci's mac infrastructure, which is a different CPU class and such, but no dice: https://travis-ci.org/rmcgibbo/numpy-test/builds/100201350

@homu
Copy link
Contributor
homu commented May 7, 2016

☔ The latest upstream changes (presumably #7587) made this pull request unmergeable. Please resolve the merge conflicts.

@eric-wieser
Copy link
Member

@charris: Other than the merge conflict, is there any reason not to put this in?

@charris
Copy link
Member
charris commented May 3, 2018

@eric-wieser Look OK to me. We should probably stick a pytest.mark.xfail decorator on the test.

@mattip
Copy link
Member
mattip commented May 1, 2019

We deprecated Accelerate, so I am going to close this. Please reopen and rebase off master if there is value in adding this test

@mattip mattip closed this May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0