<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 17, 2020 at 2:25 PM Matthew Knepley <<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">On Tue, Mar 17, 2020 at 2:16 PM Mark Adams <<a href="mailto:mfadams@lbl.gov" target="_blank">mfadams@lbl.gov</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div><br></div><div>Passing NULL to MatCreateVecs() means that you do not want a vector out:</div><div><br></div></div></div></blockquote><div><br></div><div>Yes, I want both vectors out and we pass it Vec that have been initialized with PETSC_NULL_VEC</div></div></div></blockquote><div><br></div><div>That is wrong.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div></div><div>  <a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateVecs.html" target="_blank">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateVecs.html</a></div><div><br></div><div>I am guessing that this was broken in 3.7 so that it ignored NULL input, but we fixed that.</div><div><br></div></div></div></blockquote><div><br></div><div>v3.7 has these CHKFORTRANNULLOBJECT. Well the "fix" broke working code</div></div></div></blockquote><div><br></div><div>How could v3.7 have the check? If so, you code would be broken.</div></div></div></blockquote><div><br></div><div>Barry did it 12 years ago:</div><div><br></div><div><a href="https://gitlab.com/petsc/petsc/-/commit/7c54600c425fb8d0ad4ad4bb40f7fac17c980c51">https://gitlab.com/petsc/petsc/-/commit/7c54600c425fb8d0ad4ad4bb40f7fac17c980c51</a><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>ex73f90t does not initialize the "x" vector that it gives to matcreatevecs_. Should we just remove initialization of our vectors to PETSC_NUILL_VEC? </div></div></div></blockquote><div><br></div><div>Yes.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>Is the PETSc model that you don't inialized PETSc object to NULL because you check that pointers are valid PETSc pointers instead of testing on NULL? So maybe we should remove all these initializations.</div></div></div></blockquote><div><br></div><div>I am not sure what you are asking here.</div></div></div></blockquote><div><br></div><div>That we should not initialize our PETSc Vec,Mat,etc. with some sort of NULL.  I am sure this is the case.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div><br></div><div>  Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div>Thanks,</div><div>Mark</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div></div><div>  Thanks,</div><div><br></div><div>    Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>call MatCreateVecs(solver%KKTmat,solver%xVec2,solver%bVec2,ierr)<br></div><div><br></div><div>Petsc code:</div><div>PETSC_EXTERN void PETSC_STDCALL matcreatevecs_(Mat *mat,Vec *right,Vec *left, int *ierr)<br>{<br>PetscPrintf(PETSC_COMM_SELF,"ZZZ 1) matcreatevecs_ start right=%p left=%p\n",right,left);<br>  CHKFORTRANNULLOBJECT(right);<br>  CHKFORTRANNULLOBJECT(left);<br>PetscPrintf(PETSC_COMM_SELF,"ZZZ 2) matcreatevecs_ start right=%p left=%p\n",right,left);<br>  *ierr = MatCreateVecs(*mat,right,left);<br>}<br></div><div><br></div><div>produces this:<br></div><div><br></div><div>ZZZ 1) matcreatevecs_ start right=0x7fffffff3758 left=0x7fffffff3760<br>ZZZ 2) matcreatevecs_ start right=(nil) left=(nil)<br></div><div><br></div><div>Shouldn't  this be?</div><div><br></div><div>PETSC_EXTERN void PETSC_STDCALL matcreatevecs_(Mat *mat,Vec *right,Vec *left, int *ierr)<br>{<br>  *ierr = MatCreateVecs(*mat,right,left);<br>}<br></div><div><br></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>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><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>
</blockquote></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>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><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>
</blockquote></div></div>