Hi Again<div><br></div><div>I also tried petsc-3.2 version and I still get the same backtrace.  </div><div><div><br></div><div>If its not possible to figure out where the communicator segfault is coming from its not a huge deal...I've just set the option using PetscOptionsSetValue() and then use PCSetFromOptions() to pull it back out.  That seems to work fine. </div>

<div><br></div><div>Even avoiding the above problem, with the PetscOptionsSetValue I'm still receiving an error code 73 when I run the multigrid solver.  I've included the backtrace output below but its not a lot of help since the code exited cleaning using my error checking procedure</div>

<div><br></div><div><div> =================================================================</div><div>PETSc or MPI Error. Error Code 73. Detected on Proc  0</div><div>Error at line:   122 in file: solveADjointTransposePETSc.F90</div>

<div> =================================================================</div><div><br></div><div>Program received signal SIGSEGV, Segmentation fault.</div><div>0xb68c98f0 in PMPI_Abort () from /usr/local/lib/libmpi.so.0</div>

<div>(gdb) bt</div><div>#0  0xb68c98f0 in PMPI_Abort () from /usr/local/lib/libmpi.so.0</div><div>#1  0xb519f190 in pmpi_abort__ () from /usr/local/lib/libmpi_f77.so.0</div><div>#2  0xb44c9e4c in echk (ierr=@0x49, file=..., line=@0x7a, .tmp.FILE.len_V$eb=30) at terminate.f90:154</div>

<div>#3  0xb44bd68f in solveadjointtransposepetsc () at solveADjointTransposePETSc.F90:122</div><div>#4  0xb44138a9 in f2py_rout_sumb_solveadjointtransposepetsc () from /tmp/tmpKYF_DT/sumb.so</div><div>#5  0xb440fd35 in fortran_call () from /tmp/tmpKYF_DT/sumb.so</div>

<div>#6  0x0805fd6a in PyObject_Call ()</div><div>#7  0x080dd5b0 in PyEval_EvalFrameEx ()</div><div>#8  0x080dfbb2 in PyEval_EvalCodeEx ()</div><div>#9  0x08168f1f in ?? ()</div><div>#10 0x0805fd6a in PyObject_Call ()</div>

<div>#11 0x080dcbeb in PyEval_EvalFrameEx ()</div><div>#12 0x080dfbb2 in PyEval_EvalCodeEx ()</div><div>#13 0x080de145 in PyEval_EvalFrameEx ()</div><div>#14 0x080dfbb2 in PyEval_EvalCodeEx ()</div><div>#15 0x080dfca7 in PyEval_EvalCode ()</div>

<div>#16 0x080fd956 in PyRun_FileExFlags ()</div><div>#17 0x080fdbb2 in PyRun_SimpleFileExFlags ()</div><div>#18 0x0805b6d3 in Py_Main ()</div><div>#19 0x0805a8ab in main ()</div></div><div><br></div><div>Valgrid was clean right up until the end where I get the normal error message:</div>
<div><br></div><div><div>[0]PETSC ERROR: ------------------------------------------------------------------------</div><div>[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range</div>
<div>[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger</div><div>[0]PETSC ERROR: or see <a href="http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind[0]PETSC">http://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind[0]PETSC</a> ERROR: or try <a href="http://valgrind.org">http://valgrind.org</a> on GNU/linux and Apple Mac OS X to find memory corruption errors</div>
<div>[0]PETSC ERROR: likely location of problem given in stack below</div><div>[0]PETSC ERROR: ---------------------  Stack Frames ------------------------------------</div><div>[0]PETSC ERROR: Note: The EXACT line numbers in the stack are not available,</div>
<div>[0]PETSC ERROR:       INSTEAD the line number of the start of the function</div><div>[0]PETSC ERROR:       is given.</div><div>[0]PETSC ERROR: [0] MatGetVecs line 8142 /nfs/mica/home/kenway/Downloads/petsc-3.3/src/mat/interface/matrix.c</div>
<div>[0]PETSC ERROR: [0] KSPGetVecs line 774 /nfs/mica/home/kenway/Downloads/petsc-3.3/src/ksp/ksp/interface/iterativ.c</div><div>[0]PETSC ERROR: [0] PCSetUp_MG line 508 /nfs/mica/home/kenway/Downloads/petsc-3.3/src/ksp/pc/impls/mg/mg.c</div>
<div>[0]PETSC ERROR: [0] PCSetUp line 810 /nfs/mica/home/kenway/Downloads/petsc-3.3/src/ksp/pc/interface/precon.c</div><div>[0]PETSC ERROR: [0] KSPSetUp line 182 /nfs/mica/home/kenway/Downloads/petsc-3.3/src/ksp/ksp/interface/itfunc.c</div>
<div>[0]PETSC ERROR: [0] KSPSolve line 351 /nfs/mica/home/kenway/Downloads/petsc-3.3/src/ksp/ksp/interface/itfunc.c</div></div><div><br></div><div>I will try it on a different system tomorrow to see if I have any more luck.</div>
<div><br></div><div>Thanks,</div><div><br></div><div>Gaetan</div>
<div><br></div><div><br></div><br><div class="gmail_quote">On Fri, Aug 31, 2012 at 11:08 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><div class="gmail_quote">On Fri, Aug 31, 2012 at 10:06 PM, Matthew Knepley <span dir="ltr"><<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>True, but the backtrace also shows that comm = 0x0 on the call to KSPCreate(), which<div>leads me to believe that your petsc4py has not initialized PETSc, and therefor not</div><div>initialized PETSC_COMM_WORLD.</div>


</div></blockquote></div><br></div><div>Could catch, maybe PetscFunctionBegin() should check that PETSc has been initialized.</div>
</blockquote></div><br></div>