<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, May 23, 2017 at 6:23 AM, Stefano Zampini <span dir="ltr"><<a href="mailto:stefano.zampini@gmail.com" target="_blank">stefano.zampini@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">As I said, the local sizes of the MATIS matrix are NOT the sizes of the subdomain problem. As in all PETSc code, the local sizes of the matrix correspond to the local size of the non-overlapping right and left vectors used in matmult operations. You can use PETSC_DECIDE in place of localsize in your call to MatCreateIS. The size of the subdomain problem in MATIS is the local size of the l2g map.</div></blockquote><div><br></div><div>I just want to make sure that MatIS is really what you want, since its a little more complex than other options.</div><div><br></div><div>MatIS is useful for methods that need unassembled matrices, like domain decomposition methods which use</div><div>Neumann problems on subdomains. If you are fine with assembled sparse matrices, than the normal AIJ should</div><div>be easier to handle. Just checking.</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 class="gmail_extra"><div class="gmail_quote">Il 23 Mag 2017 11:53, "Franck Houssen" <<a href="mailto:franck.houssen@inria.fr" target="_blank">franck.houssen@inria.fr</a>> ha scritto:<br type="attribution"><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 ?<br></div><div><br></div><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>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><br></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/INRI<wbr>A/petsc-3.7.6/src/vec/is/utils<wbr>/isltog.c<br>[0]PETSC ERROR: [0] MatSetValues_IS line 692 /home/fghoussen/Documents/INRI<wbr>A/petsc-3.7.6/src/mat/impls/<wbr>is/matis.c<br>[0]PETSC ERROR: [0] MatSetValues line 1157 /home/fghoussen/Documents/INRI<wbr>A/petsc-3.7.6/src/mat/interfac<wbr>e/matrix.c<br>[0]PETSC ERROR: [0] MatISSetPreallocation_IS line 95 /home/fghoussen/Documents/INRI<wbr>A/petsc-3.7.6/src/mat/impls/<wbr>is/matis.c<br>[0]PETSC ERROR: [0] MatISSetPreallocation line 80 /home/fghoussen/Documents/INRI<wbr>A/petsc-3.7.6/src/mat/impls/<wbr>is/matis.c<br>[0]PETSC ERROR: [0] PetscSplitOwnership line 80 /home/fghoussen/Documents/INRI<wbr>A/petsc-3.7.6/src/sys/utils/<wbr>psplit.c<br>[0]PETSC ERROR: [0] PetscLayoutSetUp line 129 /home/fghoussen/Documents/INRI<wbr>A/petsc-3.7.6/src/vec/is/utils<wbr>/pmap.c<br>[0]PETSC ERROR: [0] MatSetLocalToGlobalMapping_IS line 628 /home/fghoussen/Documents/INRI<wbr>A/petsc-3.7.6/src/mat/impls/<wbr>is/matis.c<br>[0]PETSC ERROR: [0] MatSetLocalToGlobalMapping line 1899 /home/fghoussen/Documents/INRI<wbr>A/petsc-3.7.6/src/mat/interfac<wbr>e/matrix.c<br>[0]PETSC ERROR: [0] MatCreateIS line 986 /home/fghoussen/Documents/INRI<wbr>A/petsc-3.7.6/src/mat/impls/<wbr>is/matis.c<br><br><br><div><br></div><hr id="m_7285413657032518405m_5050136880204782320zwchr"><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_7285413657032518405m_5050136880204782320Apple-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_7285413657032518405m_5050136880204782320gmail_signature"><div dir="ltr"><div class="m_7285413657032518405m_5050136880204782320gmail_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_7285413657032518405m_5050136880204782320gmail_signature"><br></div><div class="m_7285413657032518405m_5050136880204782320gmail_signature"><a href="http://www.caam.rice.edu/%7Emk51/" target="_blank">http://www.caam.rice.edu/~mk51<wbr>/</a><br></div></div></div></div></div></div></blockquote></div></div></blockquote></div><div><br></div><hr id="m_7285413657032518405m_5050136880204782320zwchr"><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_7285413657032518405m_5050136880204782320Apple-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_7285413657032518405m_5050136880204782320HOEnZb"><span style="color:#888888" color="#888888"><div>Franck<br></div></span></span></div></div></blockquote></div><br><br clear="all"><span class="HOEnZb"><font color="#888888"><div><br></div>-- <br><div class="m_7285413657032518405m_5050136880204782320gmail_signature"><div dir="ltr"><div class="m_7285413657032518405m_5050136880204782320gmail_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_7285413657032518405m_5050136880204782320gmail_signature"><br></div><div class="m_7285413657032518405m_5050136880204782320gmail_signature"><a href="http://www.caam.rice.edu/~mk51/" target="_blank">http://www.caam.rice.edu/~mk51<wbr>/</a><br></div></div></div>
</font></span></div></div><span class="HOEnZb"><font color="#888888">
</font></span></div></blockquote></div><span class="HOEnZb"><font color="#888888"><br></font></span></div></blockquote><span class="HOEnZb"><font color="#888888"><div><br></div></font></span></div></div></blockquote></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>