benroberts999 / ampsci

A c++ program for high-precision atomic structure calculations of one and two valence systems. Uses Hartree-Fock + correlation potential method. Can calculate ionisation cross sections with large of energy/momentum transfer.
https://ampsci.dev
MIT License
20 stars 7 forks source link

Catch2 error with g++ on mac #41

Closed benroberts999 closed 4 months ago

benroberts999 commented 6 months ago

With g++ on macOS, the "mayfail" MixedStates test causes a SIGABRT failure (output below). Doesn't impact actual code - but limits usefulness of tests.

It works fine macOS with clang, and on linux with g++ and clang. Fails both with and without openMP. It happens on a catch2 'REQUIRE' clause that fails - this test is known to fail, and the program should mark it as 'failed as expected' and continue. Instead, the Catch::TestFailureException exception is thrown.

I think this is a maybe bug with Catch2? Not sure best workaround?

Output:

AMPSCI v: 0.0 [main/0e3a2d69]
Libraries:
  GSL (GNU Scientific Libraries): 2.7.1
  OpenMP: 201511
Compiled: g++-13 [Homebrew GCC 13.2.0] 13.2.0 2024-05-23 15:20 AEST

./tests \[MixedStates\]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests is a Catch v2.13.9 host application.
Run with -? for options

-------------------------------------------------------------------------------
External Field: Mixed-states2
-------------------------------------------------------------------------------
src/ExternalField/MixedStates.tests.cpp:87
...............................................................................

src/ExternalField/MixedStates.tests.cpp:209: FAILED:
  REQUIRE( worst < 1.0e-2 )
with expansion:
  0.1529438228 < 0.01

terminate called after throwing an instance of 'Catch::TestFailureException'
src/ExternalField/MixedStates.tests.cpp:209: FAILED:
  {Unknown expression after the reported line}
due to a fatal error condition:
  SIGABRT - Abort (abnormal termination) signal

===============================================================================
test cases:  2 | 1 passed | 1 failed
assertions: 10 | 8 passed | 2 failed as expected

Expected output

AMPSCI v: 0.0 [main/0e3a2d69]
Libraries:
  GSL (GNU Scientific Libraries): 2.7.1
  OpenMP: 201511
Compiled: g++-13 [Ubuntu 13.1.0-8ubuntu1~22.04] 13.1.0 2024-05-23 15:20 AEST

./tests [MixedStates]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests is a Catch v2.13.9 host application.
Run with -? for options

-------------------------------------------------------------------------------
External Field: Mixed-states2
-------------------------------------------------------------------------------
src/ExternalField/MixedStates.tests.cpp:87
...............................................................................

src/ExternalField/MixedStates.tests.cpp:209: FAILED:
  REQUIRE( worst < 1.0e-2 )
with expansion:
  0.1529438228 < 0.01

===============================================================================
test cases: 2 | 1 passed | 1 failed as expected
assertions: 9 | 8 passed | 1 failed as expected
zacharysh commented 5 months ago

I can't reproduce this when building on my M1 Mac with g++-14. Was the cause of this issue ever identified?

Output:

AMPSCI v: 0.0 [main/85a64af]
Libraries:
  GSL (GNU Scientific Libraries): 2.8
  OpenMP: 201511
Compiled: g++-14 [Homebrew GCC 14.1.0_1] 14.1.0 2024-06-27 19:58 AEST

The output of ./tests \[MixedStates\] is as expected:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests is a Catch v2.13.9 host application.
Run with -? for options

-------------------------------------------------------------------------------
External Field: Mixed-states2
-------------------------------------------------------------------------------
src/ExternalField/MixedStates.tests.cpp:87
...............................................................................

src/ExternalField/MixedStates.tests.cpp:209: FAILED:
  REQUIRE( worst < 1.0e-2 )
with expansion:
  0.1529438228 < 0.01

===============================================================================
test cases: 2 | 1 passed | 1 failed as expected
assertions: 9 | 8 passed | 1 failed as expected
benroberts999 commented 4 months ago

Thanks for checking! Maybe just a bug with one version. Pretty sure issue is outside of ampsci, and doesn't seem to actually matter much, so will just close this