[petsc-users] Can I assign different local number of row and column to the parallel matrix in different process?

Barry Smith bsmith at petsc.dev
Sun Apr 25 12:22:27 CDT 2021

  Yes; but note that for square matrices using n == m almost always makes sense, otherwise the input vector to the matrix-vector product will have a different layout than the output vector. Code code is difficult to manage. 

> On Apr 23, 2021, at 9:29 PM, 王 杰 <wangjieneu at hotmail.com> wrote:
> hello,
> I use petsc 3.14.5 with OpenMPI 3.1.6 in Ubuntu 18.04.5.
> I don't well understand the routine  MatCreateAIJ(MPI_Comm comm,PetscInt m, PetscInt n,PetscInt M,PetscInt N,PetscInt d_nz,PetscInt *d_nnz, PetscInt o_nz,PetscInt *o_nnz,Mat *A). 
> I have tow process. The total number of global index is 2188. The first one deal with the global index 0~1400 with ghost node 1401~1500 and 2001~2188. The second process deal with globla index 1400~2100 with ghost node 601~700 and 701~800. This is dynamiclly assigned by load balancer.
> I want to assign the first 1400 rows to the first process and the remained 788 rows in the second process. Can I give different values to m and n in the routine MatCreateAIJin different process?
> Thanks.
>        Wang Jie

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210425/a1b889da/attachment.html>

More information about the petsc-users mailing list