How to generate a parallel matrix with a sequential dense matrix?

Barry Smith bsmith at
Mon Sep 22 15:03:09 CDT 2008

    I would only expect good performance if you used MPI calls to send  
the blocks of rows of the matrix to the process
they belong to and use MatGetArray() to pass into the MPI_Recv to  
receive the data into.


On Sep 22, 2008, at 1:34 PM, Yujie wrote:

> Thank you for your reply, Matt. I have checked the tutorials. They  
> just use specified values and MatSetValues() to make a parallel  
> matrix. Now, the matrix I use is in a single node of the cluster. I  
> have 'M' nodes in this cluster. I need to copy the sequential matrix  
> to other 'M-1' nodes and then use MatSetValues() or I just use  
> MatSetvalues() in the node where the matrix is? The latter should  
> work, right? thanks.
> Yujie
> On Mon, Sep 22, 2008 at 11:09 AM, Matthew Knepley  
> <knepley at> wrote:
> The right way to do this is to input the matrix using MatSetValues()
> in a distribute fashion. You can consult any of the tutorials, for  
> instance
> KSP ex2 for an example of this.
>  Matt
> On Mon, Sep 22, 2008 at 12:57 PM, Yujie <recrusader at> wrote:
> > Hi, Petsc developer
> >
> > Now, I have a sequential dense matrix. How to get a parallel  
> matrix based on
> > it? thanks a lot.
> >
> > 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

More information about the petsc-users mailing list