JohannesBuchner / PyMultiNest

Pythonic Bayesian inference and visualization for the MultiNest Nested Sampling Algorithm and PyCuba's cubature algorithms.
http://johannesbuchner.github.io/PyMultiNest/
Other
194 stars 88 forks source link

Segmentation fault with macOS Big Sur #174

Closed tomasstolker closed 2 years ago

tomasstolker commented 3 years ago

After upgrading to macOS Big Sur and recompiling Multinest I run into a segmentation fault directly after the opening message:

 *****************************************************
 MultiNest v3.10
 Copyright Farhan Feroz & Mike Hobson
 Release Jul 2015

 no. of live points =  1000
 dimensionality =    9
 *****************************************************
[1]    73232 segmentation fault

I have tried reinstalling both PyMultiNest and MultiNest. The compilation of MultiNest doesn't cause any errors but I have also tried compiling with an older version of gcc.

Any suggestions on what could cause this issue?

grburgess commented 3 years ago

@tomasstolker have you tried running just Multinest (like the examples)? I can get that to run, but it is the interface to PyMultinest that seems to be crashing due to an inability to communicate the threading.

JohannesBuchner commented 3 years ago

Make sure you clean the build directory completely, so that cmake does not reuse the configuration.

grburgess commented 3 years ago

@JohannesBuchner This is a completely clean build system. There seems to be something not working with threading.

grburgess commented 3 years ago

If I run the tests from the repo:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   ???                             0x00000000000003e8 0 + 1000
1   libgfortran.3.dylib             0x000000011616bcf6 _gfortran_transfer_array + 310
2   libmultinest.3.11.dylib         0x0000000117eb712f __nested_MOD_gen_initial_live + 8164
3   libmultinest.3.11.dylib         0x0000000117eb712f __nested_MOD_gen_initial_live + 8164
4   libmultinest.3.11.dylib         0x0000000117eb712f __nested_MOD_gen_initial_live + 8164
5   libmultinest.3.11.dylib         0x0000000117eb712f __nested_MOD_gen_initial_live + 8164
6   libmultinest.3.11.dylib         0x0000000117eb712f __nested_MOD_gen_initial_live + 8164
7   libmultinest.3.11.dylib         0x0000000117eb712f __nested_MOD_gen_initial_live + 8164
8   libmultinest.3.11.dylib         0x0000000117eb712f __nested_MOD_gen_initial_live + 8164
9   libmultinest.3.11.dylib         0x0000000117eb712f __nested_MOD_gen_initial_live + 8164
10  libmultinest.3.11.dylib         0x0000000117eb712f __nested_MOD_gen_initial_live + 8164
11  libmultinest.3.11.dylib         0x0000000117eb712f __nested_MOD_gen_initial_live + 8164

...


Thread 1:
0   libsystem_kernel.dylib          0x00007fff20346b3a fsync + 10
1   libsqlite3.0.dylib              0x0000000110e4d753 unixSync + 52
2   libsqlite3.0.dylib              0x0000000110e3aa9d sqlite3PagerCommitPhaseOne + 990
3   libsqlite3.0.dylib              0x0000000110e3acd8 sqlite3BtreeCommitPhaseOne + 133
4   libsqlite3.0.dylib              0x0000000110e5d7a3 sqlite3VdbeHalt + 1345
5   libsqlite3.0.dylib              0x0000000110e68fad sqlite3VdbeExec + 36537
6   libsqlite3.0.dylib              0x0000000110e3c43e sqlite3_step + 391
7   _sqlite3.cpython-38-darwin.so   0x0000000110e1f74f pysqlite_step + 31
8   _sqlite3.cpython-38-darwin.so   0x0000000110e1afa6 pysqlite_connection_commit + 161
9   org.python.python               0x000000010fd5583b cfunction_vectorcall_NOARGS + 207
10  org.python.python               0x000000010fd27f20 _PyObject_CallFunctionVa + 115
11  org.python.python               0x000000010fd2856d _PyObject_CallMethod_SizeT + 172
12  _sqlite3.cpython-38-darwin.so   0x0000000110e1c6a0 pysqlite_connection_exit + 115
13  org.python.python               0x000000010fd271c6 cfunction_call_varargs + 319
14  org.python.python               0x000000010fd26c21 _PyObject_MakeTpCall + 274
15  org.python.python               0x000000010fdc411f _PyEval_EvalFrameDefault + 28869
16  org.python.python               0x000000010fd27466 function_code_fastcall + 106
17  org.python.python               0x000000010fdc7925 call_function + 346
18  org.python.python               0x000000010fdc44e3 _PyEval_EvalFrameDefault + 29833
19  org.python.python               0x000000010fdc843f _PyEval_EvalCodeWithName + 1947
20  org.python.python               0x000000010fd275cb _PyFunction_Vectorcall + 227
21  org.python.python               0x000000010fd26ead PyVectorcall_Call + 108
22  org.python.python               0x000000010fdc487c _PyEval_EvalFrameDefault + 30754
23  org.python.python               0x000000010fdc843f _PyEval_EvalCodeWithName + 1947
24  org.python.python               0x000000010fd275cb _PyFunction_Vectorcall + 227
25  org.python.python               0x000000010fdc7925 call_function + 346
26  org.python.python               0x000000010fdc45bc _PyEval_EvalFrameDefault + 30050
27  org.python.python               0x000000010fdc843f _PyEval_EvalCodeWithName + 1947
28  org.python.python               0x000000010fd275cb _PyFunction_Vectorcall + 227
29  org.python.python               0x000000010fdc7925 call_function + 346
30  org.python.python               0x000000010fdc44e3 _PyEval_EvalFrameDefault + 29833
31  org.python.python               0x000000010fd27466 function_code_fastcall + 106
32  org.python.python               0x000000010fd26ead PyVectorcall_Call + 108
33  org.python.python               0x000000010fdc487c _PyEval_EvalFrameDefault + 30754
34  org.python.python               0x000000010fdc843f _PyEval_EvalCodeWithName + 1947
35  org.python.python               0x000000010fd275cb _PyFunction_Vectorcall + 227
36  org.python.python               0x000000010fdc7925 call_function + 346
37  org.python.python               0x000000010fdc45bc _PyEval_EvalFrameDefault + 30050
38  org.python.python               0x000000010fd27466 function_code_fastcall + 106
39  org.python.python               0x000000010fdc7925 call_function + 346
40  org.python.python               0x000000010fdc44e3 _PyEval_EvalFrameDefault + 29833
41  org.python.python               0x000000010fd27466 function_code_fastcall + 106
42  org.python.python               0x000000010fdc7925 call_function + 346
43  org.python.python               0x000000010fdc44e3 _PyEval_EvalFrameDefault + 29833
44  org.python.python               0x000000010fd27466 function_code_fastcall + 106
45  org.python.python               0x000000010fd29594 method_vectorcall + 256
46  org.python.python               0x000000010fd26ead PyVectorcall_Call + 108
47  org.python.python               0x000000010fe3ddf4 t_bootstrap + 74
48  org.python.python               0x000000010fdfef6a pythread_wrapper + 25
49  libsystem_pthread.dylib         0x00007fff20378950 _pthread_start + 224
50  libsystem_pthread.dylib         0x00007fff2037447b thread_start + 15

This seems really low level.

tomasstolker commented 3 years ago

@JohannesBuchner Yes I have cleaned the build folder.

@grburgess No I haven't tried that. How do I compile and run one of the examples?

grburgess commented 3 years ago

@tomasstolker when you build multinest it will put a few executables in the location you choose for the make install path. Executables like gaussian could be in /usr/local/bin

tomasstolker commented 3 years ago

Thanks, I found the executables of the examples in the bin folder of MultiNest. They run indeed without a problem.

JohannesBuchner commented 3 years ago

You can try UltraNest instead, which should be easier to install. https://johannesbuchner.github.io/UltraNest/

JohannesBuchner commented 3 years ago

But I hope someone figures out this mystery.

grburgess commented 3 years ago

I will keep trying. Maybe if I use linux..

tomasstolker commented 3 years ago

@JohannesBuchner Thanks for pointing me in the direction of UltraNest. It was straightforward to adjust from PyMultiNest and seems to work great so far :).

In case this is useful information: the segmentation fault of PyMultiNest on Big Sur occured in my case after the 10th likelihood evaluation so not directly at the start.

JohannesBuchner commented 3 years ago

Perhaps it is the Python garbage collector removing some pointers? See #5

tomasstolker commented 3 years ago

@JohannesBuchner Thanks for the suggestion. Running $ gdb python and then > run seems to work fine and does not cause a segfault.

JohannesBuchner commented 2 years ago

I Am closing this because it is not a PyMultiNest bug.