[petsc-users] Change the matrix row order

Matthew Knepley knepley at gmail.com
Fri Apr 13 07:14:56 CDT 2018


On Fri, Apr 13, 2018 at 5:45 AM, 我 <dayedut123 at 163.com> wrote:

>
> Thanks for your reply! And sorry for my late answer. I want to parallel a
> particle-method code and solve Ax=b in each timestep.  In this code, each
> partition forms a CSR matrix and assembles the final coefficient matrix by
> MatCreateMPIAIJWithArrays. But, the domain decomposition makes that the
> particles' order doesn't follow the original order. In other words,
> Solution Vector x follows the original order but Vector b follows a new
> order due to domain decomposition. So I want to change the Vector b's order
> and Matrix A's row order to follow the origin order. I have been
> considering to change my parallel code in these days, but I didn't find a
> best way. I'm considering to multiply a renumbering identity matrix at both
> sides of the equation with function MatMatMult. Do you have any suggestions
> for this problem? If the function MatMatMult can influence the parallel
> efficiency obviously?
>

I would not do this. The amount of communication to assemble those things
would most likely swamp the speedup you gained.
If anything, reoder x. However, why would you need to be the original order
ever? Just use the order after partition. That is how
parallel codes work for the most part.

  Thanks,

     Matt


> Thanks again!
> Daye
>
>
>
>
> At 2018-04-10 22:07:04, "Smith, Barry F." <bsmith at mcs.anl.gov> wrote:
> >
> >   When and where do you want to change the row order?
> >
> >   For PETSc and external factorization based solvers this is handled automatically, no need to do anything.
> >
> >   The ordering of matrix rows corresponds to the ordering of the vectors; almost always one partitions and orders the vectors based on the mesh that underlies the problem and there is no reason to reorder once the layout is initially determined.
> >
> >   Barry
> >
> >
> >
> >> On Apr 10, 2018, at 8:42 AM, 我 <dayedut123 at 163.com> wrote:
> >>
> >> Hello,
> >> I want to change the row order of a sparse matrix. Are there any build-in functions and suggestions?
> >> Thank you very much!
> >> Daye
> >>
> >>
> >>
> >
>
>
>
>
>



-- 
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

https://www.cse.buffalo.edu/~knepley/ <http://www.caam.rice.edu/~mk51/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180413/731a9187/attachment.html>


More information about the petsc-users mailing list