<div dir="ltr"><div dir="ltr">On Thu, Oct 19, 2023 at 6:51 AM Enrico <<a href="mailto:degregori@dkrz.de">degregori@dkrz.de</a>> wrote:<br></div><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">Hello,<br>
<br>
if I create an application ordering using AOCreateBasic, should I <br>
provide the same array for const PetscInt myapp[] and const PetscInt <br>
mypetsc[] in order to get the same ordering of the application within PETSC?<br></blockquote><div><br></div><div>Are you asking if the identity permutation can be constructed using the same array twice? Yes.</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">
And once I define the ordering so that the local vector and matrix are <br>
defined in PETSC as in my application, how can I use it to create the <br>
actual vector and matrix?<br></blockquote><div><br></div><div>The vectors and matrices do not change. The AO is a permutation. You can use it to permute</div><div>a vector into another order, or to convert on index to another.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</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">
Thanks in advance for the help.<br>
<br>
Cheers,<br>
Enrico<br>
<br>
On 18/10/2023 13:39, Matthew Knepley wrote:<br>
> On Wed, Oct 18, 2023 at 5:55 AM Enrico <<a href="mailto:degregori@dkrz.de" target="_blank">degregori@dkrz.de</a> <br>
> <mailto:<a href="mailto:degregori@dkrz.de" target="_blank">degregori@dkrz.de</a>>> wrote:<br>
> <br>
> Hello,<br>
> <br>
> I'm trying to use Petsc to solve a linear system in an application. I'm<br>
> using the coordinate format to define the matrix and the vector (it<br>
> should work better on GPU but at the moment every test is on CPU).<br>
> After<br>
> the call to VecSetValuesCOO, I've noticed that the vector is storing<br>
> the<br>
> data in a different way from my application. For example with two<br>
> processes in the application<br>
> <br>
> process 0 owns cells 2, 3, 4<br>
> <br>
> process 1 owns cells 0, 1, 5<br>
> <br>
> But in the vector data structure of Petsc<br>
> <br>
> process 0 owns cells 0, 1, 2<br>
> <br>
> process 1 owns cells 3, 4, 5<br>
> <br>
> This is in principle not a big issue, but after solving the linear<br>
> system I get the solution vector x and I want to get the values in the<br>
> correct processes. Is there a way to get vector values from other<br>
> processes or to get a mapping so that I can do it myself?<br>
> <br>
> <br>
> By definition, PETSc vectors and matrices own contiguous row blocks. If <br>
> you want to have another,<br>
> global ordering, we support that with <br>
> <a href="https://petsc.org/main/manualpages/AO/" rel="noreferrer" target="_blank">https://petsc.org/main/manualpages/AO/</a> <br>
> <<a href="https://petsc.org/main/manualpages/AO/" rel="noreferrer" target="_blank">https://petsc.org/main/manualpages/AO/</a>><br>
> <br>
> Thanks,<br>
> <br>
> Matt<br>
> <br>
> Cheers,<br>
> Enrico Degregori<br>
> <br>
> <br>
> <br>
> -- <br>
> What most experimenters take for granted before they begin their <br>
> experiments is infinitely more interesting than any results to which <br>
> their experiments lead.<br>
> -- Norbert Wiener<br>
> <br>
> <a href="https://www.cse.buffalo.edu/~knepley/" rel="noreferrer" target="_blank">https://www.cse.buffalo.edu/~knepley/</a> <<a href="http://www.cse.buffalo.edu/~knepley/" rel="noreferrer" target="_blank">http://www.cse.buffalo.edu/~knepley/</a>><br>
</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>