Constructing a PETSc MatMPIAIJ matrix from partitioned arrays

Matthew Knepley knepley at gmail.com
Sun Sep 30 13:48:12 CDT 2007


On 9/30/07, Mads Hoel <mfhoel at ifi.uio.no> wrote:
> Hi all,
>
> I have a partitioned matrix on CRS format across several processors. I
> have 4 arrays describing the parallel matrix; the typical CRS arrays irow,
> jcol and values, and an array describing the mapping of local nodes/rows
> to global nodes/rows. jcol is in local indices.
>
> 1. Does Petsc support overlap?

I do not understand what you mean by "overlap".

> 2. What is the optimal way of creating a PETSc MatMPIAIJ from these
> arrays? I looked at MatInsertValues, but would not that create overhead in
> re-partitioning/distributing the arrays?

PETSc partitions rows across processors. You can specify the local sizes when
you create the matrix. You may have to renumber your representation in order
to get contiguous row blocks on each process. Then preallocate the matrix
since you know the row lengths. Then call MatSetValues() for each row. Note
that PETSc will want global row/col numbers.

  Thanks,

     Matt

> Thanks in advance.
>
> --
> Mads Hoel
>
>


-- 
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




More information about the petsc-users mailing list