Indicate if debug mode is enabled

Old bugs, solved problems and other topics that are no longer relevant are moved here
Post Reply
Andrei Fokau
Posts: 77
Joined: Thu Mar 25, 2010 12:25 am
Security question 2: 0
Location: KTH, Stockholm, Sweden
Contact:

Indicate if debug mode is enabled

Post by Andrei Fokau » Wed Aug 18, 2010 12:24 pm

Since, the debug mode can possibly be a reason for calculation crash, it may be useful to add the following lines to printtitle.c:

Code: Select all

#ifdef DEBUG

  printf(" - Debug mode is enabled\n\n");

#endif
Also, it may be useful to have an activating parameter for the debug mode:

Code: Select all

sss input -debug
or may be deactivating:

Code: Select all

sss input -nodebug
so that the DEBUG flag can be adjusted before calculation to avoid problems connected with the debug mode.
KTH Reactor Physics (Stockholm, Sweden) neutron.kth.se

User avatar
Jaakko Leppänen
Site Admin
Posts: 2054
Joined: Thu Mar 18, 2010 10:43 pm
Security question 2: 0
Location: Espoo, Finland
Contact:

Re: Indicate if debug mode is enabled

Post by Jaakko Leppänen » Wed Aug 18, 2010 2:22 pm

You probably missed it, but the code already prints that information. In the cycle-wise output, right after the version number:

Serpent 1.1.12 (dbg) -- Criticality source simulation

The "(dbg)" part is missing if the debugger mode is not in use. I did add some notifications in the next version that the debugger mode is swithced on. One at the end notes and one if the calculation terminates in a value check. I'll add one more in the title.
- Jaakko

Andrei Fokau
Posts: 77
Joined: Thu Mar 25, 2010 12:25 am
Security question 2: 0
Location: KTH, Stockholm, Sweden
Contact:

Re: Indicate if debug mode is enabled

Post by Andrei Fokau » Wed Aug 18, 2010 2:46 pm

Great! Thanks, Jaakko! When I check configuration of a Serpent executable, I normally use sss -version, so it will be very useful to have this information in the title as well. Also, the command line parameter would help to disable the debug routines for a specific run, which allows to have just one executable instead of two - w/ and w/o the debug mode enabled.
KTH Reactor Physics (Stockholm, Sweden) neutron.kth.se

User avatar
Jaakko Leppänen
Site Admin
Posts: 2054
Joined: Thu Mar 18, 2010 10:43 pm
Security question 2: 0
Location: Espoo, Finland
Contact:

Re: Indicate if debug mode is enabled

Post by Jaakko Leppänen » Wed Aug 18, 2010 3:17 pm

Andrei Fokau wrote:Great! Thanks, Jaakko! When I check configuration of a Serpent executable, I normally use sss -version, so it will be very useful to have this information in the title as well. Also, the command line parameter would help to disable the debug routines for a specific run, which allows to have just one executable instead of two - w/ and w/o the debug mode enabled.
The reason I chose to use "precompiled" instead of "run-time" checking routines is that I noticed that even a simple if-statement in some CPU-intensive loops may have a noticeable impact in the overall calculation time. It would be possible to use both, but it would make things more complicated.

I usually use the debugger mode only when doing code development. When I run the code for other purposes and end up with an error or unexpected results, I rerun the case in debug mode to see if something is caught by the checks. The easiest way to do this is to have two executables, "sss" and "sss_dbg". It takes a few extra minutes to compile the second executable but it's worth the effort.

I'm not an expert in using Makefiles, but I'm pretty sure it would be possible to have a separate command to compile the code and produce a separate executable for debug and mpi modes by simply typing "make debug" or "make mpi". Does anybody have an idea how this could be done?
- Jaakko

Post Reply