[petsc-users] SNES never called user FormJacobian in debugging mode
Barry Smith
bsmith at mcs.anl.gov
Thu May 19 07:42:17 CDT 2011
On May 19, 2011, at 1:43 AM, Tian(ICT) wrote:
> I encountered a strange problem.
> I am using VC2008. When I debuged the code line by line using the VC, the user FormJacobian was never called, instead, the SNES seems use matrix free Jacobian. But if I run the code in command line (no debugger attached), the log file showed that the user FormJacobian was called. What is the reason for this?
There is not logical explanation for this. Running in the debugger should not trigger a different code path then not in the debugger. Also SNES will never use matrix-free unless you specifically ask for it.
What can happen is that SNES may decide (for some reason) that the initial residual norm is small enough and hence never try a Newton step. If there are some uninitialized variables or other problems in the code the run in and out of the debugger could be different hence different "function values". Run with -snes_monitor -ksp_monitor_true_residual -snes_view -snes_converged_reason -ksp_converged_reason.
Ideally in this situation you would run with valgrind http://www.mcs.anl.gov/petsc/petsc-as/documentation/faq.html#valgrind or a similar tool to check that the code is memory corruption free.
Barry
>
> -Rong
More information about the petsc-users
mailing list