Page 1 of 1

Indicate if debug mode is enabled

Posted: Wed Aug 18, 2010 12:24 pm
by Andrei Fokau
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.

Re: Indicate if debug mode is enabled

Posted: Wed Aug 18, 2010 2:22 pm
by Jaakko Leppänen
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.

Re: Indicate if debug mode is enabled

Posted: Wed Aug 18, 2010 2:46 pm
by Andrei Fokau
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.

Re: Indicate if debug mode is enabled

Posted: Wed Aug 18, 2010 3:17 pm
by Jaakko Leppänen
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?