[petsc-users] MatSetSizes for MATMPIBAIJ

NovA av.nova at gmail.com
Fri Feb 5 17:03:02 CST 2010

Hi everybody!

I'm looking for the best way to distribute MPIBAIJ matrix among
several processors.

For example, I have square matrix 3x3 of blocks 4x4 each (i.e. 12x12
values) and need to distribute it among 2 processors. The generic way
of creating such a matrix would be:
  Mat A;
  MatCreate(comm, &A);
  MatSetSizes(A, loc_rows,12, 12,12);
  MatSetType(A, MATMPIBAIJ);

What is the optimal value for loc_rows here?

Can I use PETSC_DECIDE for it? I suppose this will lead to division by
6 rows per processor, which is not consistent with block size. How
MatMPIBAIJSetPreallocation(A,4,...) will deal with it?

Most likely, I have to manually set loc_rows to 8 and 4 according to
the processor rank. But probably I miss some more clean way, when
PETSc really decides. :)

Thanks in advance for any comments.


More information about the petsc-users mailing list