PrincetonUniversity / tristan-mp-v2

Tristan-MP v2 [public]
https://princetonuniversity.github.io/tristan-v2/
BSD 3-Clause "New" or "Revised" License
12 stars 3 forks source link

Getting Segmentation fault - invalid memory reference when running 1D two-stream instability problem #16

Closed rgill3141 closed 8 months ago

rgill3141 commented 9 months ago

Hi,

I'm trying to run the 1D two-stream instability problem from the latest version, but getting the following error:

Program received signal SIGSEGV: Segmentation fault - invalid memory reference.

I'm compiling it using: python configure.py -1d -mpi08 -hdf5 --user=user_twostream, and it compiles fine.

Then I run it using `mpirun -np 6 $SCRATCH/tristan-mp-v2/bin/tristan-mp1d -i $SCRATCH/TRISTAN/input/input.twostream -o $SCRATCH/TRISTAN/output -r $SCRATCH/TRISTAN/restart'

I'm using the input file from the latest version and the only change I made is:

sizex = 6 mx0 = 300

All else was unchanged. Let me know what other info I can provide to sort this issue.

Thanks, Ramandeep

haykh commented 9 months ago

can you compile/run with the --debug=2 flag? this will hopefully tell exactly at which line the error occurs.

rgill3141 commented 9 months ago

I added the debug=2 flag while configuring, but it didn't give me any more/new information. The configuration did complain about the de0bug flag:

Screenshot 2024-03-01 at 15 04 50
rgill3141 commented 9 months ago

I've compiled and run the two-stream problem before and it was working fine. So, I tried switching to v2.6 and v2.5, but now these versions don't even compile. Any further suggestions?

haykh commented 9 months ago

i need a bit more information. what exactly does it say when it doesn't compile? happy to jump on zoom this week (feel free to email me).

haykh commented 8 months ago

@rgill3141 so apparently the code is fine, but in the default input.twostream the shift_gamma is for some reason set to a value < 1. And the code crashes in this line of user_twostream.F90:

52:    u_ = shift_gamma * sqrt(1.0 - shift_gamma**(-2))

i think previously the definition might have been changed. if you change shift_gamma to a value > 1 -- it will run fine.

for the future, if you compile with --debug=2 -- it should tell exactly where it fails. in my case it was:

forrtl: error (75): floating point exception
Image              PC                Routine            Line        Source
tristan-mp1d       0000000000DD810B  Unknown               Unknown  Unknown
libpthread-2.28.s  000014D84944ECF0  Unknown               Unknown  Unknown
tristan-mp1d       0000000000A2A900  m_userfile_mp_use          52  user_twostream.F90
tristan-mp1d       0000000000723CD8  m_initialize_mp_i         127  initialize.F90
tristan-mp1d       0000000000729A55  MAIN__                      9  tristan.F90
tristan-mp1d       0000000000405DE2  Unknown               Unknown  Unknown
libc-2.28.so       000014D8490B1D85  __libc_start_main     Unknown  Unknown
tristan-mp1d       0000000000405CEE  Unknown               Unknown  Unknown
rgill3141 commented 8 months ago

Indeed, it was the shift_gamma set to less than unity which was the problem. The code runs fine after fixing for that.