I was able to reproduce the error using src/ksp/ksp/examples/tutorials/ex2.c using the patch attached.<br>Please see the error log obtained by executing with -n 10 -m 10 by command line.<br>If you uncomment MatGetOwnershipRange, the code will work fine<br>
<br><div class="gmail_quote">2012/1/28 Jed Brown <span dir="ltr"><<a href="mailto:jedbrown@mcs.anl.gov">jedbrown@mcs.anl.gov</a>></span><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 Sat, Jan 28, 2012 at 10:11, Stefano Zampini <span dir="ltr"><<a href="mailto:stefano.zampini@gmail.com" target="_blank">stefano.zampini@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>ierr = MatCreate(PETSC_COMM_SELF,&mat);CHKERRQ(ierr);<br>ierr = MatSetSize(mat,n,m,n,m);CHKERRQ(ierr);<br>ierr = MatSetType(mat,MATSEQDENSE);CHKERRQ(ierr);<br>
-> Then a loop to set values<br>ierr = MatAssemblyBegin(mat);CHKERRQ(ierr);<br>ierr = MatAssemblyEnd(mat);CHKERRQ(ierr);<br></div></blockquote><div><br></div></div><div>I couldn't reproduce this with a modified src/ksp/ksp/examples/tutorials/ex2.c</div>
<div><br></div><div>MatSetUpPreallocation() should be sufficient in other cases.</div></div>
</blockquote></div><br><br clear="all"><br>-- <br>Stefano<br>