[petsc-users] Problem with SNES

Jed Brown jedbrown at mcs.anl.gov
Sat Aug 27 13:35:34 CDT 2011


On Sat, Aug 27, 2011 at 13:31, Milan Mitrovic <milan.v.mitrovic at gmail.com>wrote:

> what do you mean by setting the matrix type before the preallocation?
> I did it like this:
>
>    call MatCreateMPIAIJ(PETSC_COMM_WORLD, Np, Np, Ng, Ng, &
>         nmax, PETSC_NULL, nmax, PETSC_NULL, Jac, info)
>    call MatSetLocalToGlobalMapping(Jac, lgm, info)
>

This is fine. If you call MatSetType() or MatSetFromOptions(), then
MatXXXSetPreallocation() needs to be called after, otherwise it can get
lost.


>
> (i also had d_nnz and o_nnz there, but I deleted it when I switched to
> matrix shell)
>

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110827/ae104555/attachment.htm>


More information about the petsc-users mailing list