[petsc-users] MatMPIBAIJSetPreallocationCSR i and j indices

Matteo Parsani parsani.matteo at gmail.com
Mon Sep 30 11:38:53 CDT 2013


Thank you Barry and Jed for the explanation!



On Sun, Sep 29, 2013 at 7:46 PM, Jed Brown <jedbrown at mcs.anl.gov> wrote:

> Matteo Parsani <parsani.matteo at gmail.com> writes:
> > 2 - why those routines *should not be used* when writing a fresh code or
> a
> > large re-factoring?
>
> Barry wrote a great rationale, but consider an example: almost all
> third-party linear algebra libraries (and some special features in
> PETSc) require scalar (non-blocked) matrix formats, but PETSc has good
> implementations of other operations like matrix multiplication and
> incomplete factorization using BAIJ format.  Thus with some solution
> methods, you want a BAIJ matrix and with other methods, you need an AIJ
> matrix.  If you try to build the backend data format directly, you'll
> either need multiple versions to specifically support each format or
> there will need to be a copy, which doubles the peak memory usage
> required for the matrix.  If you just use MatXAIJSetPreallocation and
> MatSetValuesBlocked, then you can choose the matrix format at run-time,
> in which case all solvers become available without the extra memory
> usage.
>
> There are many more examples.  It is bad software design for a component
> to depend on more than it must.  Depend on generic interfaces instead of
> internal formats.  It will make your software more powerful and more
> maintainable.
>



-- 
Matteo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130930/6342ae10/attachment.html>


More information about the petsc-users mailing list