<div dir="ltr"><div dir="ltr">Thank you so much for your reply. <div> </div><div>But in the definition of d_nz of <i>MatMPIAIJSetPreallocation </i>, it is defined as 'number of nonzeros per row in DIAGONAL portion of local submatrix'. So I was wondering about how to find the Diagonal portion of the local submatrix that PETSc is splitting the big matrix into . So should it be the maximum number of nonzeros in each row of the big matrix instead of the min number of nonzeros in the diagonal portion of the local matrix?</div><div><br></div><div>And so MatGetOwnershipRange returns the start and the end of all the smaller matrices that PETSc is splitting the big matrix into, right?</div><div><br></div><div><br></div><div>Regards,</div><div>Maahi Talukder</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 15, 2019 at 2:43 PM Zhang, Hong <<a href="mailto:hzhang@mcs.anl.gov" target="_blank">hzhang@mcs.anl.gov</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>
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">Maahi :<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">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">Hello All,
<div><br>
</div>
<div>I have some questions regarding ex2.c in /<i>petsc/src/ksp/ksp/examples/tutorials/ex2.c. </i></div>
<div><i><br>
</i></div>
<div>1. The local sizes of the matrix was decided by PETSc using <i>ierr = MatSetSizes(A,PETSC_DECIDE,PETSC_DECIDE,m*n,m*n);CHKERRQ(ierr);</i></div>
<div>But without knowing the local sizes, how was the following function used which requires the knowledge of how the big matrix was split into smaller chunks within PETSc? </div>
<div>
<div> <i>ierr = MatMPIAIJSetPreallocation(A,5,NULL,5,NULL);CHKERRQ(ierr);</i></div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div>This example sets a matrix for 2D 5-point PDE stencil, for which the maximum non-zeros in each row is 5. </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 dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div><br>
</div>
<div>2. When using <i>MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr), </i>the global index of first and last row of which local chunk of the big matrix is it returning ? I mean if the big matrix was split into three processes, for example, fist and
last global row of which process is it returning? </div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div>Adding a line </div>
<div> ierr = MatGetOwnershipRange(A,&Istart,&Iend);CHKERRQ(ierr);</div>
<div>+ printf("Istart %d Iend %d\n",Istart,Iend); </div>
<div><br>
</div>
<div>I get</div>
<div>
<div>$ mpiexec -n 3 ./ex2</div>
<div>Istart 0 Iend 19</div>
<div>Istart 19 Iend 38</div>
<div>Istart 38 Iend 56</div>
<div>Norm of error 0.000522061 iterations 9</div>
</div>
<div>The matrix global size = 56</div>
<div><br>
</div>
<div>Hong</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 dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div><br>
</div>
<div>Your replies are highly appreciated</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Maahi Talukder</div>
<div>Clarkson University </div>
<div><br>
</div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</blockquote></div>