Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
29 Views

Get segmentation fault but I don't receive any indication on where it happens

Hi,

I'm running a job on a cluster and I receive a segmentation fault error. In the past, using traceback, I had received indications on where it was happening, but now I don't get any line information.

mpif90  -extend-source -r8 -c -O2 -g -traceback -warn noalign 3dpic_full_mpi.f

mpif90 -o 3dpic_full_mpi.exe 3dpic_full_mpi.o  -lsiloh5 -lhdf5_hl -lhdf5 -lsz -lz -lm -lrt -ldl -lstdc++ -O2 -g -traceback -mcmodel medium

Do I have to change something?

Thanks

GB

0 Kudos
2 Replies
Highlighted
29 Views

Usually when you get a segmentation fault that has no traceback (with trace back enabled), this often is due to nested library calls to libraries not compiled with Fortran (and/or not with traceback). The source of this is difficult to identify unless you can catch it with a debugger. In situations where you cannot catch this with a debugger, then I suggest inserting some conditional compile assert code preceding suspected library calls.

!dir$ if defined(USE_ASSERTS) ! you define USE_ASSERTS when you want asserts
IF(YourAPIfailTestHere) call YourBugCatcher("Your message")
! or IF(YourAPIfailTestHere) call TRACEBACKQQ( "Your message")
!dir$ endif
call SomeLibrary(...)

.or.

#ifdef(USE_ASSERTS)
! Using FPP you define USE_ASSERTS when you want asserts
IF(YourAPIfailTestHere) call YourBugCatcher(__FILE__, __LINE__, "Your message")
#endif
call SomeLibrary(...)

.or.

#ifdef(USE_ASSERTS)
! Using FPP you define USE_ASSERTS when you want asserts
write(UnitOfYourTraceFile, *) __FILE__, __LINE__
flush(UnitOfYourTraceFile)
#endif
call SomeLibrary(...)

Jim Dempsey

0 Kudos
Highlighted
Beginner
29 Views

Hi Jim,

I doubt it is an external library: I'm working on a new routine inside my code and I expect this is creating the problem!

But I'll look into it.

GB

0 Kudos