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

Revert "Pin numpy version < 1.19.0 to unblock CI (#4599)" #4656

Merged
merged 7 commits into from
Jul 12, 2020

Conversation

mtreinish
Copy link
Member

@mtreinish mtreinish commented Jul 7, 2020

Summary

Since #4613 is fixed it looks like we can remove the CI pin for the
latest numpy release. Failures with numpy on test_qasm_2q_unitary
only occur on windows with the latest numpy release and look to be
caused by a rounding/precision difference in that environment. This
fixes those by rounding the results from 2q unitary decomposition
to 13 decimal places where the failure was occuring.

This reverts commit 6aca34a.

Details and comments

Fixes #4606

Since Qiskit#4613 is fixed it looks like we can remove the CI pin for the
latest numpy release. Failures with numpy on test_qasm_2q_unitary
haven't been reproducible locally, so there shouldn't be a blocker
anymore to running tests with the latest numpy release.

This reverts commit 6aca34a.

Fixes Qiskit#4606
@mtreinish mtreinish requested a review from a team as a code owner July 7, 2020 17:12
@mtreinish
Copy link
Member Author

Oh, I guess the failure was on windows. Let me try to reproduce this locally...

@mtreinish mtreinish added the on hold Can not fix yet label Jul 7, 2020
The root cause of the issue causing the failure on windows for 2q
unitary decomposition of an identity matrix was a rounding issue. The
U0r matrix being returned from decomp0() was

[[1.00000000e+00+0.00000000e+00j 2.77555756e-17-2.77555756e-17j]
 [2.77555756e-17-2.77555756e-17j 1.00000000e+00+0.00000000e+00j]]

instead of the expected

[[1+0j + 0+0j]
 [0+0j + 1+0j]]

this throws off later stages that use the decomposition result. This
commit fixes this issue by rounding the output matrices from decomp0()
to 13 decimal places (which is what is used for atol and rtol other
places in the module) to avoid this type of rounding error.
@mtreinish mtreinish removed the on hold Can not fix yet label Jul 7, 2020
@mtreinish mtreinish added this to the 0.15 milestone Jul 8, 2020
@1ucian0 1ucian0 merged commit aa3672d into Qiskit:master Jul 12, 2020
@mtreinish mtreinish deleted the revert-numpy-pin branch July 12, 2020 22:52
mtreinish added a commit to mtreinish/qiskit-core that referenced this pull request Aug 4, 2020
In Qiskit#4656 we added rounding to the output of the decomp0 method to handle
a case where differing FP precision on windows environments was causing
an expected result in running two_qubit_cnot_decompose on np.eye(4)
with numpy 1.19.x installed leading to a hard failure in the qasm tests.
This seemed to reliably unblock testing and make unit tests work
reliably. However, that original fix from Qiskit#4656 was superseded by Qiskit#4835
which was a fix for a more general issue with the reproducibility of the
decompositions and reverted. Since Qiskit#4835 has merged we've been seeing an
uptick in the failure rate on the same unitary qasm test that Qiskit#4656
fixed, so the change in Qiskit#4835 was not actually sufficient for the
windows case. This commit restores the fix from Qiskit#4656 to unblock CI and
fix the reproducability of the decompositions across systems.

Fixes Qiskit#4856
kdk pushed a commit that referenced this pull request Aug 4, 2020
In #4656 we added rounding to the output of the decomp0 method to handle
a case where differing FP precision on windows environments was causing
an expected result in running two_qubit_cnot_decompose on np.eye(4)
with numpy 1.19.x installed leading to a hard failure in the qasm tests.
This seemed to reliably unblock testing and make unit tests work
reliably. However, that original fix from #4656 was superseded by #4835
which was a fix for a more general issue with the reproducibility of the
decompositions and reverted. Since #4835 has merged we've been seeing an
uptick in the failure rate on the same unitary qasm test that #4656
fixed, so the change in #4835 was not actually sufficient for the
windows case. This commit restores the fix from #4656 to unblock CI and
fix the reproducability of the decompositions across systems.

Fixes #4856
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

Successfully merging this pull request may close these issues.

Terra Tests Fail with Numpy 1.19.0
2 participants