MatGetLocalSize() and MatDenseGetLocalMatrix()

Barry Smith bsmith at mcs.anl.gov
Tue Jan 6 15:15:32 CST 2009


    The cmap (and even rmap) information is NOT always directly  
related to how/what matrix parts are stored where.
Given

      y = A x

the rmap information of A matches the map information of y, the cmap  
information matches the map information
of x. This is what the map information provides. It does not tell you  
the dimensions of the local part of A, sometimes
the local part of A is one matrix, sometimes it is 2 sometimes it does  
not exist. You are trying to add meaning to
stuff in PETSc that is sometimes true as if it were always true.

    Barry



On Jan 6, 2009, at 1:55 PM, Yujie wrote:

> I am sorry, Matthew. I can't understand what you said. You mean it  
> is not bug? However, practically, the dimension of local matrix in  
> proc1 is 56*108? if it is, how to obtain its accurate dimension?  
> thanks a lot.
>
> Regards,
>
> Yujie
>
>
> On Tue, Jan 6, 2009 at 11:45 AM, Matthew Knepley <knepley at gmail.com>  
> wrote:
> On Tue, Jan 6, 2009 at 1:43 PM, Yujie <recrusader at gmail.com> wrote:
> Dear Matthew:
>
> Two processors are used. The matrix dimension is 105*108;
>
> MatGetOwnershipRange()
>
> proc1: 0->56
>
> proc2: 56->105
>
> Mat->camp.rstart; Mat->cmap.rend
>
> proc1: 0->54
>
> proc2: 54->108
>
> MatGetLocalSize()
>
> proc1: row 56 col 54
>
> porc2: row 49 col 54
>
> MatDenseGetLocalMatrix()
>
> proc1: 56*108
>
> proc2: 49*108
>
>
> Since PETSc matrices are all stored row-wise, even if columns are  
> assigned to one process
> for the other, the storage is divided by row. This GetLocalMatrix()  
> returns all the rows
> associated with a given process.
>
>    Matt
>
> thanks.
>
> Yujie
>
>
> On Tue, Jan 6, 2009 at 11:33 AM, Matthew Knepley <knepley at gmail.com>  
> wrote:
> On Tue, Jan 6, 2009 at 11:52 AM, Yujie <recrusader at gmail.com> wrote:
> Dear PETSc developers:
>
> I am trying to use MatGetArray() and MatSetValues() to combine  
> several MPIDense matrices into one matrix. At the beginning, I use
>
> MatGetOwnershipRange() and Mat->camp.rstart; Mat->cmap.rend (2.3.3- 
> p8 version) to get the start, end row and column. I can calculate  
> the local rows and columns.
>
> I also use MatGetLocalSize() to confirm the accuracy. However, I  
> always find some data loses in the combined matrix.
>
> And then, I try to use MatDenseGetLocalMatrix() to get the lcoal  
> matrix and output it. I find column information by MatGetLocalSize()  
> is not consistent with by MatDenseGetLocalMatrix(), is it bug? could  
> you give me some advice? thanks a lot.
>
> What information?
>
>   Matt
>
> Regards,
>
> Yujie
>
> -- 
> 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
>
>
>
>
> -- 
> 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