[petsc-users] Use parallel PETSc linear solver in a sequential program

Jed Brown jedbrown at mcs.anl.gov
Thu Oct 31 15:49:55 CDT 2013


Qin Lu <lu_qin_2000 at yahoo.com> writes:

> Jed,   Thanks a lot for your nice suggestions. The CRS matrix has
> already been created by the program and I don't want to change that,
> do you mean I should read the arrays (i, j, a) and set coefficients
> row by row using MatSetValues? Will it be much slower than passing the
> arrays directly to MatCreateSeqAIJWithArrays or
> MatCreateMPIAIJWithArrays, especially when the matrix is big?

Are your *parallel* matrices already assembled in that form (which is
not suitable to compute with)?

In any case, MatCreateMPIAIJWithArrays is *implemented* by looping over
the rows calling MatSetValues.  The best is to generate the matrix by
row or element and insert at that time, but that is mostly for memory
reasons.  Copying the entries by row is not that expensive.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20131031/47937d3c/attachment.pgp>


More information about the petsc-users mailing list