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

failing tests on alpine linux #798

Open
a16bitsysop opened this issue Aug 6, 2022 · 18 comments
Open

failing tests on alpine linux #798

a16bitsysop opened this issue Aug 6, 2022 · 18 comments

Comments

@a16bitsysop
Copy link

I am trying to package for alpine linux and 2 tests are failing:

xsimd-8.1.0/test/test_complex_trigonometric.cpp:160: Failure
[1330](https://gitlab.alpinelinux.org/a16bitsysop/aports/-/jobs/793063#L1330)Expected equality of these values:
[1331](https://gitlab.alpinelinux.org/a16bitsysop/aports/-/jobs/793063#L1331)  diff
[1332](https://gitlab.alpinelinux.org/a16bitsysop/aports/-/jobs/793063#L1332)    Which is: 1
[1333](https://gitlab.alpinelinux.org/a16bitsysop/aports/-/jobs/793063#L1333)  0
[1334](https://gitlab.alpinelinux.org/a16bitsysop/aports/-/jobs/793063#L1334)  while testing atan
[1335](https://gitlab.alpinelinux.org/a16bitsysop/aports/-/jobs/793063#L1335)[  FAILED  ] complex_trigonometric_test/fallback_complex<float>.atan, where TypeParam = xsimd::batch<std::complex<float>, xsimd::fma3<xsimd::avx2> > (4 ms)

xsimd-8.1.0/test/test_complex_trigonometric.cpp:160: Failure
[1352](https://gitlab.alpinelinux.org/a16bitsysop/aports/-/jobs/793063#L1352)Expected equality of these values:
[1353](https://gitlab.alpinelinux.org/a16bitsysop/aports/-/jobs/793063#L1353)  diff
[1354](https://gitlab.alpinelinux.org/a16bitsysop/aports/-/jobs/793063#L1354)    Which is: 1
[1355](https://gitlab.alpinelinux.org/a16bitsysop/aports/-/jobs/793063#L1355)  0
[1356](https://gitlab.alpinelinux.org/a16bitsysop/aports/-/jobs/793063#L1356)  while testing atan
[1357](https://gitlab.alpinelinux.org/a16bitsysop/aports/-/jobs/793063#L1357)[  FAILED  ] complex_trigonometric_test/fallback_complex<double>.atan, where TypeParam = xsimd::batch<std::complex<double>, xsimd::fma3<xsimd::avx2> > (3 ms)

The same test fails of x86_64, x86, and aarch64. Both the x86_64 and x86 use xsimd::fma3<xsimd::avx2> and aarch64 uses xsimd::neon64

@serge-sans-paille
Copy link
Contributor

hey, sorry for the late answer. We've been doing quite a few updates to xsimd since you raised that issue. Any chance you would give it another try?

@a16bitsysop
Copy link
Author

I tried 10.0.0rc0 and the failure is the same, it’s the same on my pc and the builders: https://gitlab.alpinelinux.org/a16bitsysop/aports/-/jobs/860020

@serge-sans-paille
Copy link
Contributor

how strange, I don't reproduce on my machine... can you share the content of the build.sh mentioned in the logfile?

@serge-sans-paille
Copy link
Contributor

Thanks. I've been investigating a bit and I cannot find any compiler flag that would be responsible for the difference.
Can you share an extract of the output of the make VERBOSE=1 command when you build (and reproduce!) locally? Just to double check the flags.

I'd also be interested in the output of ldd ./test/test_xsimd.

Thanks!

@a16bitsysop
Copy link
Author

The verbose output is here: https://gitlab.alpinelinux.org/a16bitsysop/aports/-/jobs/861033

The flags are the same locally, but I noticed the arch is native. But that shouldn't make a difference for compiling tests on same processor as run should it?

Output of ldd test_xsimd:
```
/lib/ld-musl-x86_64.so.1 (0x7f413efc6000)
libgtest.so.1.12.1 => /usr/lib/libgtest.so.1.12.1 (0x7f413e530000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7f413e2e2000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7f413e2c4000)
libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7f413efc6000)

@serge-sans-paille
Copy link
Contributor

@a16bitsysop is it possible to link with GNU libm instead of musl to provide math symbol? I just want to check if the difference may come from different reference math routines.

@a16bitsysop
Copy link
Author

I could try newlib libm as that is already packaged for alpine aarch64, as same test failed for arch64.

How can I get xsimd to find newlib?
https://pkgs.alpinelinux.org/contents?branch=edge&name=newlib-aarch64-none-elf&arch=aarch64&repo=community

@serge-sans-paille
Copy link
Contributor

Probably add

target_link_libraries(test_xsimd m)

to test/CMakeLists.txt

or add the path of your math library in the LD_PRELOAD environment variable?

@a16bitsysop
Copy link
Author

okay will have a go

@a16bitsysop
Copy link
Author

I had a go but couldn’t get it working, is there a way to make a simple test case with just this code? It could rely on an installed xsimd in alpine. Then I could post to the musl mailing list, if you think it is a musl problem.

@a16bitsysop
Copy link
Author

there is openlibm as well, it is packaged for alpine as well: https://openlibm.org/

@serge-sans-paille
Copy link
Contributor

Can you giva a try to the following patch?

diff --git a/test/test_complex_trigonometric.cpp b/test/test_complex_trigonometric.cpp
index a486110..8878d00 100644
--- a/test/test_complex_trigonometric.cpp
+++ b/test/test_complex_trigonometric.cpp
@@ -155,7 +155,7 @@ struct complex_trigonometric_test
             out = atan(in);
             detail::store_batch(out, res, i);
         }
-        size_t diff = detail::get_nb_diff(res, expected);
+        size_t diff = detail::get_nb_diff_near(res, expected, 1e-10);
         CHECK_EQ(diff, 0);
     }
 

eventually changing 1e-10 ei 1e-8 (worst case) or 1e-12 better case?

@a16bitsysop
Copy link
Author

yes that works for x86 x86_64 and aarch64 https://gitlab.alpinelinux.org/a16bitsysop/aports/-/jobs/930009

does that prove what is the problem?

@serge-sans-paille
Copy link
Contributor

serge-sans-paille commented Dec 19, 2022 via email

@a16bitsysop
Copy link
Author

@a16bitsysop
Copy link
Author

xsimd 11.0.0 has 2 more test failures, that look like they should pass:

xsimd/src/xsimd-11.0.0/test/test_xsimd_api.cpp:695:
TEST CASE:  [xsimd api | float types functions]<float>
  exp10

xsimd/src/xsimd-11.0.0/test/test_xsimd_api.cpp:466: ERROR: CHECK_EQ( extract(xsimd::exp10(T(val))), std::pow(value_type(10), val) ) is NOT correct!
  values: CHECK_EQ( 100, 100 )

===============================================================================
xsimd/src/xsimd-11.0.0/test/test_xsimd_api.cpp:695:
TEST CASE:  [xsimd api | float types functions]<double>
  exp10
xsimd-11.0.0/test/test_xsimd_api.cpp:466: ERROR: CHECK_EQ( extract(xsimd::exp10(T(val))), std::pow(value_type(10), val) ) is NOT correct!
  values: CHECK_EQ( 100, 100 )

On alpine the tests fail to compile with gcc for 11.0.0 as well with:

xsimd-11.0.0/include/xsimd/arch/xsimd_scalar.hpp:500:37: error: unable to find numeric literal operator 'operator""f'
  500 |         return std::exp(0x1.26bb1cp+1f * x);
      |                                     ^~

@yu-re-ka
Copy link

Can confirm the same test failures on 11.1.0 on NixOS with musl libc.

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

3 participants