CRPropa / CRPropa3

CRPropa is a public astrophysical simulation framework for propagating extraterrestrial ultra-high energy particles. https://crpropa.github.io/CRPropa3/
https://crpropa.desy.de
GNU General Public License v3.0
65 stars 66 forks source link

Segmentation Fault on Test #17: testMagneticLensPythonInterface #400

Closed angelinapartenheimer closed 1 year ago

angelinapartenheimer commented 1 year ago

Dear developers,

I ran into a Segmentation Fault while installing CRPropa.

System Information:

Here is the test failing:

 Start  1: testCore
 1/20 Test  #1: testCore ..........................   Passed    0.04 sec
      Start  2: testVector3
 2/20 Test  #2: testVector3 .......................   Passed    0.02 sec
      Start  3: testModuleList
 3/20 Test  #3: testModuleList ....................   Passed    0.02 sec
      Start  4: testMagneticField
 4/20 Test  #4: testMagneticField .................   Passed    0.02 sec
      Start  5: testTurbulentField
 5/20 Test  #5: testTurbulentField ................   Passed    0.13 sec
      Start  6: testAdvectionField
 6/20 Test  #6: testAdvectionField ................   Passed    0.02 sec
      Start  7: testDensity
 7/20 Test  #7: testDensity .......................   Passed    0.02 sec
      Start  8: testDINT
 8/20 Test  #8: testDINT ..........................   Passed    0.03 sec
      Start  9: testPropagation
 9/20 Test  #9: testPropagation ...................   Passed    0.02 sec
      Start 10: testBreakCondition
10/20 Test #10: testBreakCondition ................   Passed    0.02 sec
      Start 11: testInteraction
11/20 Test #11: testInteraction ...................   Passed   31.15 sec
      Start 12: testSource
12/20 Test #12: testSource ........................   Passed    0.10 sec
      Start 13: testOutput
13/20 Test #13: testOutput ........................   Passed    0.04 sec
      Start 14: testFunctionalGroups
14/20 Test #14: testFunctionalGroups ..............   Passed    0.02 sec
      Start 15: testAdiabaticCooling
15/20 Test #15: testAdiabaticCooling ..............   Passed    0.02 sec
      Start 16: testGalacticMagneticLens
16/20 Test #16: testGalacticMagneticLens ..........   Passed    0.11 sec
      Start 17: testMagneticLensPythonInterface
17/20 Test #17: testMagneticLensPythonInterface ...***Exception: SegFault  0.17 sec
      Start 18: testSimulationExecution
18/20 Test #18: testSimulationExecution ...........   Passed    2.30 sec
      Start 19: testDiffusionSDE
19/20 Test #19: testDiffusionSDE ..................   Passed    1.69 sec
      Start 20: testPythonExtension
20/20 Test #20: testPythonExtension ...............   Passed    0.18 sec

95% tests passed, 1 tests failed out of 20

Total Test time (real) =  36.15 sec

The following tests FAILED:
     17 - testMagneticLensPythonInterface (SEGFAULT)
Errors while running CTest
Output from these tests are in: /Users/angelinapartenheimer/wipac_research/crpropa_update/CRPropa3/build/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.

The test fails without output, which isn't super helpful. I did view a similar issue on GitHub: https://github.com/CRPropa/CRPropa3/issues/316 As @rafaelab suggested, I made sure that the assertEquals() in the test file were replaced by assertEqual(), and they already were.

I was stubborn and decided to use CRPropa anyway. The issue I run into occurs when I run one of the examples listed on the documentation page: https://crpropa.github.io/CRPropa3/pages/example_notebooks/galactic_lensing/lensing_cr.v4.html

Specifically, I get issues with this block of code:

#stack all maps
crMap = np.zeros(49152)
for pid in M.getParticleIds():
    energies = M.getEnergies(int(pid))
    for i, energy in enumerate(energies):
        crMap += M.getMap(int(pid), energy * crpropa.eV )

When I run this, my Jupyter kernel dies every time. I suspect this is related to the test #17 SegFault, as this exact block of code exists inside the testMagneticLensPythonInterface test file under "test ParticleMapsContainer()".

Any hint as to what could be going wrong would be very helpful. Thank you so much!

lukasmerten commented 1 year ago

I guess this is a duplicate of #397 or at least closely related to that issue. I close this for now.