<div dir="ltr">The other possibility is that you are using the "wrong" mpiexec.<div><br></div><div> Matt</div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Nov 23, 2018 at 1:04 PM Klaus Burkart via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_5318730801534809433ydpa6d042beyahoo-style-wrap" style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:10px"><div>
The output is:</div><div><br></div><div><span>local_size = 25, on process 0<br>rstart = 0, on process 0<br>rend = 25, on process 0<br>local_size = 25, on process 1<br>rstart = 0, on process 1<br>rend = 25, on process 1<br>local_size = 25, on process 2<br>rstart = 0, on process 2<br>rend = 25, on process 2<br>local_size = 25, on process 3<br>rstart = 0, on process 3<br>rend = 25, on process 3<br><br></span>Using <span>PETSC_COMM_SELF has no effect.</span><br></div><div><br></div>
</div><div id="m_5318730801534809433yahoo_quoted_3902976335" class="m_5318730801534809433yahoo_quoted">
<div style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:13px;color:#26282a">
<div>
Am Freitag, 23. November 2018, 18:02:45 MEZ hat zakaryah <<a href="mailto:zakaryah@gmail.com" target="_blank">zakaryah@gmail.com</a>> Folgendes geschrieben:
</div>
<div><br></div>
<div><br></div>
<div><div id="m_5318730801534809433yiv5892919874"><div><div>What does your output look like? With PETSC_COMM_WORLD, I think you will only get the output from the rank 0 process. Try with PETSC_COMM_SELF.</div><br clear="none"><div class="m_5318730801534809433yiv5892919874yqt0820812042" id="m_5318730801534809433yiv5892919874yqt61151"><div class="m_5318730801534809433yiv5892919874gmail_quote"><div dir="ltr">On Fri, Nov 23, 2018, 11:56 AM Matthew Knepley via petsc-users <<a rel="nofollow" shape="rect" href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a> wrote:<br clear="none"></div><blockquote class="m_5318730801534809433yiv5892919874gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="m_5318730801534809433yiv5892919874gmail_quote"><div dir="ltr">On Fri, Nov 23, 2018 at 9:54 AM Klaus Burkart via petsc-users <<a rel="nofollow" shape="rect" href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>> wrote:<br clear="none"></div><blockquote class="m_5318730801534809433yiv5892919874gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_5318730801534809433yiv5892919874m_-7534865181262945369m_-7110991292413019384ydp337a5c99yahoo-style-wrap" style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:10px"><span>Hello,<br clear="none"><br clear="none">I am trying to compute the local row ranges allocated to the processes i.e. rstart and rend of each process, needed as a <span>prerequisite</span> for MatMPIAIJSetPreallocation using d_nnz and o_nnz.<br clear="none"><br clear="none">I tried the following:<br clear="none"><br clear="none">...<br clear="none"><br clear="none"> PetscInitialize(0,0,PETSC_NULL,PETSC_NULL);<br clear="none"><br clear="none"> MPI_Comm_size(PETSC_COMM_WORLD,&size);<br clear="none"> MPI_Comm_rank(PETSC_COMM_WORLD,&rank);<br clear="none"><br clear="none"> MatCreate(PETSC_COMM_WORLD,&A);<br clear="none"> MatSetType(A,MATMPIAIJ);<br clear="none"> PetscInt local_size = PETSC_DECIDE;<br clear="none"> PetscSplitOwnership(PETSC_COMM_WORLD, &local_size, &N);<br clear="none"> MPI_Scan(&local_size, &rend, 1, MPIU_INT, MPI_SUM, PETSC_COMM_WORLD);<br clear="none"></span></div></div></blockquote><div><br clear="none"></div><div>This looks right to me. Not sure what your problem is. However, you can always use PetscLayout to do</div><div>this automatically.</div><div><br clear="none"></div><div> Thanks,</div><div><br clear="none"></div><div> Matt</div><div> </div><blockquote class="m_5318730801534809433yiv5892919874gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_5318730801534809433yiv5892919874m_-7534865181262945369m_-7110991292413019384ydp337a5c99yahoo-style-wrap" style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif;font-size:10px"><span> rstart = rend - local_size;<br clear="none"> PetscInt d_nnz[local_size], o_nnz[local_size];<br clear="none">/*<br clear="none"><br clear="none">compute d_nnz and o_nnz here<br clear="none"><br clear="none"> MatMPIAIJSetPreallocation(A,0,d_nnz,0,o_nnz);<br clear="none">*/<br clear="none"><br clear="none"> for (rank = 0; rank < size; rank++) {<br clear="none"> PetscPrintf(PETSC_COMM_WORLD,"local_size = %d, on process %d\n", local_size, rank);<br clear="none"> PetscPrintf(PETSC_COMM_WORLD,"rstart = %d, on process %d\n", rstart, rank);<br clear="none"> PetscPrintf(PETSC_COMM_WORLD,"rend = %d, on process %d\n", rend, rank);<br clear="none"> }<br clear="none"><br clear="none"> PetscFinalize();<br clear="none"><br clear="none">The local size is 25 rows on each process but rstart and rend are 0 and 25 on all processes, I expected 0 and 25, 25 and 50, 50 and 75 and 75 and 101. N = 100<br clear="none"><br clear="none">I can't spot the error. Any ideas, what's the problem?<br clear="none"><br clear="none">Klaus</span></div></div></blockquote></div><br clear="all"><div><br clear="none"></div>-- <br clear="none"><div class="m_5318730801534809433yiv5892919874m_-7534865181262945369gmail_signature" dir="ltr"><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 clear="none">-- Norbert Wiener</div><div><br clear="none"></div><div><a rel="nofollow" shape="rect" href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br clear="none"></div></div></div></div></div></div></div></div>
</blockquote></div></div></div></div></div>
</div>
</div></div></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="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>