Introduction of debug levels

option, parallelism,...

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.
Locked
User avatar
pouillon
Posts: 651
Joined: Wed Aug 19, 2009 10:08 am
Location: Spain
Contact:

Introduction of debug levels

Post by pouillon » Thu Dec 03, 2009 6:19 pm

Dear Developers,

In order to facilitate the debugging of new developments, Matthieu and I are proposing to have different debug levels in the build system, controlled by --enable-debug:

  • no: debugging fully disabled;
  • yes: debug symbols are provided;
  • enhanced: more sensible warnings are enabled;
  • paranoid: array bound checks, et c.

Matthieu proposes that debug flags be incremental, i.e. a specific level receives all flags from the previous ones plus a few more.

Do not hesitate to provide comments and suggestions. If I receive no strong opposition in the coming weeks, I will consider this proposal as a specification and implement it.
Yann Pouillon
Simune Atomistics
Donostia-San Sebastián, Spain

User avatar
torrent
Posts: 127
Joined: Fri Aug 14, 2009 7:40 pm

Re: Introduction of debug levels

Post by torrent » Fri Dec 04, 2009 11:17 am

This idea sounds good (isn't it already partly implemented ?).

The question is now: which level choose as default ?
yes= is the current level;
it is useful to quickly find source of problems without recompiling, but the size of the excecutable increases;
and what about the performances (I have no idea) ?

Marc
Marc Torrent
CEA - Bruyères-le-Chatel
France

User avatar
gmatteo
Posts: 291
Joined: Sun Aug 16, 2009 5:40 pm

Re: Introduction of debug levels

Post by gmatteo » Fri Dec 04, 2009 9:47 pm

Fine with me.

I have no idea about the effect of -g on the performance.
I usually keep the -g option, but it's normal as I have to
fix the zillion of bugs I usually introduce in the code ;-)

On the other hand, it's worth considering the possibility of using "no" as default
if we find that removing -g leads to some speed-up either at the level of the compilation or at run-time,

A question maybe a bit off-topic. It is really useful
to use -g by default even at high level of optimization in which
the compiler is allowed to perform deep changes in the
structure of the loops?
I would never trust the output of a debugger when the executable has been generated with -O3!

User avatar
pouillon
Posts: 651
Joined: Wed Aug 19, 2009 10:08 am
Location: Spain
Contact:

Re: Introduction of debug levels

Post by pouillon » Wed Dec 09, 2009 10:47 pm

Debugging symbols do not affect the performance of the code, nor its memory footprint, as they are not loaded in normal runs. They only impact the size of the binary.

However, it is true that the more you optimize, the less using debugging symbols is relevant. In practice, it nevertheless provides interesting information in most cases. Quoting the GCC manual:
GCC allows you to use -g with -O. The shortcuts taken by optimized code may occasionally produce surprising results: some variables you declared may not exist at all; flow of control may briefly move where you did not expect it; some statements may not be executed because they compute constant results or their values were already at hand; some statements may execute in different places because they were moved out of loops. Nevertheless it proves possible to debug optimized output. This makes it reasonable to use the optimizer for programs that might have bugs.


Some people even think that it is stupid to strip executables. Personally I always use debugging symbols.
Yann Pouillon
Simune Atomistics
Donostia-San Sebastián, Spain

Locked