[petsc-users] parallel Mat Mult a serial Vec or a serial Mat

Jed Brown jedbrown at mcs.anl.gov
Sun Jan 20 10:28:57 CST 2013


On Sun, Jan 20, 2013 at 10:22 AM, Hui Zhang <mike.hui.zhang at hotmail.com>wrote:

>
> On Jan 20, 2013, at 5:13 PM, Jed Brown wrote:
>
> > No, MatMult and MatMatMult require all objects to be on the same
> communicator.
>
> Thanks for the quick answer!  It seems a general rule that all operands
> and results must be
> on the same communicator.  Can I lift an object from a sub-communicator to
> the sup-communicator
> without changing the parallel layout of the object?
>

You can with a Vec (e.g., using VecPlaceArray), but you're responsible for
the sharing so it's fragile.

In general, I recommend creating the object on the largest communicator
involved and then getting access more locally. In the first pass, just make
a copy to a local subcomm unless a routine exists to do it automatically.
If you profile and see that the copy is significant (remarkably rare in
practice) you can sometimes optimize what is copied versus shared, or
change the parent parallel data structure to make the local access faster.


>
> >
> >
> > On Sun, Jan 20, 2013 at 10:12 AM, Hui Zhang <mike.hui.zhang at hotmail.com>
> wrote:
> > parallel Mat, multiplies a serial Vec or a serial Mat
> >
> > Is it supported directly? If yes, can the resulting Vec/Mat be serial or
> parallel?
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20130120/f23f4fe1/attachment.html>


More information about the petsc-users mailing list