MatCreateMPIAIJ Pre-allocation Query
Barry Smith
bsmith at mcs.anl.gov
Sun Jun 17 11:21:21 CDT 2007
Tim,
It is possible the macros MatPreallocateInitialize(), ... in petscmat.h
are exactly what you need.
Barry
Take a look at DAGetMatrix2d_MPIAIJ() in src/dm/da/utils/fdda.c for
an example of how they can be used.
On Sun, 17 Jun 2007, Tim Stitt wrote:
> Hi All,
>
> Currently I am using MatCreateMPIAIJ to create a distributed sparse matrix for
> use in my parallel sparse eigensolver. If I understand things correctly, it
> is important to specify the correct pre-allocation values for (o_nz,d_nz) or
> (o_nnz, d_nnz) respectively to obtain optimum memory usage per node.
>
> For information my matrix redistribution routine generates each row in the
> sparse matrix (associated with a given node) "on-the-fly" and then uses
> MatSetValues to apply the elements.
>
> My question is: does anyone have a standard code template for the calculating
> the d_nz or d_nnz values (along with o_nz or o_nnz respectively) so that
> optimum pre-allocation is obtained? Is there a simple way of determining if a
> given non-zero value in a row is part of the diagonal or off-diagonal regions
> for a given distributed topology?
>
> Any assistance gratefully received.
>
> Thanks in advance,
>
> Tim.
>
>
More information about the petsc-users
mailing list