Skip to content

Conversation

LecrisUT
Copy link
Collaborator

@LecrisUT LecrisUT commented Jun 9, 2023

There were failures with the cibuildwheel for windows. Adding a native CI to test these

@LecrisUT LecrisUT force-pushed the test/windows-macos branch 4 times, most recently from b0c165d to aeb90be Compare June 9, 2023 11:21
@codecov-commenter
Copy link

codecov-commenter commented Jun 9, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (3800c46) 85.92% compared to head (dbbf189) 85.92%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #286   +/-   ##
========================================
  Coverage    85.92%   85.92%           
========================================
  Files           23       23           
  Lines         6082     6082           
========================================
  Hits          5226     5226           
  Misses         856      856           
Flag Coverage Δ
c_api 74.21% <ø> (ø)
fortran_api 37.37% <ø> (ø)
python_api 82.85% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/spglib.c 73.03% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@LecrisUT LecrisUT force-pushed the test/windows-macos branch 3 times, most recently from 3b2643c to 8fc8939 Compare June 9, 2023 13:25
@LecrisUT LecrisUT requested review from lan496 and atztogo June 9, 2023 13:39
@LecrisUT
Copy link
Collaborator Author

LecrisUT commented Jun 9, 2023

@lan496 @atztogo This is weird see 14b1a6b and 8fc8939. If we have the build in Debug mode (as it should be for the CI maybe, or maybe RelWithDebInfo), than the tests succeed. But in the release build, the MacOS test fails at test_magnetic_symmetry.test_with_broken_symmetry. Any clues of what can happen there?

@LecrisUT LecrisUT mentioned this pull request Jun 9, 2023
@atztogo
Copy link
Collaborator

atztogo commented Jun 10, 2023

test_magnetic_symmetry.test_with_broken_symmetry is a sensitive case, and may be not very logical to fix it. I would like @lan496 to have a look when you have time.

@lan496
Copy link
Member

lan496 commented Jun 10, 2023

Yes, this test case is very sensitive to floating-point arithmetic.
In fact, linux and mac(intel) failed to search symmetry, but mac(arm64) returned a symmetry when I checked.

@LecrisUT
Copy link
Collaborator Author

I believe there is a way to write tests against floating point errors so that we test against multiple random values

@lan496
Copy link
Member

lan496 commented Jun 10, 2023

I do not come up with any way other than checking that the implementation does not cause a segmentation fault.

@LecrisUT
Copy link
Collaborator Author

I've found a quick fix in the meantime, marking the tests as xpass(strict=false) both on C and python side

@LecrisUT
Copy link
Collaborator Author

For the proper solution I think I've found a design, but I need help on the numbers.

Basically we run the tests n times with a random noise. As soon as one set of variable triggers the test failure, we check the error code and everything and due the proper assertions.

The help I need is with: what is the central value that should cause broken_symmetry and what are the suggested noise to apply?

@lan496
Copy link
Member

lan496 commented Jun 15, 2023

You mean to add some random values to double position[][3]? I have no idea the magnitude of the random noise...

If we run the tests with random noises, what could we guarantee from the test? At least, the xpass(strict=false) workaround checks that the current implementation does not cause a segmentation fault for the difficult situation. I think that it is enough for now.

@LecrisUT
Copy link
Collaborator Author

If we run the tests with random noises, what could we guarantee from the test?

Well the whole point of test_magnetic_symmetry.test_with_broken_symmetry is to test that in numerically unstable regions:

  • The calculation fails with the correct expected error
  • All of memory allocation/de-allocation is safe around that function call
  • The calculation is not passing when it shouldn't

The fact that this test fails (rather that it doesn't fail) is a genuine issue. Spglib is giving a confident answer of the symmetry group when in principle it should be undetermined. Ideally that test should always pass (i.e. it should always give an error) regardless of numerical error, but as a first step it should be confirmed that the compiler does indeed fail for some points, and that the error mechanism is not broken in that compiler.

That's why I see that a gradual way of fixing this is:

  1. Test with n random noise and require that at least one of them fails
  2. Change the tests to xfail and investigate what's the general behaviour. Technically gtest and catch do not have xfail implemented, but maybe that can be solved in the meantime
  3. Resolve the core issue, maybe doing some pre-checks and be more generous in the failure. It should be that for reasonable random variance well within symprec, any test would fail. Then convert xfail to normal assertion.

@LecrisUT LecrisUT force-pushed the test/windows-macos branch from 14b1a6b to be8e57d Compare June 16, 2023 23:07
LecrisUT added a commit to LecrisUT/spglib that referenced this pull request Jun 16, 2023
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
@LecrisUT LecrisUT force-pushed the test/windows-macos branch 2 times, most recently from 63fa6a3 to 53f5a08 Compare June 19, 2023 13:51
@atztogo atztogo mentioned this pull request Jun 20, 2023
1 task
@LecrisUT LecrisUT force-pushed the test/windows-macos branch 5 times, most recently from 3152d9d to d9bb4e3 Compare June 20, 2023 07:14
@LecrisUT LecrisUT self-assigned this Jun 20, 2023
@LecrisUT LecrisUT force-pushed the test/windows-macos branch 3 times, most recently from ddffc42 to 9164205 Compare June 20, 2023 13:27
@LecrisUT LecrisUT mentioned this pull request Aug 9, 2023
4 tasks
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
@LecrisUT LecrisUT force-pushed the test/windows-macos branch 8 times, most recently from 108e77c to 8af36f2 Compare August 14, 2023 13:46
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
The test suite does not load the library properly when running ctest. Maybe where is a nuance that I am missing.

Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
@LecrisUT LecrisUT force-pushed the test/windows-macos branch from 8af36f2 to fe822d6 Compare August 14, 2023 13:49
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
@LecrisUT LecrisUT force-pushed the test/windows-macos branch from fe822d6 to 40db9ae Compare August 14, 2023 14:19
@LecrisUT LecrisUT merged commit de0b5fa into spglib:develop Aug 14, 2023
@LecrisUT LecrisUT deleted the test/windows-macos branch August 14, 2023 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants