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

relax tolerance in the xlapack.solveCholesky test #212

Conversation

drew-parsons
Copy link
Contributor

The xlapack.solveCholesky test in test_lapack.cpp fails on 32-bit architectures (i386/i686):
[ RUN ] xlapack.solveCholesky
/tmp/autopkgtest-lxc.gg3nslld/downtmp/autopkgtest_tmp/test_lapack.cpp:166: Failure
Expected equality of these values:
x_expected[i]
Which is: 0.13757507429403265
x[i]
Which is: 0.13757507429403248
[ FAILED ] xlapack.solveCholesky (0 ms)

This patch relaxes test tolerance by using EXPECT_NEAR with abstol=2e-16 instead of EXPECT_DOUBLE_EQ.

Fixes Issue #211.

The xlapack.solveCholesky test in test_lapack.cpp fails on 32-bit architectures (i386/i686):
[ RUN      ] xlapack.solveCholesky
/tmp/autopkgtest-lxc.gg3nslld/downtmp/autopkgtest_tmp/test_lapack.cpp:166: Failure
Expected equality of these values:
  x_expected[i]
    Which is: 0.13757507429403265
  x[i]
    Which is: 0.13757507429403248
[  FAILED  ] xlapack.solveCholesky (0 ms)

This patch relaxes test tolerance by using EXPECT_NEAR with abstol=2e-16 instead of EXPECT_DOUBLE_EQ.

Fixes Issue xtensor-stack#211.
@drew-parsons
Copy link
Contributor Author

Don't merge this PR until we confirm it fixes the tests on 32-bit arches.

The armhf discrepancy is coarser, 0.13757507429403265 - 0.13757507429403243 = 2.220446049250313e-16

So relax test tolerance to 5e-16.
@drew-parsons
Copy link
Contributor Author

Curiously, applying tolerance 2e-16 gives this warning

The abs_error parameter 2e-16 evaluates to 2e-16 which is smaller than the minimum distance between doubles for numbers of this magnitude which is 2.2204460492503131e-16, thus making this EXPECT_NEAR check equivalent to EXPECT_EQUAL. Consider using EXPECT_DOUBLE_EQ instead.

According to that, the i386 test should have been within tolerance in the first place (0.13757507429403265 - 0.13757507429403248 = 1.6653e-16). This patch is now set to 5e-16, we'll know soon if that's relaxed enough.

@SylvainCorlay
Copy link
Member

This patch is now set to 5e-16, we'll know soon if that's relaxed enough.

Let me know if that's fine with the 32 bits testing you got in Debian!

@drew-parsons
Copy link
Contributor Author

Looks like 5e-16 is enough. i386 and armhf are both passing now,
https://ci.debian.net/data/autopkgtest/testing/i386/x/xtensor-blas/15983027/log.gz
https://ci.debian.net/data/autopkgtest/testing/armhf/x/xtensor-blas/15982850/log.gz

Eventually test logs will appear at https://ci.debian.net/packages/x/xtensor-blas/

Thumbs up from me for the PR now.

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.

2 participants