[petsc-users] Determining the correct Preallocation
Matthew Knepley
knepley at gmail.com
Mon Oct 22 17:20:55 CDT 2012
On Mon, Oct 22, 2012 at 6:18 PM, Andrew Spott <andrew.spott at gmail.com>wrote:
> I want to preallocate a MPIAIJ matrix correctly, using
>
> MatMPIAIJSetPreallocation(A, PETSC_NULL, dnnz, PETSC_NULL, onnz);
>
> The problem is that I don't know how many local rows, or where the local
> columns are until I run said function, but I need to know the number of
> local rows and local columns so I can determine the correct preallocation.
>
> So how am I supposed to do a proper preallocation? Is there something I'm
> missing, or do I just guess and correct? If I know that my matrix is
> evenly sparse, should I just assume that it is evenly split up among
> processors, and go from there? Or should I "MatSetUp", determine the
> correct preallocation and then do a MatMPIAIJSetPreallocation?
I think you are looking for
http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/PetscSplitOwnership.html
If you do not specify the layout, this function is called to partition your
matrix.
Thanks,
Matt
> -Andrew
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20121022/bb78cc77/attachment.html>
More information about the petsc-users
mailing list