Problem creating a non-square MPIAIJ Matrix

Satish Balay balay at mcs.anl.gov
Fri Feb 16 15:03:56 CST 2007


On Fri, 16 Feb 2007, Shi Jin wrote:

> I actually used MatGetLocalSize(A,&m,&n) in the code.  They give me
> m=4,n=3, as expected.  I can also specify m=4,n=3 in
> MatCreateMPIAIJ() which is exactly identical to the previous code.

> If I specify anything else, I get error saying that they don't agree
> with the global sizes.

What did you specify? Notice that in your partition scheme (m,n) have
different values on each proc)

(M,N = 8,6) (m0,n0 = 4,4)  (m1,n1 = 4,2)


     4      2

  1 2 3 4 | 0 0
  0 0 0 0 | 0 0
4 0 0 0 0 | 0 0
  0 0 0 0 | 0 0
  -------------
  0 0 0 0 | 0 0
4 0 0 0 0 | 0 0
  0 0 0 0 | 0 0
  0 0 0 0 | 0 0

Howeve note that you get a square diagonal block on proc-0 [4x4] but
not on proc-1 [4x2] . Its probably best to use the default PETSc
partitioning scheme then this alternative one.

> But I don't understand why we need to make n=N/2?

This is the default partitioning scheme - when you specify
PETSC_DECIDE for m,n. Here we choose to divide things as evenly as
possible.

> Are we storing the whole rows of the matrix? Just like
> the mannual says, the local submatrix is of size m*N.

We are stoing the diagonal block and offdiagonal block
separately. However both blocks are on the same processor. i.e each
processor stores m*N values - in 2 submatrices m*n, m*(N-n). To
understand this better - check manpage for MatCreateMPIAIJ().

Satish




More information about the petsc-users mailing list