I ran it though the debugger and came up with the following output:<div><div>(gdb) backtrace</div><div>#0 0x00000000 in ?? ()</div><div>#1 0xb5fd2832 in oursnesshellsolve (snes=0xbb03d30, x=0xbb2a4f0) at /nfs/mica/home/kenway/Downloads/petsc-3.3/src/snes/impls/shell/ftn-custom/zsnesshellf.c:13</div>
<div>#2 0xb6017009 in SNESSolve_Shell (snes=0xbb03d30) at /nfs/mica/home/kenway/Downloads/petsc-3.3/src/snes/impls/shell/snesshell.c:169</div><div>#3 0xb60032e8 in SNESSolve (snes=0xbb03d30, b=0xb8c0610, x=0xbb2a4f0) at /nfs/mica/home/kenway/Downloads/petsc-3.3/src/snes/interface/snes.c:3536</div>
<div>#4 0xb6041547 in SNESSolve_NGMRES (snes=0xb8c1f70) at /nfs/mica/home/kenway/Downloads/petsc-3.3/src/snes/impls/ngmres/snesngmres.c:259</div><div>#5 0xb60032e8 in SNESSolve (snes=0xb8c1f70, b=0xb8c0610, x=0xb8ba6f0) at /nfs/mica/home/kenway/Downloads/petsc-3.3/src/snes/interface/snes.c:3536</div>
<div>#6 0xb5fd0e73 in snessolve_ (snes=0xb4d75a2c, b=0xb4d75c6c, x=0xb4d75c68, __ierr=0xbfffe338)</div><div> at /nfs/mica/home/kenway/Downloads/petsc-3.3/src/snes/interface/ftn-custom/zsnesf.c:181</div><div>#7 0xb47791f3 in nksolver2 () at NKSolver2.F90:20</div>
<div>#8 0xb46f8f68 in solvestate () at solveState.F90:485</div><div>#9 0xb46f95c2 in solversteady () at solverSteady.f90:27</div><div>#10 0xb46f9257 in solver () at solver.F90:102</div><div>#11 0x0b8ba2c0 in ?? ()</div>
<div>#12 0xb464a222 in f2py_rout_sumb_solver () from /tmp/tmpTaGWsk/sumb.so</div><div>#13 0xb46454e5 in fortran_call () from /tmp/tmpTaGWsk/sumb.so</div><div>#14 0x0805fd6a in PyObject_Call ()</div><div>#15 0x080dd5b0 in PyEval_EvalFrameEx ()</div>
<div>#16 0x080dfbb2 in PyEval_EvalCodeEx ()</div><div>#17 0x08168f1f in ?? ()</div><div>#18 0x0805fd6a in PyObject_Call ()</div><div>#19 0x080dcbeb in PyEval_EvalFrameEx ()</div><div>#20 0x080dfbb2 in PyEval_EvalCodeEx ()</div>
<div>#21 0x08168e3c in ?? ()</div><div>#22 0x0805fd6a in PyObject_Call ()</div><div>#23 0x08067d5c in ?? ()</div><div>#24 0x0805fd6a in PyObject_Call ()</div><div>#25 0x080b3554 in ?? ()</div><div>#26 0x0805fd6a in PyObject_Call ()</div>
<div>#27 0x080dd5b0 in PyEval_EvalFrameEx ()</div><div>#28 0x080dfbb2 in PyEval_EvalCodeEx ()</div><div>#29 0x080dfca7 in PyEval_EvalCode ()</div><div>#30 0x080fd956 in PyRun_FileExFlags ()</div><div>#31 0x080fdbb2 in PyRun_SimpleFileExFlags ()</div>
<div>#32 0x0805b6d3 in Py_Main ()</div><div>#33 0x0805a8ab in main ()</div><div><br></div><div>I'm also 99% certain that the function in set correctly since the shell snes works just fine when it is called directly. (see some of the earlier code snippits). Its only when I'm trying to use it as the preconditioner for the another snes object (ngmres) I have issues. </div>
<div><br></div><div>Gaetan</div><br><div class="gmail_quote">On Mon, Aug 27, 2012 at 10:34 PM, Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov" target="_blank">jedbrown@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"><div class="gmail_quote"><div class="im">On Mon, Aug 27, 2012 at 7:31 PM, Gaetan Kenway <span dir="ltr"><<a href="mailto:kenway@utias.utoronto.ca" target="_blank">kenway@utias.utoronto.ca</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>Unfortunately I can run backtraces since the code is running from python and the -on_error_attach_debugger option has no effect when you're running from python. </div></blockquote><div><br></div></div><div>You can use -start_in_debugger, then type "c" (for "continue") at the gdb prompt.</div>
<div class="im">
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><br></div><div>The petsc4py is initialized with:</div><div><div>import petsc4py</div><div>petsc4py.init(args=sys.argv)</div><div><br></div></div><div>so other options are passed in just fine. </div><div><br></div><div>
I ran it with valgrind and got the following:</div><div><div><br></div><div>==15046== Jump to the invalid address stated on the next line</div><div>==15046== at 0x0: ???</div><div>==15046== by 0x95EF008: SNESSolve_Shell (snesshell.c:169)</div>
<div>==15046== by 0x95DB2E7: SNESSolve (snes.c:3536)</div><div>==15046== by 0x9619546: SNESSolve_NGMRES (snesngmres.c:259)</div><div>==15046== by 0x95DB2E7: SNESSolve (snes.c:3536)</div><div>==15046== by 0x95A8E72: snessolve_ (zsnesf.c:181)</div>
<div>==15046== by 0x9AEA302: nksolver2_ (NKSolver2.F90:20)</div><div>==15046== by 0x9A6A077: solvestate_ (solveState.F90:485)</div><div>==15046== by 0x9A6A6D1: solversteady_ (solverSteady.f90:27)</div><div>==15046== by 0x99BB1C1: f2py_rout_sumb_solver (in /tmp/tmpGQGZda/sumb.so)</div>
<div>==15046== by 0x99B6484: fortran_call (in /tmp/tmpGQGZda/sumb.so)</div><div>==15046== by 0x805FD69: PyObject_Call (in /usr/bin/python2.6)</div><div>==15046== Address 0x0 is not stack'd, malloc'd or (recently) free'd</div>
</div></blockquote></div></div><br><div>This looks like SNESShellSetSolve() did not work. Are you sure that the type was set (e.g. SNESSetType() or SNESSetFromOptions()) before you called SNESShellSetSolve()?</div>
</blockquote></div><br></div>