<div dir="ltr"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Maybe I'm not understanding you -- matCopy does not have your sub-communicator so how would it create a Mat with it ...<br></div></div></blockquote><div><br></div><div>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...</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div><div>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.<br></div><div><div>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.</div></div></div><div><br></div><div>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.</div><div><br></div><div><a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatMPIAdjCreateNonemptySubcommMat.html" target="_blank">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatMPIAdjCreateNonemptySubcommMat.html</a></div></div></blockquote><div><br></div><div>OK, thanks, that's helpful. Though Randall Mackie also just sent me this link:</div><div><a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateRedundantMatrix.html">https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatCreateRedundantMatrix.html</a><br></div><div><br></div><div>It seems like MatCreateRedundantMatrix is what I want to use, so I'll try that out.</div><div><br></div><div>Best,</div><div>David</div><div><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jan 27, 2020 at 11:59 AM David Knezevic <<a href="mailto:david.knezevic@akselos.com" target="_blank">david.knezevic@akselos.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>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?</div><div><br></div><div>I see <a href="https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatConvert.html#MatConvert" target="_blank">here</a> that MatConvert requires identical communicators, but I don't see any mention of this for MatCopy, so I wanted to check.</div><div><br></div><div>Thanks,<br>David</div></div>
</blockquote></div>
</blockquote></div></div>