Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert #759 and fix unit tests. PR #759 excluded the latest Numpy version (1.24) because of failing unit tests check:sqrt and check:log2-complex in Github actions due to lack of accuracy. Confusingly, tests never failed locally, and only randomly on Github - rerunning a failed job would occasionally result in success. Out of caution, the version was excluded until the cause of this situation was known. The problem is now understood to be caused by vectorized routines that make use of the AVX-512 CPU extensions. None of the local machines used in testing supported these instructions, and only some of Github's randomly assigned machines do which explains the random failures. CPU capabilities can be queried using Numpy's new `show_runtime` method, and absence of extensions AVX512F, AVX512CD and AVX512_SKX correlates 100% with passing tests and vice versa. The problem in sqrt is caused by the fact the `evaluable.Sqrt` evaluates using `numpy.power`, but compares the result with `numpy.sqrt`, and the vectorized routines result in slightly different results causing the test to miss its tolerance threshold. The log2 test, likewise, is evaluated differently than its reference. This PR fixes the tolerance issue by setting the reference result equal to the way the operation is evaluated, so that the tolerance is always reached regardless of CPU. What remains unclear is why this problem arose with the release of Numpy 1.24, as the AVX-512 code paths were merged prior to version 1.22. Several AVX-512 related commits have followed since, but it is not clear which caused the particular differences that caused these tests to fail. Once we have local access to a machine that supports AVX-512 extensions we can bisect Numpy to find the culprit and perhaps understand the true source of the numerical change (however slight), but in the meantime we can conclude that there is no reason to maintain the ban on Numpy 1.24.
- Loading branch information