[petsc-users] How to debug the petsc no-debug version codes
Jed Brown
jedbrown at mcs.anl.gov
Wed Oct 23 06:20:10 CDT 2013
Rongliang Chen <rongliang.chan at gmail.com> writes:
> My code woks well for the petsc-3.4.2 debug version, but get the
> following errors for the no-debug version. Do you have any suggestions
> for debugging the code?
Reducing the number of processes to reproduce the error always helps for
debugging.
One of the most common reasons is that a stack variable is initialized
to 0 at -O0, but contains garbage at higher optimization levels. To
debug, use a debugging PETSc, but compile with "-O1 -g" and make sure
all warnings are turned on (at least -Wall, preferably -Wextra).
Make sure the code is valgrind-clean in this mode.
Another possibility is that debug-mode memory allocation/macros are
causing the different behavior. First try turning off the tracing
malloc (run program with -malloc 0). Then try an optimized PETSc built
with debugging (--with-debugging=0 COPTFLAGS='-O0 -g', or
--with-debugging=0 COPTFLAGS='-O1 -g').
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131023/09272ae4/attachment.pgp>
More information about the petsc-users
mailing list