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

xlapack.solveCholesky test precision too high for 32 bit machines #211

Open
drew-parsons opened this issue Oct 16, 2021 · 7 comments
Open

Comments

@drew-parsons
Copy link
Contributor

The xlapack.solveCholesky test in

TEST(xlapack, solveCholesky) {

uses an expected x value 0.13757507429403265

This tests fails on 32-bit architectures (or at least 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)

Full log at https://ci.debian.net/data/autopkgtest/testing/i386/x/xtensor-blas/15978147/log.gz

@SylvainCorlay
Copy link
Member

Thanks for the report.

We would be interested in a fix, but presumably it would be interesting to include an i386 test in the CI if we want to catch these.

@drew-parsons
Copy link
Contributor Author

A pragmatic workaround could be to increase the test tolerance e.g. from 1e-18 to 1e-16 (as an example. I'm not certain what the effective tolerance here is). That could be done here using EXPECT_NEAR in place of EXPECT_DOUBLE_EQ.

@SylvainCorlay
Copy link
Member

Thanks!
Would you like to open a pull request?

@drew-parsons
Copy link
Contributor Author

drew-parsons commented Oct 16, 2021

I can do it. I'll need to investigate what tolerance i386 needs.
Well, I guess it's just 0.13757507429403265 - 0.13757507429403248 = 2e-16. (the effective tolerance of EXPECT_DOUBLE_EQ must be something like 1e-16)

drew-parsons added a commit to drew-parsons/xtensor-blas that referenced this issue Oct 16, 2021
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

Also affects armhf, confirming it's a 32-bit issue.
https://ci.debian.net/data/autopkgtest/testing/armhf/x/xtensor-blas/15977642/log.gz

@drew-parsons
Copy link
Contributor Author

armhf is a little coarser,
0.13757507429403265 - 0.13757507429403243 = 2.220446049250313e-16

@drew-parsons
Copy link
Contributor Author

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

No branches or pull requests

2 participants