<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Jan 22, 2014 at 1:52 PM, Barry Smith <span dir="ltr"><<a href="mailto:bsmith@mcs.anl.gov" target="_blank">bsmith@mcs.anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
We need more information to track this down. Could you make a simple standalone code that reproduces the problem? Just creates a this, creates a SNES, sets the function, sets the test code and then crashes when runs.<br>
<br>
But since it is not crashing in the SNESConvergenceTest_snes routine I suspect it may be memory corruption. Have you run your code under valgrind? <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind" target="_blank">http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind</a></blockquote>
<div><br></div><div>I am putting his convergence test into ex5f right now. This can be valgrinded. I will send an update when it runs.</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Barry<br>
<div><div class="h5"><br>
On Jan 20, 2014, at 7:14 PM, Dharmendar Reddy <<a href="mailto:dharmareddy84@gmail.com">dharmareddy84@gmail.com</a>> wrote:<br>
<br>
> Hello,<br>
> I am getting a segmentation fault when i use<br>
> SNESSetConvergenceTest from Fortran.<br>
><br>
> I use the following:<br>
><br>
> call SNESSetConvergenceTest(this%snes, SNESConvergenceTest_snes,<br>
> this,PETSC_NULL_FUNCTION, ierr) (Line 1)<br>
><br>
> where the soubtoutine is<br>
><br>
> subroutine SNESConvergenceTest_snes(snes,it,xnorm,gnorm,fnorm,reason,this, ierr)<br>
> implicit none<br>
> #include "finclude/petsc.h"<br>
> ! IO Variables<br>
> SNES :: snes<br>
> integer :: it<br>
> PetscReal :: xnorm<br>
> PetscReal :: gnorm<br>
> PetscReal :: fnorm<br>
> SNESConvergedReason :: reason<br>
> type(Solver_t) :: this<br>
> PetscErrorCode :: ierr<br>
> ! Local Variables<br>
> Vec :: X, dX<br>
> Vec :: F, W, G<br>
> real(WP) :: lambda<br>
> print*, 'Calling custom test',it,xnorm,fnorm,gnorm<br>
> !call SNESLineSearchGetLambda(this%linesearch, lambda, ierr)<br>
> !call SNESLineSearchGetVecs(this%linesearch, X, F, dX, W, G, ierr)<br>
> !call this%SNESConvergenceTest(it, fnorm, lambda, X, dX, reason, ierr)<br>
> reason = SNES_DIVERGED_FUNCTION_COUNT<br>
> end subroutine SNESConvergenceTest_snes<br>
><br>
> Code works fine if the call at Line 1 is commented i.e, if i donot<br>
> set the convergencetest<br>
><br>
> I have attached the stack trace when the code fails (traceFail.log)<br>
> and stack trace of the code which runs well (tracePass.log).<br>
><br>
><br>
><br>
> Thanks<br>
> Reddy<br>
</div></div>> <traceFail.log><tracePass.log><br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener
</div></div>