<div class="gmail_quote">On Sat, Aug 27, 2011 at 13:31, Milan Mitrovic <span dir="ltr"><<a href="mailto:milan.v.mitrovic@gmail.com">milan.v.mitrovic@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 id=":ww">what do you mean by setting the matrix type before the preallocation?<br>
I did it like this:<br>
<br>
call MatCreateMPIAIJ(PETSC_COMM_WORLD, Np, Np, Ng, Ng, &<br>
nmax, PETSC_NULL, nmax, PETSC_NULL, Jac, info)<br>
call MatSetLocalToGlobalMapping(Jac, lgm, info)<br></div></blockquote><div><br></div><div>This is fine. If you call MatSetType() or MatSetFromOptions(), then MatXXXSetPreallocation() needs to be called after, otherwise it can get lost.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div id=":ww">
<br>
(i also had d_nnz and o_nnz there, but I deleted it when I switched to<br>
matrix shell)</div></blockquote></div><br><div>The preallocation was almost certainly incorrect. Otherwise there is no way it would take so long to insert the number of values you state. You can run with -info |grep -i malloc or set the option in my last message.</div>