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

FPU issue when building on i386 or armel #534

Closed
tillea opened this issue Feb 16, 2020 · 6 comments
Closed

FPU issue when building on i386 or armel #534

tillea opened this issue Feb 16, 2020 · 6 comments
Labels
question Further information is requested trivial

Comments

@tillea
Copy link

tillea commented Feb 16, 2020

Hi,
the Debian package of cogent3 received a bug report about build failures for architectures i386 and armel. The explenation of the bug reporter is:

he armel port has no FPU in the baseline, and the math emulation does not handle all corner cases correctly.

The i386 port uses the 387 FPU that has excess precision.

The full bug log is linked inside the bug report. It burns down to:

======================================================================
FAIL: test_jsd (tests.test_maths.test_measure.TestJensenShannon)
case1 is testing if the jsd between two identical distributions is 0.0
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_cogent3/build/tests/test_maths/test_measure.py", line 201, in test_jsd
    assert_allclose(
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 1514, in assert_allclose
    assert_array_compare(compare, actual, desired, err_msg=str(err_msg),
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 841, in assert_array_compare
    raise AssertionError(msg)
AssertionError:
Not equal to tolerance rtol=1e-07, atol=0
Testing case4 for jsd failed
Mismatch: 100%
Max absolute difference: 4.4408921e-16
Max relative difference: inf
 x: array(4.440892e-16)
 y: array(0.)

======================================================================
FAIL: test_jsm (tests.test_maths.test_measure.TestJensenShannon)
case1 is testing if the jsm between two identical distributions is 0.0
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_cogent3/build/tests/test_maths/test_measure.py", line 242, in test_jsm
    assert_allclose(
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 1514, in assert_allclose
    assert_array_compare(compare, actual, desired, err_msg=str(err_msg),
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 841, in assert_array_compare
    raise AssertionError(msg)
AssertionError:
Not equal to tolerance rtol=1e-07, atol=0
Testing case4 for jsm failed
Mismatch: 100%
Max absolute difference: 2.10734243e-08
Max relative difference: inf
 x: array(2.107342e-08)
 y: array(0.)

----------------------------------------------------------------------
Ran 2246 tests in 94.449s

FAILED (failures=2, skipped=1)

I wonder whether you might want to work around this issue in your test suite or whether you might suggest to exclude the said architectures from building.

Kind regards, Andreas.

@GavinHuttley
Copy link
Collaborator

GavinHuttley commented Feb 16, 2020

There are two different issues here. The second one from the original bug report relates to what you identify above -- which is a test of an expected value of 0. I have pushed in some changes that might address this.

The first in the original bug report is a numpy issue. Specifically, the minimal relevant code that should be failing with the FloatingPointError is

import numpy
with numpy.errstate(invalid="raise"):
    numpy.log2(-2)

Can you have the original reporter check this please.

@GavinHuttley GavinHuttley added question Further information is requested trivial labels Feb 16, 2020
@tillea
Copy link
Author

tillea commented Feb 17, 2020 via email

@tillea
Copy link
Author

tillea commented Feb 17, 2020 via email

GavinHuttley added a commit that referenced this issue Feb 19, 2020
TST: tweak the atol values for evaluating jsd/jsm cases that produce 0, #534
@GavinHuttley
Copy link
Collaborator

I've pushed in a patch that adjusts the testing precision for these two test cases. However, a better approach is probably to skip these (and other failing tests) on these platforms.

Can you try this out and also post the result of the following on these platforms:

import sys
print(sys.platform.lower())

thanks!

@tillea
Copy link
Author

tillea commented Feb 27, 2020

Hi,
I applied patch 9ea740e which leaves me with a single error:

======================================================================
FAIL: test_jsm (tests.test_maths.test_measure.TestJensenShannon)
evaluate jsm between identical, and non-identical distributions
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/<<PKGBUILDDIR>>/.pybuild/cpython3_3.8_cogent3/build/tests/test_maths/test_measure.py", line 255, in test_jsm
    assert_allclose(
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 1514, in assert_allclose
    assert_array_compare(compare, actual, desired, err_msg=str(err_msg),
  File "/usr/lib/python3/dist-packages/numpy/testing/_private/utils.py", line 841, in assert_array_compare
    raise AssertionError(msg)
AssertionError:
Not equal to tolerance rtol=1e-07, atol=8.88178e-16
Testing case4 for jsm failed
Mismatch: 100%
Max absolute difference: 2.10734243e-08
Max relative difference: inf
 x: array(2.107342e-08)
 y: array(0.)

----------------------------------------------------------------------
Ran 2285 tests in 86.637s

FAILED (failures=1, skipped=1)

See at the end of this link for the full build log.
Thank you for working on this, Andreas.

@GavinHuttley
Copy link
Collaborator

No response for a very long time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested trivial
Projects
None yet
Development

No branches or pull requests

2 participants