<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, May 23, 2017 at 11:28 AM, Franck Houssen <span dir="ltr"><<a href="mailto:franck.houssen@inria.fr" target="_blank">franck.houssen@inria.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:times new roman,new york,times,serif;font-size:12pt;color:#000000"><div>OK, thanks. This is helpfull... But I really think the doc should be more verbose about that: this is really confusing and I didn't find any simple example to begin with which make all this even more confusing (personal opinion).</div></div></div></blockquote><div><br></div><div>Did you respond to my other question (how are you using them)? That would help me understand how to phrase it.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:times new roman,new york,times,serif;font-size:12pt;color:#000000"><div>Franck<br></div><div><br></div><div><br></div><hr id="m_-2855482959054092676zwchr"><blockquote style="border-left:2px solid #1010ff;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt"><b>De: </b>"Matthew Knepley" <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>><br><b>À: </b>"Franck Houssen" <<a href="mailto:franck.houssen@inria.fr" target="_blank">franck.houssen@inria.fr</a>><br><b>Cc: </b>"Stefano Zampini" <<a href="mailto:stefano.zampini@gmail.com" target="_blank">stefano.zampini@gmail.com</a>>, "PETSc" <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>>, "PETSc" <<a href="mailto:petsc-dev@mcs.anl.gov" target="_blank">petsc-dev@mcs.anl.gov</a>><br><b>Envoyé: </b>Mardi 23 Mai 2017 13:21:21<br><b>Objet: </b>Re: [petsc-dev] Using PETSc MatIS, how to matmult a global IS matrix and a global vector ?<br><div><br></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, May 23, 2017 at 4:53 AM, Franck Houssen <span dir="ltr"><<a href="mailto:franck.houssen@inria.fr" target="_blank">franck.houssen@inria.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:times new roman,new york,times,serif;font-size:12pt;color:#000000"><div>The first thing I did was to put 3, not 4 : I got an error thrown in MatCreateIS (see the git diff + stack below). As the error said I used globalSize = numberOfMPIProcessus * localSize : my understanding is that, when using MatIS, the global size needs to be the sum of all local sizes. Correct ?</div></div></div></blockquote><div><br></div><div>No. MatIS means that the matrix is not assembled. The easiest way (for me) to think of this is that processes do not have</div><div>to hold full rows. One process can hold part of row i, and another processes can hold another part. However, there are still</div><div>the same number of global rows.</div><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:times new roman,new york,times,serif;font-size:12pt;color:#000000"><div>I have a 3x3 global matrix made of two overlapping 2x2 local matrix (= diagonal with 1.). Each local matrix correspond to one domain (each domain is delegated to one MPI proc, so, I have 2 MPI procs because I have 2 domains).</div></div></div></blockquote><div><br></div><div>So the global size is 3. The local size here is not the size of the local IS block, since that is a property only of MatIS. It is the</div><div>size of the local piece of the vector you multiply. This allows PETSc to understand the parallel layout of the Vec, and how it</div><div>matched the Mat.</div><div><br></div><div>This is somewhat confusing because FEM people mean something different by "local" than we do here, and in fact we use this</div><div>other definition of local when assembling operators.</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:times new roman,new york,times,serif;font-size:12pt;color:#000000"><div>This is the simplest possible example: I have two 2x2 (local) diag matrix that overlap so that the global matrix built from them is 1, 2, 1 on the diagonal (local contributions add up in the middle).</div><div>I need to MatMult this global matrix with a global vector filled with 1.<br></div><div><br></div><div>Franck<br></div><div><br></div><div>Git diff :<br></div><div><br></div><div>--- a/matISLocalMat.cpp<br>+++ b/matISLocalMat.cpp<br>@@ -16,7 +16,7 @@ int main(int argc,char **argv) {<br> int size = 0; MPI_Comm_size(MPI_COMM_WORLD, &size); if (size != 2) return 1;<br> int rank = 0; MPI_Comm_rank(MPI_COMM_WORLD, &rank);<br> <br>- PetscInt localSize = 2, globalSize = localSize*2 /*2 MPI*/;<br>+ PetscInt localSize = 2, globalSize = 3;<br> PetscInt localIdx[2] = {0, 0};<br> if (rank == 0) {localIdx[0] = 0; localIdx[1] = 1;}<br> else {localIdx[0] = 1; localIdx[1] = 2;}<br><div><br></div></div><div><br></div><div><br>Stack error:<br></div><div><br></div><div>[0]PETSC ERROR: Nonconforming object sizes<br>[0]PETSC ERROR: Sum of local lengths 4 does not equal global length 3, my local length 2<br></div><div>[0]PETSC ERROR: [0] ISG2LMapApply line 17 /home/fghoussen/Documents/<wbr>INRIA/petsc-3.7.6/src/vec/is/<wbr>utils/isltog.c<br>[0]PETSC ERROR: [0] MatSetValues_IS line 692 /home/fghoussen/Documents/<wbr>INRIA/petsc-3.7.6/src/mat/<wbr>impls/is/matis.c<br>[0]PETSC ERROR: [0] MatSetValues line 1157 /home/fghoussen/Documents/<wbr>INRIA/petsc-3.7.6/src/mat/<wbr>interface/matrix.c<br>[0]PETSC ERROR: [0] MatISSetPreallocation_IS line 95 /home/fghoussen/Documents/<wbr>INRIA/petsc-3.7.6/src/mat/<wbr>impls/is/matis.c<br>[0]PETSC ERROR: [0] MatISSetPreallocation line 80 /home/fghoussen/Documents/<wbr>INRIA/petsc-3.7.6/src/mat/<wbr>impls/is/matis.c<br>[0]PETSC ERROR: [0] PetscSplitOwnership line 80 /home/fghoussen/Documents/<wbr>INRIA/petsc-3.7.6/src/sys/<wbr>utils/psplit.c<br>[0]PETSC ERROR: [0] PetscLayoutSetUp line 129 /home/fghoussen/Documents/<wbr>INRIA/petsc-3.7.6/src/vec/is/<wbr>utils/pmap.c<br>[0]PETSC ERROR: [0] MatSetLocalToGlobalMapping_IS line 628 /home/fghoussen/Documents/<wbr>INRIA/petsc-3.7.6/src/mat/<wbr>impls/is/matis.c<br>[0]PETSC ERROR: [0] MatSetLocalToGlobalMapping line 1899 /home/fghoussen/Documents/<wbr>INRIA/petsc-3.7.6/src/mat/<wbr>interface/matrix.c<br>[0]PETSC ERROR: [0] MatCreateIS line 986 /home/fghoussen/Documents/<wbr>INRIA/petsc-3.7.6/src/mat/<wbr>impls/is/matis.c<br><div><br></div><br><div><br></div><hr id="m_-2855482959054092676m_-3381094615989262306zwchr"><blockquote style="border-left:2px solid #1010ff;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt"><b>De: </b>"Stefano Zampini" <<a href="mailto:stefano.zampini@gmail.com" target="_blank">stefano.zampini@gmail.com</a>><br><b>À: </b>"Matthew Knepley" <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>><br><b>Cc: </b>"Franck Houssen" <<a href="mailto:franck.houssen@inria.fr" target="_blank">franck.houssen@inria.fr</a>>, "PETSc" <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>>, "PETSc" <<a href="mailto:petsc-dev@mcs.anl.gov" target="_blank">petsc-dev@mcs.anl.gov</a>><br><b>Envoyé: </b>Dimanche 21 Mai 2017 23:02:37<br><b>Objet: </b>Re: [petsc-dev] Using PETSc MatIS, how to matmult a global IS matrix and a global vector ?<br><div><br></div>Franck,<div><br></div><div>PETSc takes care of doing the matrix-vector multiplication properly using MatIS. As Matt said, the layout of the vectors is the usual parallel layout.</div><div>The local sizes of the MatIS matrix (i.e. the local size of the left and right vectors used in MatMult) are not the sizes of the local subdomain matrices in MatIS.</div><div><br></div><div><br><div><blockquote><div>On May 21, 2017, at 6:47 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:</div><br class="m_-2855482959054092676m_-3381094615989262306Apple-interchange-newline"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, May 21, 2017 at 11:26 AM, Franck Houssen <span dir="ltr"><<a href="mailto:franck.houssen@inria.fr" target="_blank">franck.houssen@inria.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:'times new roman','new york',times,serif;font-size:12pt"><div>Using PETSc MatIS, how to matmult a global IS matrix and a global vector ? Example is attached : I don't get what I expect that is a vector such that proc0 = [1, 2] and proc1 = [2, 1]</div></div></div></blockquote><div><br></div><div>1) I think the global size of your matrix is wrong. You seem to want 3, not 4</div><div><br></div><div>2) Global vectors have a non-overlapping row partition. You might be thinking of local vectors</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div></div><br><br clear="all"><div><br></div>-- <br><div class="m_-2855482959054092676m_-3381094615989262306gmail_signature"><div dir="ltr"><div class="m_-2855482959054092676m_-3381094615989262306gmail_signature">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 class="m_-2855482959054092676m_-3381094615989262306gmail_signature"><br></div><div class="m_-2855482959054092676m_-3381094615989262306gmail_signature"><a href="http://www.caam.rice.edu/%7Emk51/" target="_blank">http://www.caam.rice.edu/~<wbr>mk51/</a><br></div></div></div></div></div></div></blockquote></div></div></blockquote></div><div><br></div><hr id="m_-2855482959054092676m_-3381094615989262306zwchr"><blockquote style="border-left:2px solid #1010ff;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt"><b>De: </b>"Stefano Zampini" <<a href="mailto:stefano.zampini@gmail.com" target="_blank">stefano.zampini@gmail.com</a>><br><b>À: </b>"Matthew Knepley" <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>><br><b>Cc: </b>"Franck Houssen" <<a href="mailto:franck.houssen@inria.fr" target="_blank">franck.houssen@inria.fr</a>>, "PETSc" <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>>, "PETSc" <<a href="mailto:petsc-dev@mcs.anl.gov" target="_blank">petsc-dev@mcs.anl.gov</a>><br><b>Envoyé: </b>Dimanche 21 Mai 2017 23:02:37<br><b>Objet: </b>Re: [petsc-dev] Using PETSc MatIS, how to matmult a global IS matrix and a global vector ?<br><div><br></div>Franck,<div><br></div><div>PETSc takes care of doing the matrix-vector multiplication properly using MatIS. As Matt said, the layout of the vectors is the usual parallel layout.</div><div>The local sizes of the MatIS matrix (i.e. the local size of the left and right vectors used in MatMult) are not the sizes of the local subdomain matrices in MatIS.</div><div><br></div><div><br><div><blockquote><div>On May 21, 2017, at 6:47 PM, Matthew Knepley <<a href="mailto:knepley@gmail.com" target="_blank">knepley@gmail.com</a>> wrote:</div><br class="m_-2855482959054092676m_-3381094615989262306Apple-interchange-newline"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, May 21, 2017 at 11:26 AM, Franck Houssen <span dir="ltr"><<a href="mailto:franck.houssen@inria.fr" target="_blank">franck.houssen@inria.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:'times new roman','new york',times,serif;font-size:12pt"><div>Using PETSc MatIS, how to matmult a global IS matrix and a global vector ? Example is attached : I don't get what I expect that is a vector such that proc0 = [1, 2] and proc1 = [2, 1]</div></div></div></blockquote><div><br></div><div>1) I think the global size of your matrix is wrong. You seem to want 3, not 4</div><div><br></div><div>2) Global vectors have a non-overlapping row partition. You might be thinking of local vectors</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-family:'times new roman','new york',times,serif;font-size:12pt"><span class="m_-2855482959054092676m_-3381094615989262306HOEnZb"><span style="color:#888888"><div>Franck<br></div></span></span></div></div></blockquote></div><br><br clear="all"><span class="HOEnZb"><font color="#888888"><span class="m_-2855482959054092676HOEnZb"><span style="color:#888888" color="#888888"><div><br></div>-- <br><div class="m_-2855482959054092676m_-3381094615989262306gmail_signature"><div dir="ltr"><div class="m_-2855482959054092676m_-3381094615989262306gmail_signature">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 class="m_-2855482959054092676m_-3381094615989262306gmail_signature"><br></div><div class="m_-2855482959054092676m_-3381094615989262306gmail_signature"><a href="http://www.caam.rice.edu/~mk51/" target="_blank">http://www.caam.rice.edu/~<wbr>mk51/</a><br></div></div></div>
</span></span></font></span></div></div><span class="HOEnZb"><font color="#888888"><span class="m_-2855482959054092676HOEnZb"><span style="color:#888888" color="#888888">
</span></span></font></span></div></blockquote></div><span class="HOEnZb"><font color="#888888"><span class="m_-2855482959054092676HOEnZb"><span style="color:#888888" color="#888888"><br></span></span></font></span></div></blockquote><span class="HOEnZb"><font color="#888888"><div><br></div></font></span></div></div></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div class="m_-2855482959054092676gmail_signature"><div dir="ltr"><div class="m_-2855482959054092676gmail_signature">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 class="m_-2855482959054092676gmail_signature"><br></div><div class="m_-2855482959054092676gmail_signature"><a href="http://www.caam.rice.edu/~mk51/" target="_blank">http://www.caam.rice.edu/~<wbr>mk51/</a><br></div></div></div>
</font></span></div></div>
</blockquote><div><br></div></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><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.caam.rice.edu/~mk51/" target="_blank">http://www.caam.rice.edu/~mk51/</a><br></div></div></div>
</div></div>