Hi all,
I'm adding a utility to ABINIT but i ran into some segmentation faults. What is the easiest way to debug those? I tried to reconfigure with --enable-debug=verbose but that did not do anything for me, so how would i start a debug mode? Is there a way not to re-compile the whole abinit package but rather just my part with like a -traceback flag?
debug issues [SOLVED]
Moderators: fgoudreault, mcote
Forum rules
Please have a look at ~abinit/doc/config/build-config.ac in the source package for detailed and up-to-date information about the configuration of Abinit 8 builds.
For a video explanation on how to build Abinit 7.x for Linux, please go to: http://www.youtube.com/watch?v=DppLQ-KQA68.
IMPORTANT: when an answer solves your problem, please check the little green V-like button on its upper-right corner to accept it.
Please have a look at ~abinit/doc/config/build-config.ac in the source package for detailed and up-to-date information about the configuration of Abinit 8 builds.
For a video explanation on how to build Abinit 7.x for Linux, please go to: http://www.youtube.com/watch?v=DppLQ-KQA68.
IMPORTANT: when an answer solves your problem, please check the little green V-like button on its upper-right corner to accept it.
Re: debug issues
The flag I would recommand (at least) to debug a code with segmentation fault are
for intel compiler or
for gnu compiler.
Note that the whole abinit package is tested with the -fcheck=all flag.
configuring abinit with -enable-debug=verbose might not be the best since it produces a lot of debug information (there are sentinels to know in what function/part of the code the problem is).
The options for --enable-debug are
In your *.ac file you can try to add the debug flags of your choice to the variable
That should only modify the makefile in the directory src/98_main and then recompile only the excutable, where your code is I guess.
BUT note that if the abinit package is not compiled with -g and the bug is inside the abinit src, then you won't be able to debug/have information to solve your issue. So this option will help you only the bug is inside ONLY inside your code. That's why I would recommand to rebuild the full abinit package with the same options (Remark : the compilation is usually faster(2x) with those flags than with juste -O2 since the compiler do not try to optimize the code)
Good luck
Jordan
Code: Select all
-g -O0 -check all -Wall -traceback
Code: Select all
-g -O0 -fcheck=all -Wall -fbacktrace
Note that the whole abinit package is tested with the -fcheck=all flag.
configuring abinit with -enable-debug=verbose might not be the best since it produces a lot of debug information (there are sentinels to know in what function/part of the code the problem is).
The options for --enable-debug are
Code: Select all
no : strip debugging symbols
yes : keep debugging symbols and allow for user-defined flags
basic : add '-g' option when the compiler allows for it
verbose : like basic + definition of the DEBUG_VERBOSE CPP option
enhanced : disable optimizations and debug verbosely
paranoid : enhanced debugging with additional warnings
naughty : paranoid debugging with array bound check
In your *.ac file you can try to add the debug flags of your choice to the variable
Code: Select all
fcflags_opt_98_main="-g -O0 -check all -traceback"
That should only modify the makefile in the directory src/98_main and then recompile only the excutable, where your code is I guess.
BUT note that if the abinit package is not compiled with -g and the bug is inside the abinit src, then you won't be able to debug/have information to solve your issue. So this option will help you only the bug is inside ONLY inside your code. That's why I would recommand to rebuild the full abinit package with the same options (Remark : the compilation is usually faster(2x) with those flags than with juste -O2 since the compiler do not try to optimize the code)
Good luck
Jordan
Re: debug issues
The only *.ac file that i have is configure.ac, and when i put those flags in it doesn't do anything for me. How come --enable-debug doesn't do anything for me when i put that as an argument in my configuration:
../configure --prefix=/home/stud2/bin --disable-mpi --enable-debug FC=ifort CC=icc CXX=icc
../configure --prefix=/home/stud2/bin --disable-mpi --enable-debug FC=ifort CC=icc CXX=icc
Re: debug issues [SOLVED]
Sorry I was not explicity enough.
First, don't modify the configure.ac file.
The *.ac file I was talking about is the one with the name of your compute in place of the *. This file is read by the buildsystem and avoid to avec a configure line too long when using a lot of configure options.
--enable-debug activates only the very basics of debug level so it might not be enough in your case, however you can use a debugger to find the line that causes this segfault.
You can pass the options I suggested on your command line
or maybe better
Jordan
First, don't modify the configure.ac file.
The *.ac file I was talking about is the one with the name of your compute in place of the *. This file is read by the buildsystem and avoid to avec a configure line too long when using a lot of configure options.
--enable-debug activates only the very basics of debug level so it might not be enough in your case, however you can use a debugger to find the line that causes this segfault.
You can pass the options I suggested on your command line
Code: Select all
../configure --prefix=/home/stud2/bin --disable-mpi --enable-debug FC=ifort CC=icc CXX=icc fcflags_opt_98_main="-g -O0 -check all -traceback"
or maybe better
Code: Select all
../configure --prefix=/home/stud2/bin --disable-mpi --enable-debug FC=ifort CC=icc CXX=icc FCFLAGS_EXTRA="-g -O0 -check all -traceback"
Jordan