[petsc-users] Does MatCopy require Mats to have the same communicator?

David Knezevic david.knezevic at akselos.com
Mon Jan 27 12:03:03 CST 2020


>
> Maybe I'm not understanding you -- matCopy does not have your
> sub-communicator so how would it create a Mat with it ...
>

MatCopy has the two Mats, so I thought I could set up the copy to be based
on the sub-communicator and MatCopy might have been set up to get the
necessary communicator from the copy Mat... that was just a guess on my
part and presumably not how it actually works...



> You probably want to use MatGetSubmatrix. This is general, but
> the output will have the same communicator, but the idle processors will be
> empty, if that is what you specify.
> Now you just need to replace the communicator with your sub communicator.
> Not sure how to do this but now you have your data in the right place at
> least.
>
> Oh, there is a method to create a Mat with a sub communicator with
> non-empty rows. Now you use this and use the communicator in the new matrix
> as your sub-communicator.
>
>
> https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatMPIAdjCreateNonemptySubcommMat.html
>

OK, thanks, that's helpful. Though Randall Mackie also just sent me this
link:
https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateRedundantMatrix.html

It seems like MatCreateRedundantMatrix is what I want to use, so I'll try
that out.

Best,
David





>
>
>
> On Mon, Jan 27, 2020 at 11:59 AM David Knezevic <
> david.knezevic at akselos.com> wrote:
>
>> I have a case where I'd like to copy a Mat defined on COMM_WORLD to a new
>> Mat defined on some sub-communicator. Does MatCopy support this, or would I
>> have to write a custom copy operation?
>>
>> I see here
>> <https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatConvert.html#MatConvert>
>> that MatConvert requires identical communicators, but I don't see any
>> mention of this for MatCopy, so I wanted to check.
>>
>> Thanks,
>> David
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200127/1bb552c0/attachment.html>


More information about the petsc-users mailing list