[petsc-users] Initializing a large sparse matrix

fujisan fujisan43 at gmail.com
Mon Oct 17 03:12:55 CDT 2022


Can I preallocate space for a rectangular matrix using MatCreateAIJ() in
parallel?
It is not clear to me how I have to define d_nnz when the matrix is
rectangular?

X * * * *
* X * * *
* * X * *
* * * X *
* * * * X
* * * * *
* * * * *

The example shown is for an 8x8 matrix on 3 cpu
X * *
* X *
* * X

On Mon, Oct 17, 2022 at 9:02 AM Jose E. Roman <jroman at dsic.upv.es> wrote:

> You have to preallocate, see
> https://petsc.org/release/docs/manual/mat/#sec-matsparse
>
> > El 17 oct 2022, a las 8:37, fujisan <fujisan43 at gmail.com> escribió:
> >
> > Hi everyone,
> >
> > I initialize a large sparse matrix (50000x20000) using MatCreate() and
> then filling it with MatSetValues() line by line
> > but it takes a bit more than an hour on 80 cores to fill in the matrix.
> >
> > Is there a way to optimize this initialization?
> >
> > Fuji
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20221017/9904baf5/attachment.html>


More information about the petsc-users mailing list