forked from Qiskit/qiskit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue warning on known-bad combinations for
UCGate
synthesis
The combination of AVX2-enabled Intel Macs with versions of NumPy compiled with Apple clang 14.0.0 has problems with the complex128 `multiply` ufunc that makes it non-deterministic. The PyPI releases of the entire NumPy 1.25 series and the current newest 1.26.0 are all known to have this issue. This causes a severe instability in the `UCGate` synthesis code, to the degree of the returned results being (non-deterministically) completely invalid. This commit causes Qiskit to query the host platform and runtime NumPy features to guess if the bug is likely to be present; the results are so incorrect that we need to warn users so they can work around them.
- Loading branch information
1 parent
6e80e89
commit f887869
Showing
7 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
releasenotes/notes/numpy-avx2-cmul-ucgate-6c8708fb30f42f3f.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
issues: | ||
- | | ||
The PyPI versions of the NumPy 1.25 series and the current most recent release 1.26.0 are known | ||
to have inconsistent behaviour with the complex `multiply` ufunc when running on Intel Macs with | ||
AVX2 CPU extensions. This bug destabilises the synthesis of :class:`.UCGate`, which is used by | ||
:class:`.Isometry` and :meth:`.UnitaryGate.control`, to the degree of it returning completely | ||
invalid results. | ||
This bug only affects Intel Macs with AVX2 CPU extensions enabled with certain versions of NumPy. | ||
If the bad code paths are used, a :exc:`RuntimeWarning` will be issued. If you are affected, | ||
you can install an older version of NumPy (the 1.24 series is known good), or you can disable | ||
NumPy's use of AVX2 extensions by setting the environment variable | ||
`NPY_DISABLE_CPU_FEATURES=AVX2` while importing `numpy`. See | ||
https://qisk.it/cmul-avx2-numpy-bug for more detail. | ||
This bug also affects all prior versions of Qiskit with :class:`.UCGate` if the bad combination | ||
of OS, CPU and NumPy version are present, but this is the first version that issues a warning. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters