<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Oh my, this example also segfaults (at least on my Mac) when running:<div class="">mpirun -np 1 ./ex1 -pc_type gamg -mat_view</div><div class=""><br class=""></div><div class=""><div class="">[0]PETSC ERROR: [0] MatView_SeqAIJ_ASCII line 560 /Volumes/Data/Repositories/petsc/src/mat/impls/aij/seq/aij.c</div><div class="">[0]PETSC ERROR: [0] MatView_SeqAIJ line 915 /Volumes/Data/Repositories/petsc/src/mat/impls/aij/seq/aij.c</div><div class="">[0]PETSC ERROR: [0] MatView line 920 /Volumes/Data/Repositories/petsc/src/mat/interface/matrix.c</div><div class="">[0]PETSC ERROR: [0] PetscObjectView line 92 /Volumes/Data/Repositories/petsc/src/sys/objects/destroy.c</div><div class="">[0]PETSC ERROR: [0] PetscObjectViewFromOptions line 2702 /Volumes/Data/Repositories/petsc/src/sys/objects/options.c</div><div class="">[0]PETSC ERROR: [0] MatAssemblyEnd line 5151 /Volumes/Data/Repositories/petsc/src/mat/interface/matrix.c</div><div class="">[0]PETSC ERROR: [0] MatCreateSeqAIJWithArrays line 4137 /Volumes/Data/Repositories/petsc/src/mat/impls/aij/seq/aij.c</div><div class="">[0]PETSC ERROR: [0] MatTransposeMatMultSymbolic_SeqAIJ_SeqAIJ line 1012 /Volumes/Data/Repositories/petsc/src/mat/impls/aij/seq/matmatmult.c</div><div class="">[0]PETSC ERROR: [0] MatTransposeMatMult_SeqAIJ_SeqAIJ line 994 /Volumes/Data/Repositories/petsc/src/mat/impls/aij/seq/matmatmult.c</div><div class="">[0]PETSC ERROR: [0] MatTransposeMatMult line 9607 /Volumes/Data/Repositories/petsc/src/mat/interface/matrix.c</div><div class="">[0]PETSC ERROR: [0] PCGAMGCoarsen_AGG line 914 /Volumes/Data/Repositories/petsc/src/ksp/pc/impls/gamg/agg.c</div><div class="">[0]PETSC ERROR: [0] PCSetUp_GAMG line 425 /Volumes/Data/Repositories/petsc/src/ksp/pc/impls/gamg/gamg.c</div><div class="">[0]PETSC ERROR: [0] PCSetUp line 886 /Volumes/Data/Repositories/petsc/src/ksp/pc/interface/precon.c</div><div class="">[0]PETSC ERROR: [0] KSPSetUp line 291 /Volumes/Data/Repositories/petsc/src/ksp/ksp/interface/itfunc.c</div></div><div class=""><br class=""></div><div class="">[0]PETSC ERROR: Petsc Development GIT revision: v3.7.5-3046-gde967d2  GIT Date: 2017-02-09 18:59:37 +0000</div><div class="">[0]PETSC ERROR: Configure options --LDFLAGS=-L/opt/intel/lib --download-hypre --download-metis --download-mumps --download-parmetis --download-pastix --download-ptscotch --with-blacs-include=/opt/intel/mkl/include --with-blacs-lib=/opt/intel/mkl/lib/libmkl_blacs_mpich_lp64.so --with-blaslapack-dir=/opt/intel/mkl --with-chtml=0 --with-mkl_pardiso-include=/opt/intel/mkl/include --with-mkl_pardiso=1 --with-scalapack-include=/opt/intel/mkl/include --with-scalapack-lib="[/opt/intel/mkl/lib/libmkl_scalapack_lp64.so,/opt/intel/mkl/lib/libmkl_blacs_mpich_lp64.so]" --with-shared-libraries=1 --with-x=1 PETSC_ARCH=arch-darwin-c-debug</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 9, 2017, at 10:52 PM, Pierre Jolivet <<a href="mailto:pierre.jolivet@enseeiht.fr" class="">pierre.jolivet@enseeiht.fr</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">There, attached.<div class=""><br class=""></div><div class="">Thanks.</div><div class=""><br class=""></div><div class="">PS: here is the patch also, just in case</div><div class=""><div class="">diff --git a/src/ksp/ksp/examples/tutorials/ex1.c b/src/ksp/ksp/examples/tutorials/ex1.c</div><div class="">index 6382c09..d9dc69a 100644</div><div class="">--- a/src/ksp/ksp/examples/tutorials/ex1.c</div><div class="">+++ b/src/ksp/ksp/examples/tutorials/ex1.c</div><div class="">@@ -123,6 +123,11 @@ int main(int argc,char **args)</div><div class="">     routines.</div><div class="">   */</div><div class="">   ierr = KSPSetFromOptions(ksp);CHKERRQ(ierr);</div><div class="">+  ierr = KSPSetUp(ksp);CHKERRQ(ierr);</div><div class="">+  char right_options[] = "-ksp_norm_type unpreconditioned -ksp_pc_side right";</div><div class="">+  PetscOptionsInsertString(NULL,right_options);</div><div class="">+  ierr = KSPSetFromOptions(ksp);CHKERRQ(ierr);</div><div class="">+  ierr = KSPSetUp(ksp);CHKERRQ(ierr);</div><div class=""><br class=""></div><div class="">   if (nonzeroguess) {</div><div class="">     PetscScalar p = .5;</div></div><div class=""><br class=""></div><div class=""></div></div><span id="cid:C3D49941-6879-4321-B8C0-035CC9BEE2E5"><ex1.c></span><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Feb 9, 2017, at 2:56 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" class="">knepley@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote">On Thu, Feb 9, 2017 at 7:48 AM, Pierre Jolivet<span class="Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:pierre.jolivet@enseeiht.fr" target="_blank" class="">pierre.jolivet@enseeiht.fr</a>></span><span class="Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><div class=""><blockquote type="cite" class=""><div class="">On Feb 9, 2017, at 2:31 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank" class="">knepley@gmail.com</a>> wrote:</div><br class="m_9118270146108803878Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote">On Thu, Feb 9, 2017 at 7:29 AM, Pierre Jolivet<span class="m_9118270146108803878Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:pierre.jolivet@enseeiht.fr" target="_blank" class="">pierre.jolivet@<wbr class="">enseeiht.fr</a>></span><span class="m_9118270146108803878Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Feb 9, 2017, at 2:17 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank" class="">knepley@gmail.com</a>> wrote:</div><br class="m_9118270146108803878m_8641040722046524261Apple-interchange-newline"><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote">On Thu, Feb 9, 2017 at 7:06 AM, Pierre Jolivet<span class="m_9118270146108803878m_8641040722046524261Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:pierre.jolivet@enseeiht.fr" target="_blank" class="">pierre.jolivet@enseei<wbr class="">ht.fr</a>></span><span class="m_9118270146108803878m_8641040722046524261Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Feb 9, 2017, at 1:37 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank" class="">knepley@gmail.com</a>> wrote:</div><br class="m_9118270146108803878m_8641040722046524261gmail-m_-7129509824056556353Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote">On Thu, Feb 9, 2017 at 4:56 AM, Pierre Jolivet<span class="m_9118270146108803878m_8641040722046524261Apple-converted-space"> </span><span dir="ltr" class=""><<a href="mailto:pierre.jolivet@enseeiht.fr" target="_blank" class="">pierre.jolivet@enseei<wbr class="">ht.fr</a>></span><span class="m_9118270146108803878m_8641040722046524261Apple-converted-space"> </span>wrote:<br class=""><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">Hello,<br class="">I _might_ be doing something wrong when calling KSPSetFromOptions/KSPSetUp, but still, am I supposed to get this kind of error?<br class="">[0]PETSC ERROR: No support for this operation for this object type<br class="">[0]PETSC ERROR: KSP gmres does not support PRECONDITIONED with RIGHT<br class=""><br class="">If not, I’ll try to send a MWE (it basically depends on where I set the option -ksp_pc_side right).<br class=""></blockquote><div class=""><br class=""></div><div class="">I believe its telling you that it cannot display the preconditioned residual with right preconditioning, which is true.</div><div class="">Are you requesting both?</div></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">No, I’m just using -ksp_view and -ksp_pc_side right. In the “standard” case, it obviously work.</div><div class="">However, the error is triggered if I set -ksp_pc_side right after a first call to KSPSetOperators()/KSPSetUp() without destroying the KSP.</div><div class="">Should I destroy my KSP before changing from left- (default) to right-preconditioning if KSPSetOperators()/KSPSetUp has already been called?</div></div></div></blockquote><div class=""><br class=""></div><div class="">Its likely you have to use</div><div class=""><br class=""></div><div class="">  <a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/KSP/KSPSetNormType.html" target="_blank" class="">http://www.mcs.anl.gov/petsc<wbr class="">/petsc-current/docs/manualpage<wbr class="">s/KSP/KSPSetNormType.html</a></div><div class=""><br class=""></div><div class="">or</div><div class=""><br class=""></div><div class="">  <b style="font-family: times; font-size: inherit;" class="">-ksp_norm_type unpreconditioned</b></div></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">If I use this after my first call to KSPSetUp, I now end up with:</div><div class="">[0]PETSC ERROR: KSP gmres does not support UNPRECONDITIONED with LEFT</div></div></div></blockquote><div class=""><br class=""></div><div class="">Yes, you would need to use it at the same time that you change the preconditioning side.</div></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">Yes, I’m using PetscOptionsInsert, and whether I let PETSc parse "-ksp_pc_side right -ksp_norm_type unpreconditioned” or "-ksp_norm_type unpreconditioned -ksp_pc_side right” I end up with the same error afterwards.</div></div></div></blockquote><div class=""><br class=""></div><div class="">Can you make an example do it (SNES ex5)? Or can you send a small example that does it?</div><div class=""><br class=""></div><div class=""> <span class="Apple-converted-space"> </span>Thanks,</div><div class=""><br class=""></div><div class="">    Matt</div><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><div class=""><div class="">Thanks.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">  Thanks,</div><div class=""><br class=""></div><div class="">     Matt </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><div class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><div class="gmail_extra"><div class="gmail_quote"><div class="">since we would not have a chance to change it since its been set already.</div><div class=""><br class=""></div><div class=""> <span class="m_9118270146108803878m_8641040722046524261Apple-converted-space"> </span>Thanks,</div><div class=""><br class=""></div><div class="">     Matt</div><div class=""><br class=""></div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><div style="word-wrap: break-word;" class=""><div class=""><div class="">Thanks.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""> <span class="m_9118270146108803878Apple-converted-space"> </span>Thanks,</div><div class=""><br class=""></div><div class="">     Matt</div><div class=""> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">Thanks,<br class="">Pierre</blockquote></div><br class=""><br clear="all" class=""><span class="m_9118270146108803878HOEnZb"><font color="#888888" class=""><span class="m_9118270146108803878m_8641040722046524261gmail-HOEnZb"><font color="#888888" class=""><div class=""><br class=""></div>--<span class="m_9118270146108803878m_8641040722046524261Apple-converted-space"> </span><br class=""><div class="m_9118270146108803878m_8641040722046524261gmail-m_-7129509824056556353gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener</div></font></span></font></span></div></div></div></blockquote></div><span class="m_9118270146108803878HOEnZb"><font color="#888888" class=""><br class=""></font></span></div></blockquote></div><span class="m_9118270146108803878HOEnZb"><font color="#888888" class=""><br class=""><br clear="all" class=""><span class="HOEnZb"><font color="#888888" class=""><div class=""><br class=""></div>--<span class="m_9118270146108803878m_8641040722046524261Apple-converted-space"> </span><br class=""><div class="m_9118270146108803878m_8641040722046524261gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener</div></font></span></font></span></div></div></div></blockquote></div><span class="HOEnZb"><font color="#888888" class=""><br class=""></font></span></div></blockquote></div><span class="HOEnZb"><font color="#888888" class=""><br class=""><br clear="all" class=""><div class=""><br class=""></div>--<span class="m_9118270146108803878Apple-converted-space"> </span><br class=""><div class="m_9118270146108803878gmail_signature" data-smartmail="gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener</div></font></span></div></div></div></blockquote></div><br class=""></div></blockquote></div><br class=""><br clear="all" class=""><div class=""><br class=""></div>--<span class="Apple-converted-space"> </span><br class=""><div class="gmail_signature" data-smartmail="gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br class="">-- Norbert Wiener</div></div></div></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></body></html>