gimli-org / gimli

Geophysical Inversion and Modeling Library :earth_africa:
https://www.pygimli.org
Other
344 stars 131 forks source link

Fatal Python error: Floating point exception #655

Open daegerte opened 2 months ago

daegerte commented 2 months ago

Problem description

pygimli.test() fails with a fatal Python error: Floating point exception

Your environment

Please provide the output of print(pygimli.Report()) here. If that does not work, please give provide some additional information on your:

Operating system: Linux Ubuntu Python version: 3.10.12 pyGIMLi version: 1.4.6 Way of installation: Manual compilation from source, etc.


Date: Wed Feb 21 14:28:33 2024 CET

            OS : Linux
        CPU(s) : 2
       Machine : aarch64
  Architecture : 64bit
   Environment : Python

Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]

       pygimli : 1.4.6+43.gc2601998 (master)
        pgcore : Module not found
         numpy : 1.26.2
    matplotlib : 3.8.1
         scipy : 1.10.1

Steps to reproduce

Tell us how to reproduce this issue. Ideally, you could paste the code that produces the error:

>>> import pygimli
>>> pygimli.test()
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+                      Testing pygimli 1.4.6+43.gc2601998 (master)                       +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
======================================================= test session starts ========================================================
platform linux -- Python 3.10.12, pytest-8.0.1, pluggy-1.4.0 -- /usr/bin/python3.10
cachedir: .pytest_cache
rootdir: /home/damian/src/gimli/gimli
collecting ... Fatal Python error: Floating point exception

Current thread 0x0000ffff97165420 (most recent call first):
  File "/home/damian/src/gimli/gimli/pygimli/meshtools/mesh.py", line 124 in createMesh
  File "/home/damian/src/gimli/gimli/pygimli/testing/test_ERTManager_simulate.py", line 36 in <module>
  File "/home/damian/.local/lib/python3.10/site-packages/_pytest/assertion/rewrite.py", line 178 in exec_module
  File "<frozen importlib._bootstrap>", line 688 in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1006 in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1027 in _find_and_load
  File "<frozen importlib._bootstrap>", line 1050 in _gcd_import
  File "/usr/lib/python3.10/importlib/__init__.py", line 126 in import_module
  File "/home/damian/.local/lib/python3.10/site-packages/_pytest/pathlib.py", line 566 in import_path
  File "/home/damian/.local/lib/python3.10/site-packages/_pytest/python.py", line 538 in importtestmodule
  File "/home/damian/.local/lib/python3.10/site-packages/_pytest/python.py", line 586 in _getobj
  File "/home/damian/.local/lib/python3.10/site-packages/_pytest/python.py", line 317 in obj
  File "/home/damian/.local/lib/python3.10/site-packages/_pytest/doctest.py", line 570 in collect
  File "/home/damian/.local/lib/python3.10/site-packages/_pytest/runner.py", line 391 in collect
  File "/home/damian/.local/lib/python3.10/site-packages/_pytest/runner.py", line 346 in from_call
  File "/home/damian/.local/lib/python3.10/site-packages/_pytest/runner.py", line 393 in pytest_make_collect_report
  File "/home/damian/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 102 in _multicall
  File "/home/damian/.local/lib/python3.10/site-packages/pluggy/_manager.py", line 119 in _hookexec
  File "/home/damian/.local/lib/python3.10/site-packages/pluggy/_hooks.py", line 501 in __call__
  File "/home/damian/.local/lib/python3.10/site-packages/_pytest/runner.py", line 568 in collect_one_node
  File "/home/damian/.local/lib/python3.10/site-packages/_pytest/main.py", line 826 in _collect_one_node
  File "/home/damian/.local/lib/python3.10/site-packages/_pytest/main.py", line 938 in genitems
  File "/home/damian/.local/lib/python3.10/site-packages/_pytest/main.py", line 943 in genitems
  File "/home/damian/.local/lib/python3.10/site-packages/_pytest/main.py", line 943 in genitems
  File "/home/damian/.local/lib/python3.10/site-packages/_pytest/main.py", line 800 in perform_collect
  File "/home/damian/.local/lib/python3.10/site-packages/_pytest/main.py", line 337 in pytest_collection
  File "/home/damian/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 102 in _multicall
  File "/home/damian/.local/lib/python3.10/site-packages/pluggy/_manager.py", line 119 in _hookexec
  File "/home/damian/.local/lib/python3.10/site-packages/pluggy/_hooks.py", line 501 in __call__
  File "/home/damian/.local/lib/python3.10/site-packages/_pytest/main.py", line 326 in _main
  File "/home/damian/.local/lib/python3.10/site-packages/_pytest/main.py", line 273 in wrap_session
  File "/home/damian/.local/lib/python3.10/site-packages/_pytest/main.py", line 320 in pytest_cmdline_main
  File "/home/damian/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 102 in _multicall
  File "/home/damian/.local/lib/python3.10/site-packages/pluggy/_manager.py", line 119 in _hookexec
  File "/home/damian/.local/lib/python3.10/site-packages/pluggy/_hooks.py", line 501 in __call__
  File "/home/damian/.local/lib/python3.10/site-packages/_pytest/config/__init__.py", line 175 in main
  File "/home/damian/src/gimli/gimli/pygimli/testing/__init__.py", line 175 in test
  File "<stdin>", line 1 in <module>

Extension modules: numpy.core._multiarray_umath, numpy.core._multiarray_tests, numpy.linalg._umath_linalg, numpy.fft._pocketfft_internal, numpy.random._common, numpy.random.bit_generator, numpy.random._bounded_integers, numpy.random._mt19937, numpy.random.mtrand, numpy.random._philox, numpy.random._pcg64, numpy.random._sfc64, numpy.random._generator, pygimli.core._pygimli_, matplotlib._c_internal_utils, PIL._imaging, matplotlib._path, kiwisolver._cext, matplotlib._image, fontTools.misc.bezierTools, fontTools.varLib.iup, PyQt5.QtCore, PyQt5.QtGui, PyQt5.QtWidgets (total: 24)
Floating point exception (core dumped)

Expected behavior

Tests should run throug without error.

Actual behavior

Test fail with above error.

halbmy commented 2 months ago
       pygimli : 1.4.6+43.gc2601998 (master)
        pgcore : Module not found

Did you build the pygimli core by yourself?

daegerte commented 2 months ago

Yes, we follow your instructions and we don't use no conda. We alsop have an older version (1.4.3+39.g0f55444b) running on another laptop as well as on a server, both with ubuntu 20 with python 3.8.10

carsten-forty2 commented 2 months ago

for own builds .. can you please try:

make gtest

This is a first test of the core library without any python involved .. maybe its shows some additional information to help address the problem

daegerte commented 2 months ago

Hi, sorry for late answer, been absent.

First the working older version:

daegerte@Damian:~/gimli/build$ make gtest
Scanning dependencies of target gimli
[  4%] Building CXX object core/src/CMakeFiles/gimli.dir/gimli.cpp.o
[  8%] Linking CXX shared library ../../lib/libgimli.so
[ 95%] Built target gimli
Scanning dependencies of target gimliUnitTest
[ 95%] Building CXX object core/tests/unittest/CMakeFiles/gimliUnitTest.dir/unitTest.cpp.o
[100%] Linking CXX executable ../../../bin/gimliUnitTest
[100%] Built target gimliUnitTest
Scanning dependencies of target gtest
starting unittest
..CHOLMOD sparse:  A:  3-by-3, nz 3, up/lo.  OK
CHOLMOD analyzed preordering: 2
CHOLMOD factor:  L:  3-by-3  simplicial, LDL'. nzmax 3.  nz 3  OK
Info: non-symmetric matrix found ( 1 2 4   -1 tol: 5 ).. switching to umfpack.
Info: Using umfpack.
CHOLMOD sparse:  A:  3-by-3, nz 9, up/lo.  OK
CHOLMOD analyzed preordering: 2
CHOLMOD factor:  L:  3-by-3  simplicial, LDL'. nzmax 6.  nz 6  OK
CHOLMOD sparse:  A:  3-by-3, nz 6, upper.  OK
CHOLMOD analyzed preordering: 2
CHOLMOD factor:  L:  3-by-3  simplicial, LDL'. nzmax 6.  nz 6  OK
CHOLMOD sparse:  A:  3-by-3, nz 6, lower.  OK
CHOLMOD analyzed preordering: 2
CHOLMOD factor:  L:  3-by-3  simplicial, LDL'. nzmax 6.  nz 6  OK
CHOLMOD sparse:  A:  3-by-3, nz 9, up/lo.  OK
CHOLMOD analyzed preordering: 2
CHOLMOD factor:  L:  3-by-3  simplicial, LDL'. nzmax 6.  nz 6  OK
CHOLMOD sparse:  A:  3-by-3, nz 6, lower.  OK
CHOLMOD analyzed preordering: 2
CHOLMOD factor:  L:  3-by-3  simplicial, LDL'. nzmax 6.  nz 6  OK
CHOLMOD sparse:  A:  3-by-3, nz 6, upper.  OK
CHOLMOD analyzed preordering: 2
CHOLMOD factor:  L:  3-by-3  simplicial, LDL'. nzmax 6.  nz 6  OK
.............................Hello, this is: libgimli-v1.4.3-39-g0f55444b
I'm calling from: ./core/tests/unittest/testGIMLiMisc.h:31      void GIMLIMiscTest::testGimliMisc() 
number of CPU: 3
size_t: 8
ssize_t: 8
Index: 8
Sindex: 8
int: 4
long: 8
long long int: 8
int8: 1
int16: 2
int32: 4
int64: 8
uint8: 1
uint16: 2
uint32: 4
uint64: 8
float: 4
double: 8
....MemWatch
    ./core/tests/unittest/testGIMLiMisc.h:90     Memory (st) in use: abs: 230.539 rel: 0 MByte. t = 4.0507e-05/4.1281e-05 s 
    ./core/tests/unittest/testGIMLiMisc.h:92     Memory (st) in use: abs: 993.48 rel: 762.941 MByte. t = 0.000102137/6.0694e-05 s 
    ./core/tests/unittest/testGIMLiMisc.h:94     Memory (st) in use: abs: 230.539 rel: -762.941 MByte. t = 0.000171098/6.889e-05 s 
    ./core/tests/unittest/testGIMLiMisc.h:96     Memory (st) in use: abs: 993.859 rel: 763.32 MByte. t = 0.775432/0.775262 s 
    ./core/tests/unittest/testGIMLiMisc.h:98     Memory (st) in use: abs: 230.844 rel: -763.016 MByte. t = 0.838828/0.0633951 s 
..................

OK (53 tests)

[100%] Built target gtest

and now on not working new version Nothing goes here.

damian@Damian:~/src/gimli/build$ make gtest
Consolidate compiler generated dependencies of target gimli
[ 95%] Built target gimli
[ 95%] Building CXX object core/tests/unittest/CMakeFiles/gimliUnitTest.dir/unitTest.cpp.o
[100%] Linking CXX executable ../../../bin/gimliUnitTest
[100%] Built target gimliUnitTest
starting unittest
.........Floating point exception (core dumped)
make[3]: *** [core/tests/unittest/CMakeFiles/gtest.dir/build.make:70: gtest] Error 136
make[2]: *** [CMakeFiles/Makefile2:639: core/tests/unittest/CMakeFiles/gtest.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:646: core/tests/unittest/CMakeFiles/gtest.dir/rule] Error 2
make: *** [Makefile:400: gtest] Error 2
carsten-forty2 commented 2 months ago

I'm not sure if we ever had such a Machine : aarch64 platform. We dont have such hardware with a build toolchain to test it ourself.

We recently released a new version and rebuild on various platforms on different machines without any problems. Can you please check it the error persists with the recent dev branch?

If there is still the same error, it might be possible to identify the test that throws this exception, however its a little fiddely for your side since we can't search ourself without hand on such problem.