<div dir="ltr"><div dir="ltr">On Mon, Feb 13, 2023 at 6:24 AM Karthikeyan Chockalingam - STFC UKRI via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</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"><div class="msg3443406836145122634">
<div lang="EN-GB" style="overflow-wrap: break-word;">
<div class="m_-7310754027166719361WordSection1">
<p class="MsoNormal"><span style="font-size:11pt">Thank you. I have it working now.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt">(Q1) When both d_nz and d_nnz are specified – would petsc would pick up d_nnz over d_nz? Likewise for o_nz and o_nnz?<u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:Menlo;color:black"> ierr =
</span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(108,54,169)">MatMPIAIJSetPreallocation</span><span style="font-size:8.5pt;font-family:Menlo;color:black">(</span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(50,109,116)">A</span><span style="font-size:8.5pt;font-family:Menlo;color:black">,d_nz,
d_nnz, o_nz, o_nnz); </span></p></div></div></div></blockquote><div><br></div><div>Yes, it will pick d_nnz.</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"><div class="msg3443406836145122634"><div lang="EN-GB" style="overflow-wrap: break-word;"><div class="m_-7310754027166719361WordSection1">
<p class="MsoNormal" style="background:white"><span style="font-size:11pt;color:black">(Q2) Finally I would like to assign appropriate memory for ‘active rows’ as well. I know the max non-zero elements in a row is 9? Is there a
rule-of-thumb what d_nz and o_nz be for active rows - when run parallelly?</span></p></div></div></div></blockquote><div><br></div><div>No, it would depend on your partitioning.</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"><div class="msg3443406836145122634"><div lang="EN-GB" style="overflow-wrap: break-word;"><div class="m_-7310754027166719361WordSection1">
<p class="MsoNormal" style="background:white"><span style="font-size:11pt;color:black">Best,</span><span style="font-size:11pt"><u></u><u></u></span></p>
<p class="MsoNormal" style="background:white"><span style="font-size:11pt;color:black">Karthik.</span><span style="font-size:8.5pt;font-family:Menlo;color:black"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12pt"><b><span style="font-size:12pt;color:black">From:
</span></b><span style="font-size:12pt;color:black">Barry Smith <<a href="mailto:bsmith@petsc.dev" target="_blank">bsmith@petsc.dev</a>><br>
<b>Date: </b>Saturday, 11 February 2023 at 00:45<br>
<b>To: </b>Chockalingam, Karthikeyan (STFC,DL,HC) <<a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank">karthikeyan.chockalingam@stfc.ac.uk</a>><br>
<b>Cc: </b><a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a> <<a href="mailto:petsc-users@mcs.anl.gov" target="_blank">petsc-users@mcs.anl.gov</a>><br>
<b>Subject: </b>Re: [petsc-users] Eliminating rows and columns which are zeros<u></u><u></u></span></p>
</div>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><br>
<br>
<u></u><u></u></span></p>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<p class="MsoNormal"><span style="font-size:11pt">On Feb 10, 2023, at 5:32 PM, Karthikeyan Chockalingam - STFC UKRI <<a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank">karthikeyan.chockalingam@stfc.ac.uk</a>> wrote:<u></u><u></u></span></p>
</div>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Yes, but d_nnz_vec and o_nnz_vec are not of size MPI rank but of size N.</span></p>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
</div>
<p class="MsoNormal"><span style="font-size:11pt"> They are each of size local_size not size N. So your old code was fine with some changes, like<u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<pre><span style="font-size:10.5pt;font-family:Courier">for (int i = 0; i < local_size; i++) {</span></pre>
<pre><span style="font-size:10.5pt;font-family:Courier"> d_nnz[i] = 10 if active row else 1;</span></pre>
<pre><span style="font-size:10.5pt;font-family:Courier"> o_nnz[i] = 10 if active row else 0;</span></pre>
<pre><span style="font-size:10.5pt;font-family:Courier"> }</span></pre>
</blockquote>
</blockquote>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier"> </span><span style="font-size:11pt"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">That is all you need to define these two arrays. </span><span style="font-size:11pt"><u></u><u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> but you don't need the <br>
<br>
<u></u><u></u></span></p>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Below is an alternative approach, making both d_nnz_vec and o_nnz_vec PETSc mpi vecs instead of C++ containers.</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Is this okay?</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">MatSetType(A, MATAIJ);</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">MatSetSizes(A, PETSC_DECIDE,PETSC_DECIDE,N,N);</span></p>
</div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier"> </span><u></u><u></u></p>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">PetscInt rstart, rend;</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">MatGetOwnershipRange(A,&rstart,&rend);</span></p>
</div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier"> </span><u></u><u></u></p>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">PetscInt local_size = rend – rstart;</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier"> </span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">VecCreateMPI(PETSC_COMM_WORLD, local_size, N, &d_nnz_vec)</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">VecDuplicate(d_nnz_vec, o_nnz_vec)</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier"> </span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">// populate d_nnz_vec and o_nnz_vec but not shown here!</span></p>
</div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier"> </span><u></u><u></u></p>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">PetscMalloc(local_size * sizeof(PetscInt), &d_nnz);</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">PetscMalloc(local_size * sizeof(PetscInt), &o_nnz);</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">PetscMalloc(local_size * sizeof(PetscInt), &indices);</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier"> </span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier"> </span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">for (int i = 0; i < local_size; i++)</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier"> <span class="m_-7310754027166719361apple-converted-space"> </span>indices[i]=i+rstart;</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier"> </span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">VecGetValues(d_nnz_vec, local_size,<span class="m_-7310754027166719361apple-converted-space"> </span>indices, d_nzz);</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">VecGetValues(o_nnz_vec, local_size,<span class="m_-7310754027166719361apple-converted-space"> </span>indices, o_nzz);</span></p>
</div>
<pre><span style="font-size:10.5pt;font-family:Courier"> </span></pre>
<pre><span style="font-size:10.5pt;font-family:Courier"> </span></pre>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">MatMPIAIJSetPreallocation(A, max_d_nz, d_nnz, max_o_nz, o_nnz);</span></p>
</div>
<pre> </pre>
<pre><span style="font-size:10.5pt;font-family:Courier">PetscFree(d_nnz);</span></pre>
<pre><span style="font-size:10.5pt;font-family:Courier">PetscFree(o_nnz);</span></pre>
<pre> </pre>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Kind regards,</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Karthik.</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12pt"><b><span style="font-size:12pt">From:<span class="m_-7310754027166719361apple-converted-space"> </span></span></b><span style="font-size:12pt">Barry Smith <</span><a href="mailto:bsmith@petsc.dev" target="_blank"><span style="font-size:12pt;color:purple">bsmith@petsc.dev</span></a><span style="font-size:12pt">><br>
<b>Date:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Friday, 10 February 2023 at 20:53<br>
<b>To:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Chockalingam, Karthikeyan (STFC,DL,HC) <</span><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank"><span style="font-size:12pt;color:purple">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size:12pt">><br>
<b>Cc:<span class="m_-7310754027166719361apple-converted-space"> </span></b></span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:12pt;color:purple">petsc-users@mcs.anl.gov</span></a><span class="m_-7310754027166719361apple-converted-space"><span style="font-size:12pt"> </span></span><span style="font-size:12pt"><</span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:12pt;color:purple">petsc-users@mcs.anl.gov</span></a><span style="font-size:12pt">><br>
<b>Subject:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Re: [petsc-users] Eliminating rows and columns which are zeros</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><br>
<br>
<br>
</span></p>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">On Feb 10, 2023, at 3:34 PM, Karthikeyan Chockalingam - STFC UKRI <</span><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank"><span style="font-size:11pt;color:purple">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size:11pt">>
wrote:</span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Thank you for your response.</span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span><u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">“</span><span style="font-size:12pt;color:rgb(33,33,33)">But the original big matrix with lots of extra reserved space still exists (your A).” - I would like to save memory on rows that are ‘inactive’ by making
use of d_nnz and o_nnz.</span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)"> </span><u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)">(Q1) When is a row considered “inactive” and dropped by -pc_type redistribute during the solve? Is it when the entire row is zero?</span></p>
</div>
</div>
</div>
</blockquote>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> When there is only a diagonal entry or no entries.<br>
<br>
<br>
</span></p>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)"> </span><u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)">(Q2) If the answer to (Q1) is ‘yes’. Am I right in thinking it would be beneficial to make have 0.0 on the diagonal of the ‘inactive’ rows instead of ‘1.0’?</span></p>
</div>
</div>
</div>
</blockquote>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> Doesn't matter, you can have any value on the diagonal.<br>
<br>
<br>
</span></p>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)"> </span><u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)">Currently, I am setting 0.0 to the diagonal element of the ‘inactive’ rows.</span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)">I am propose the following, please let me know if I am heading in the right direction.</span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)"> </span><u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)">(Q3) ) I am planning to create two C++ vectors: d_nnz_vec and o_nnz_vec of N.</span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)">Is d_nnz_vec[inactive_row_index] = 0 and o_nnz_vec[inactive_row_index] = 0 or</span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)">d_nnz_vec[inactive_row_index] = 1 and Is o_nnz_vec[inactive_row_index] = 0?</span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)"> </span><u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)">d_nnz_vec[active_row_index] = 10 and o_nnz_vec[active_row_index] = 10</span></p>
</div>
</div>
</div>
</blockquote>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> Yes, this seems like the correct scheme, it will not allocate unneeded extra space for inactive rows, exactly the one you want. <br>
<br>
<br>
</span></p>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)"> </span><u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)">(Q4) Is the below correct?</span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)"> </span><u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">PetscInt * d_nnz = NULL;</span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">PetscInt * o_nnz = NULL;</span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">PetscInt max_d_nz = 10;</span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">PetscInt max_o_nz = 10;</span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier"> </span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier"> </span><u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">MatSetType(A, MATAIJ);</span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">MatSetSizes(A, PETSC_DECIDE,PETSC_DECIDE,N,N);</span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier"> </span><u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">PetscInt rstart, rend;</span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">MatGetOwnershipRange(A,&rstart,&rend);</span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier"> </span><u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">PetscInt local_size = rend – rstart;</span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier"> </span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier"> </span><u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">PetscMalloc(local_size * sizeof(PetscInt), &d_nnz);</span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">PetscMalloc(local_size * sizeof(PetscInt), &o_nnz);</span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier"> </span><u></u><u></u></p>
</div>
<pre><span style="font-size:10.5pt;font-family:Courier"> for (int i = 0; i < local_size; i++) {</span></pre>
<pre><span style="font-size:10.5pt;font-family:Courier"> d_nnz[i] = d_nnz_vec[i + rstart];</span></pre>
<pre><span style="font-size:10.5pt;font-family:Courier"> o_nnz[i] = o_nnz_vec[i + rstart];</span></pre>
<pre><span style="font-size:10.5pt;font-family:Courier"> }</span></pre>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier"> </span><u></u><u></u></p>
</div>
</div>
</blockquote>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> Yes, but I think the </span><span class="m_-7310754027166719361apple-converted-space"><span style="font-size:10.5pt;font-family:Courier"> </span></span><span style="font-size:10.5pt;font-family:Courier">+ rstart is wrong. It
is not needed because the d_nnz and o_nnz are just the size on that MPI rank.</span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><br>
<br>
<br>
</span></p>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier"> </span><u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.5pt;font-family:Courier">MatMPIAIJSetPreallocation(A,max_d_nz,d_nnz,max_o_nz, o_nnz);</span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)"> </span><u></u><u></u></p>
</div>
<pre><span style="font-size:10.5pt;font-family:Courier">PetscFree(d_nnz);</span></pre>
<pre><span style="font-size:10.5pt;font-family:Courier">PetscFree(o_nnz);</span></pre>
<pre><span style="font-size:10.5pt;font-family:Courier"> </span></pre>
<pre><span style="font-size:10.5pt;font-family:Courier"> </span></pre>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)"> </span><u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)">Kind regards,</span></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)">Karthik.</span></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)"> </span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span><u></u><u></u></p>
</div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12pt"><b><span style="font-size:12pt">From:<span class="m_-7310754027166719361apple-converted-space"> </span></span></b><span style="font-size:12pt">Barry Smith <</span><a href="mailto:bsmith@petsc.dev" target="_blank"><span style="font-size:12pt;color:purple">bsmith@petsc.dev</span></a><span style="font-size:12pt">><br>
<b>Date:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Wednesday, 8 February 2023 at 21:10<br>
<b>To:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Chockalingam, Karthikeyan (STFC,DL,HC) <</span><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank"><span style="font-size:12pt;color:purple">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size:12pt">><br>
<b>Cc:<span class="m_-7310754027166719361apple-converted-space"> </span></b></span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:12pt;color:purple">petsc-users@mcs.anl.gov</span></a><span class="m_-7310754027166719361apple-converted-space"><span style="font-size:12pt"> </span></span><span style="font-size:12pt"><</span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:12pt;color:purple">petsc-users@mcs.anl.gov</span></a><span style="font-size:12pt">><br>
<b>Subject:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Re: [petsc-users] Eliminating rows and columns which are zeros</span><u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span><u></u><u></u></p>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:11pt"><br>
<br>
</span></p>
</div>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">On Feb 8, 2023, at 11:19 AM, Karthikeyan Chockalingam - STFC UKRI <</span><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank"><span style="font-size:11pt;color:purple">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size:11pt">>
wrote:</span></p>
</div>
</div>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span><u></u><u></u></p>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">No, I am not calling<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:12pt;color:rgb(33,33,33)"> MatMPIAIJSetPreallocation(... N,NULL);</span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)">Here is what I do:</span></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)"> </span></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:Menlo;color:black"> </span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(57,0,160)">PetscInt</span><span class="m_-7310754027166719361apple-converted-space"><span style="font-size:8.5pt;font-family:Menlo;color:black"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:black">d_nz
=<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(28,0,207)">10</span><span style="font-size:8.5pt;font-family:Menlo;color:black">;</span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:Menlo;color:black"> </span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(57,0,160)">PetscInt</span><span class="m_-7310754027166719361apple-converted-space"><span style="font-size:8.5pt;font-family:Menlo;color:black"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:black">o_nz
=<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(28,0,207)">10</span><span style="font-size:8.5pt;font-family:Menlo;color:black">;</span></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:12pt;color:rgb(33,33,33)"> </span></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:Menlo;color:black"> ierr =<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(108,54,169)">MatCreate</span><span style="font-size:8.5pt;font-family:Menlo;color:black">(</span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(108,54,169)">PETSC_COMM_WORLD</span><span style="font-size:8.5pt;font-family:Menlo;color:black">,
&</span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(50,109,116)">A</span><span style="font-size:8.5pt;font-family:Menlo;color:black">);<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(100,56,32)">CHKERRQ</span><span style="font-size:8.5pt;font-family:Menlo;color:black">(ierr);</span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:Menlo;color:black"> ierr =<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(108,54,169)">MatSetType</span><span style="font-size:8.5pt;font-family:Menlo;color:black">(</span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(50,109,116)">A</span><span style="font-size:8.5pt;font-family:Menlo;color:black">,<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(100,56,32)">MATMPIAIJ</span><span style="font-size:8.5pt;font-family:Menlo;color:black">);<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(100,56,32)">CHKERRQ</span><span style="font-size:8.5pt;font-family:Menlo;color:black">(ierr);</span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:Menlo;color:black"> ierr =<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(108,54,169)">MatSetSizes</span><span style="font-size:8.5pt;font-family:Menlo;color:black">(</span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(50,109,116)">A</span><span style="font-size:8.5pt;font-family:Menlo;color:black">,<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(108,54,169)">PETSC_DECIDE</span><span style="font-size:8.5pt;font-family:Menlo;color:black">,<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(108,54,169)">PETSC_DECIDE</span><span style="font-size:8.5pt;font-family:Menlo;color:black">,
N, N);<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(100,56,32)">CHKERRQ</span><span style="font-size:8.5pt;font-family:Menlo;color:black">(ierr);</span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:Menlo;color:black"> ierr =<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(108,54,169)">MatMPIAIJSetPreallocation</span><span style="font-size:8.5pt;font-family:Menlo;color:black">(</span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(50,109,116)">A</span><span style="font-size:8.5pt;font-family:Menlo;color:black">,
d_nz,<span class="m_-7310754027166719361apple-converted-space"> </span></span><b><span style="font-size:8.5pt;font-family:Menlo;color:rgb(155,35,147)">NULL</span></b><span style="font-size:8.5pt;font-family:Menlo;color:black">, o_nz,<span class="m_-7310754027166719361apple-converted-space"> </span></span><b><span style="font-size:8.5pt;font-family:Menlo;color:rgb(155,35,147)">NULL</span></b><span style="font-size:8.5pt;font-family:Menlo;color:black">);<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(100,56,32)">CHKERRQ</span><span style="font-size:8.5pt;font-family:Menlo;color:black">(ierr);</span></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:Menlo;color:black"> </span></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11pt;color:black">(Q1)</span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">As I am setting the size of A to be N x N via</span></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:Menlo;color:black"> </span></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:Menlo;color:black"> ierr =<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(108,54,169)">MatSetSizes</span><span style="font-size:8.5pt;font-family:Menlo;color:black">(</span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(50,109,116)">A</span><span style="font-size:8.5pt;font-family:Menlo;color:black">,<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(108,54,169)">PETSC_DECIDE</span><span style="font-size:8.5pt;font-family:Menlo;color:black">,<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(108,54,169)">PETSC_DECIDE</span><span style="font-size:8.5pt;font-family:Menlo;color:black">,
N, N);<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(100,56,32)">CHKERRQ</span><span style="font-size:8.5pt;font-family:Menlo;color:black">(ierr);</span></p>
</div>
</div>
</div>
</div>
</blockquote>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> d_nz and o_nz determine the memory reserved for A. So if you use for example 10 that means 10 entries are reserved for every row, even inactive ones.</span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:11pt"><br>
<br>
</span></p>
</div>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">and pre-allocation is done for ALL rows I would like to understand if the ‘inactive rows’ are NOT contributing to memory (while using ‘redistribute’)?</span></p>
</div>
</div>
</div>
</div>
</blockquote>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:11pt"> Redistribute will drop all the inactive rows from the computation of the solve, it generates a smaller matrix missing all those rows and columns. But the original big matrix
with lots of extra reserved space still exists (your A).<br>
<br>
</span></p>
</div>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">(Q2)</span></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">I tried solving using hypre within redistribute and system converges to a solution. Is below correct way to use hypre within redistribute?</span></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:Menlo;color:black"> ierr =<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(108,54,169)">PetscOptionsSetValue</span><span style="font-size:8.5pt;font-family:Menlo;color:black">(</span><b><span style="font-size:8.5pt;font-family:Menlo;color:rgb(155,35,147)">NULL</span></b><span style="font-size:8.5pt;font-family:Menlo;color:black">,</span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(196,26,22)">"-ksp_type"</span><span style="font-size:8.5pt;font-family:Menlo;color:black">,<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(196,26,22)">"preonly"</span><span style="font-size:8.5pt;font-family:Menlo;color:black">);</span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:Menlo;color:black"> ierr =<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(108,54,169)">PetscOptionsSetValue</span><span style="font-size:8.5pt;font-family:Menlo;color:black">(</span><b><span style="font-size:8.5pt;font-family:Menlo;color:rgb(155,35,147)">NULL</span></b><span style="font-size:8.5pt;font-family:Menlo;color:black">,</span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(196,26,22)">"-pc_type"</span><span style="font-size:8.5pt;font-family:Menlo;color:black">,<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(196,26,22)">"redistribute"</span><span style="font-size:8.5pt;font-family:Menlo;color:black">);</span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:Menlo;color:rgb(196,26,22)"> ierr =<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(108,54,169)">PetscOptionsSetValue</span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(196,26,22)">(</span><b><span style="font-size:8.5pt;font-family:Menlo;color:rgb(155,35,147)">NULL</span></b><span style="font-size:8.5pt;font-family:Menlo;color:rgb(196,26,22)">,"-redistribute_ksp_type",
"cg");<span class="m_-7310754027166719361apple-converted-space"> </span></span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:Menlo;color:rgb(196,26,22)"> ierr =<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(108,54,169)">PetscOptionsSetValue</span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(196,26,22)">(</span><b><span style="font-size:8.5pt;font-family:Menlo;color:rgb(155,35,147)">NULL</span></b><span style="font-size:8.5pt;font-family:Menlo;color:rgb(196,26,22)">,"-redistribute_pc_type",
"hypre");<span class="m_-7310754027166719361apple-converted-space"> </span></span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:Menlo;color:rgb(196,26,22)"> ierr =<span class="m_-7310754027166719361apple-converted-space"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(108,54,169)">PetscOptionsSetValue</span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(196,26,22)">(</span><b><span style="font-size:8.5pt;font-family:Menlo;color:rgb(155,35,147)">NULL</span></b><span style="font-size:8.5pt;font-family:Menlo;color:rgb(196,26,22)">,"-redistribute_pc_hypre_type",
"boomeramg");<span class="m_-7310754027166719361apple-converted-space"> </span></span></p>
</div>
</div>
</div>
</div>
</blockquote>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span><u></u><u></u></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Correct. You can run with -ksp_view and it will provide all the information about how the solves are layered.</span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:11pt"><br>
<br>
</span></p>
</div>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Many thanks,</span></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Karthik.</span></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12pt"><b><span style="font-size:12pt">From:<span class="m_-7310754027166719361apple-converted-space"> </span></span></b><span style="font-size:12pt">Barry Smith <</span><a href="mailto:bsmith@petsc.dev" target="_blank"><span style="font-size:12pt;color:purple">bsmith@petsc.dev</span></a><span style="font-size:12pt">><br>
<b>Date:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Tuesday, 7 February 2023 at 19:52<br>
<b>To:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Chockalingam, Karthikeyan (STFC,DL,HC) <</span><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank"><span style="font-size:12pt;color:purple">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size:12pt">><br>
<b>Cc:<span class="m_-7310754027166719361apple-converted-space"> </span></b></span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:12pt;color:purple">petsc-users@mcs.anl.gov</span></a><span class="m_-7310754027166719361apple-converted-space"><span style="font-size:12pt"> </span></span><span style="font-size:12pt"><</span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:12pt;color:purple">petsc-users@mcs.anl.gov</span></a><span style="font-size:12pt">><br>
<b>Subject:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Re: [petsc-users] Eliminating rows and columns which are zeros</span><u></u><u></u></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><u></u> <u></u></p>
</div>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">On Feb 7, 2023, at 1:20 PM, Karthikeyan Chockalingam - STFC UKRI <</span><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank"><span style="font-size:11pt;color:purple">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size:11pt">>
wrote:</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Thank you Barry for your detailed response.</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">I would like to shed some light into what I try to accomplish using PETSc and AMReX. Please see the<span class="m_-7310754027166719361apple-converted-space"> </span><u>attachment adaptive mesh image</u><span class="m_-7310754027166719361apple-converted-space"> </span>(and
ignore the mesh-order legend for now).</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">The number of elements on each level is a geometric progression.</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">N - Number elements on each level indexed by ‘n’</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">n - Adaptive mesh level index (starting from 1)</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">a - Number of elements on the base mesh = 16</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">r = 4 (each element is divided into four on the next higher level of refinement)</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">N = a r^(n-1)</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">The final solution u, is the super imposition of solutions from all levels (here we have a total of 7 levels).</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">u = u^(1) + u^(2) + … + u^(7)</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Hence I have seven system matrix and solution vector pairs, one for each level.</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">On each level the element index vary from 1 to N. But on each level NOT all elements are ‘active’.</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">As you can see from the attached image not all elements are active (<u>a lot of white hollow spaces</u>). So the ‘active’ indexes can be scatted anywhere between 1 to N = 65536 for n = 7.</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">(Q1) In my case, I can’t at the moment insert 1 on the diagonal because during assembly I am using ADD_VALUES as a node can be common to many elements. So I added 0.0 to ALL diagonals. After global assembly,
I find that the linear solver converges.<span class="m_-7310754027166719361apple-converted-space"> </span></span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">(Q2) After adding 0.0 to all diagonal. I able to solve using either</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="m_-7310754027166719361apple-converted-space"><span style="font-size:8.5pt;font-family:Menlo;color:rgb(93,108,121)"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(93,108,121)">ierr = PetscOptionsSetValue(NULL,"-redistribute_pc_type",
"jacobi"); CHKERRQ(ierr);</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:Menlo;color:rgb(93,108,121)">or</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="m_-7310754027166719361apple-converted-space"><span style="font-size:8.5pt;font-family:Menlo;color:rgb(93,108,121)"> </span></span><span style="font-size:8.5pt;font-family:Menlo;color:rgb(93,108,121)">ierr = PetscOptionsSetValue(NULL,"
pc_type", "jacobi"); CHKERRQ(ierr);</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">I was able to solve using hypre as well.</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Do I need to use -pc_type redistribute or not? Because I am able to solve without it as well.</span></p>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> No you do not need redistribute, but for large problems with many empty rows using a solver inside redistribute will be faster than just using that solver directly on the much larger (mostly empty) system.</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><u></u> <u></u></p>
</div>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">(Q3) I am sorry, if I sound like a broken record player. On each level I request allocation for A[N][N]</span></p>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> Not sure what you mean by this? Call MatMPIAIJSetPreallocation(... N,NULL); where N is the number of columns in the matrix?</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> If so, yes this causes a huge malloc() by PETSc when it allocates the matrix. It is not scalable. Do you have a small upper bound on the number of nonzeros in a row, say 9 or 27? Then use that instead of
N, not perfect but much better than N.</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> Barry</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><u></u> <u></u></p>
</div>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">as the indexes can be scatted anywhere between 1 to N but most are ‘inactive rows’. Is -pc_type<span class="m_-7310754027166719361apple-converted-space"> </span><u>redistribute</u><span class="m_-7310754027166719361apple-converted-space"> </span>the
way to go for me to save on memory? Though I request A[N][N] allocation, and not all rows are active - I wonder if I am wasting a huge amount of memory?</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Kind regards,</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Karthik.</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:Menlo;color:rgb(93,108,121)"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><b><span style="font-size:11pt"> </span></b></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12pt"><b><span style="font-size:12pt">From:<span class="m_-7310754027166719361apple-converted-space"> </span></span></b><span style="font-size:12pt">Barry Smith <</span><a href="mailto:bsmith@petsc.dev" target="_blank"><span style="font-size:12pt;color:purple">bsmith@petsc.dev</span></a><span style="font-size:12pt">><br>
<b>Date:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Monday, 6 February 2023 at 22:42<br>
<b>To:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Chockalingam, Karthikeyan (STFC,DL,HC) <</span><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank"><span style="font-size:12pt;color:purple">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size:12pt">><br>
<b>Cc:<span class="m_-7310754027166719361apple-converted-space"> </span></b></span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:12pt;color:purple">petsc-users@mcs.anl.gov</span></a><span class="m_-7310754027166719361apple-converted-space"><span style="font-size:12pt"> </span></span><span style="font-size:12pt"><</span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:12pt;color:purple">petsc-users@mcs.anl.gov</span></a><span style="font-size:12pt">><br>
<b>Subject:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Re: [petsc-users] Eliminating rows and columns which are zeros</span><u></u><u></u></p>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> Sorry was not clear MatZero*. I just meant MatZeroRows() or MatZeroRowsColumns()</span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:11pt"><br>
<br>
</span><u></u><u></u></p>
</div>
</div>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">On Feb 6, 2023, at 4:45 PM, Karthikeyan Chockalingam - STFC UKRI <</span><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank"><span style="font-size:11pt;color:purple">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size:11pt">>
wrote:</span></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">No problem. I don’t completely follow.</span></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">(Q1) I have used MATMPIAJI but not sure what is MatZero* (star) and what it does? And its relevance to my problem.</span></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">(Q2) Since I am creating a MATMPIAJI system– what would be the best way to insert 0.0 in to ALL diagonals (both active and inactive rows) to begin with?</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> Yes, just have each MPI process loop over its rows and put zero on the diagonal (actually, you could put a 1 if you want). Then have your code use AMReX to </span></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">put all its values in, I am assuming the code uses INSERT_VALUES so it will always overwrite the value you put in initially (hence putting in 1 initially will be fine; the advantage of 1 is if you do not use PCREDISTIBUTE
the matrix is fully defined and so any solver will work. If you know the inactive rows you can just put the diagonal on those since AMReX will fill up the rest of the rows, but it is harmless to put values on all diagonal entries. Do NOT call MatAssemblyBegin/End between filling
the diagonal entries and having AMReX put in its values.</span></p>
</div>
</div>
</div>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">(Q3) If I have to insert 0.0 only into diagonals of “inactive” rows after I have<span class="m_-7310754027166719361apple-converted-space"> </span>put values into the matrix<span class="m_-7310754027166719361apple-converted-space"> </span>would be an
effort. Unless there is a straight forward to do it in PETSc.</span></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">(Q4) For my problem do I need to use PCREDISTIBUTE or any linear solve would eliminate those rows?</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> Well no solver will really make sense if you have "inactive" rows, that is rows with nothing in them except PCREDISTIBUTE. </span></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> When PETSc was written we didn't understand having lots of completely empty rows was a use case so much of the functionality does not work in that case.</span></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:11pt"><br>
<br>
</span><u></u><u></u></p>
</div>
</div>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Best,</span></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Karthik.</span></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12pt"><b><span style="font-size:12pt">From:<span class="m_-7310754027166719361apple-converted-space"> </span></span></b><span style="font-size:12pt">Barry Smith <</span><a href="mailto:bsmith@petsc.dev" target="_blank"><span style="font-size:12pt;color:purple">bsmith@petsc.dev</span></a><span style="font-size:12pt">><br>
<b>Date:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Monday, 6 February 2023 at 20:18<br>
<b>To:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Chockalingam, Karthikeyan (STFC,DL,HC) <</span><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank"><span style="font-size:12pt;color:purple">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size:12pt">><br>
<b>Cc:<span class="m_-7310754027166719361apple-converted-space"> </span></b></span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:12pt;color:purple">petsc-users@mcs.anl.gov</span></a><span class="m_-7310754027166719361apple-converted-space"><span style="font-size:12pt"> </span></span><span style="font-size:12pt"><</span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:12pt;color:purple">petsc-users@mcs.anl.gov</span></a><span style="font-size:12pt">><br>
<b>Subject:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Re: [petsc-users] Eliminating rows and columns which are zeros</span><u></u><u></u></p>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> Sorry, I had a mistake in my thinking, PCREDISTRIBUTE supports completely empty rows but MatZero* does not.</span></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> When you put values into the matrix you will need to insert a 0.0 on the diagonal of each "inactive" row; all of this will be eliminated during the linear solve process. It would be a major project to change
the MatZero* functions to handle empty rows. </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> Barry</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:11pt"><br>
<br>
<br>
<br>
<br>
</span><u></u><u></u></p>
</div>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">On Feb 4, 2023, at 12:06 PM, Karthikeyan Chockalingam - STFC UKRI <</span><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank"><span style="font-size:11pt;color:purple">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size:11pt">>
wrote:</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Thank you very much for offering to debug.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">I built PETSc along with AMReX, so I tried to extract the PETSc code alone which would reproduce the same error on the smallest sized problem possible.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">I have attached three files:</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">petsc_amrex_error_redistribute.txt – The error message from amrex/petsc interface, but THE linear system solves and converges to a solution.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">problem.c – A simple stand-alone petsc code, which produces almost the same error message.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">petsc_ error_redistribute.txt – The error message from problem.c but strangely it does NOT solve – I am not sure why?</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Please use problem.c to debug the issue.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Kind regards,</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Karthik.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12pt"><b><span style="font-size:12pt">From:<span class="m_-7310754027166719361apple-converted-space"> </span></span></b><span style="font-size:12pt">Barry Smith <</span><a href="mailto:bsmith@petsc.dev" target="_blank"><span style="font-size:12pt;color:purple">bsmith@petsc.dev</span></a><span style="font-size:12pt">><br>
<b>Date:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Saturday, 4 February 2023 at 00:22<br>
<b>To:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Chockalingam, Karthikeyan (STFC,DL,HC) <</span><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank"><span style="font-size:12pt;color:purple">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size:12pt">><br>
<b>Cc:<span class="m_-7310754027166719361apple-converted-space"> </span></b></span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:12pt;color:purple">petsc-users@mcs.anl.gov</span></a><span class="m_-7310754027166719361apple-converted-space"><span style="font-size:12pt"> </span></span><span style="font-size:12pt"><</span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:12pt;color:purple">petsc-users@mcs.anl.gov</span></a><span style="font-size:12pt">><br>
<b>Subject:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Re: [petsc-users] Eliminating rows and columns which are zeros</span><u></u><u></u></p>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> If you can help me reproduce the problem with a simple code I can debug the problem and fix it.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> Barry</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:11pt"><br>
<br>
<br>
<br>
<br>
<br>
</span><u></u><u></u></p>
</div>
</div>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">On Feb 3, 2023, at 6:42 PM, Karthikeyan Chockalingam - STFC UKRI <</span><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank"><span style="font-size:11pt;color:purple">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size:11pt">>
wrote:</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">I updated the main branch to the below commit but the same problem persists.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><b><span style="font-size:8.5pt;font-family:Menlo;color:black">[0]PETSC ERROR: Petsc Development GIT revision: v3.18.4-529-g995ec06f92<span class="m_-7310754027166719361apple-converted-space"> </span>GIT Date: 2023-02-03 18:41:48 +0000</span></b></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12pt"><b><span style="font-size:12pt">From:<span class="m_-7310754027166719361apple-converted-space"> </span></span></b><span style="font-size:12pt">Barry Smith <</span><a href="mailto:bsmith@petsc.dev" target="_blank"><span style="font-size:12pt;color:purple">bsmith@petsc.dev</span></a><span style="font-size:12pt">><br>
<b>Date:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Friday, 3 February 2023 at 18:51<br>
<b>To:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Chockalingam, Karthikeyan (STFC,DL,HC) <</span><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank"><span style="font-size:12pt;color:purple">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size:12pt">><br>
<b>Cc:<span class="m_-7310754027166719361apple-converted-space"> </span></b></span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:12pt;color:purple">petsc-users@mcs.anl.gov</span></a><span class="m_-7310754027166719361apple-converted-space"><span style="font-size:12pt"> </span></span><span style="font-size:12pt"><</span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:12pt;color:purple">petsc-users@mcs.anl.gov</span></a><span style="font-size:12pt">><br>
<b>Subject:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Re: [petsc-users] Eliminating rows and columns which are zeros</span><u></u><u></u></p>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> If you switch to use the main branch of petsc </span><a href="https://petsc.org/release/install/download/#advanced-obtain-petsc-development-version-with-git" target="_blank"><span style="font-size:11pt;color:purple">https://petsc.org/release/install/download/#advanced-obtain-petsc-development-version-with-git</span></a><span style="font-size:11pt"> you
will not have the problem below (previously we required that a row exist before we zeroed it but now we allow the row to initially have no entries and still be zeroed.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> Barry</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
<div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">On Feb 3, 2023, at 1:04 PM, Karthikeyan Chockalingam - STFC UKRI <</span><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank"><span style="font-size:11pt;color:purple">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size:11pt">>
wrote:</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Thank you. The entire error output was an attachment in my previous email. I am pasting here for your reference.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">[1;31m[0]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">[0;39m[0;49m[0]PETSC ERROR: Object is in wrong state</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">[0]PETSC ERROR: Matrix is missing diagonal entry in row 0 (65792)</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">[0]PETSC ERROR: WARNING! There are option(s) set that were not used! Could be the program crashed before they were used or a spelling mistake, etc!</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">[0]PETSC ERROR: Option left: name:-options_left (no value)</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">[0]PETSC ERROR: See<span class="m_-7310754027166719361apple-converted-space"> </span></span><a href="https://petsc.org/release/faq/" target="_blank"><span style="font-size:11pt;color:purple">https://petsc.org/release/faq/</span></a><span class="m_-7310754027166719361apple-converted-space"><span style="font-size:11pt"> </span></span><span style="font-size:11pt">for
trouble shooting.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">[0]PETSC ERROR: Petsc Development GIT revision: v3.18.1-127-ga207d08eda GIT Date: 2022-10-30 11:03:25 -0500</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">[0]PETSC ERROR: /Users/karthikeyan.chockalingam/AMReX/amrFEM/build/Debug/amrFEM on a named HC20210312 by karthikeyan.chockalingam Fri Feb 3 11:10:01 2023</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">[0]PETSC ERROR: Configure options --with-debugging=0 --prefix=/Users/karthikeyan.chockalingam/AMReX/petsc --download-fblaslapack=yes --download-scalapack=yes --download-mumps=yes --with-hypre-dir=/Users/karthikeyan.chockalingam/AMReX/hypre/src/hypre</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">[0]PETSC ERROR: #1 MatZeroRowsColumns_SeqAIJ() at /Users/karthikeyan.chockalingam/AMReX/SRC_PKG/petsc/src/mat/impls/aij/seq/aij.c:2218</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">[0]PETSC ERROR: #2 MatZeroRowsColumns() at /Users/karthikeyan.chockalingam/AMReX/SRC_PKG/petsc/src/mat/interface/matrix.c:6085</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">[0]PETSC ERROR: #3 MatZeroRowsColumns_MPIAIJ() at /Users/karthikeyan.chockalingam/AMReX/SRC_PKG/petsc/src/mat/impls/aij/mpi/mpiaij.c:879</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">[0]PETSC ERROR: #4 MatZeroRowsColumns() at /Users/karthikeyan.chockalingam/AMReX/SRC_PKG/petsc/src/mat/interface/matrix.c:6085</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">[0]PETSC ERROR: #5 MatZeroRowsColumnsIS() at /Users/karthikeyan.chockalingam/AMReX/SRC_PKG/petsc/src/mat/interface/matrix.c:6124</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">[0]PETSC ERROR: #6 localAssembly() at /Users/karthikeyan.chockalingam/AMReX/amrFEM/src/FENodalPoisson.cpp:435</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> Residual norms for redistribute_ solve.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> 0 KSP preconditioned resid norm 5.182603110407e+00 true resid norm 1.382027496109e+01 ||r(i)||/||b|| 1.000000000000e+00</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> 1 KSP preconditioned resid norm 1.862430383976e+00 true resid norm 4.966481023937e+00 ||r(i)||/||b|| 3.593619546588e-01</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> 2 KSP preconditioned resid norm 2.132803507689e-01 true resid norm 5.687476020503e-01 ||r(i)||/||b|| 4.115313216645e-02</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> 3 KSP preconditioned resid norm 5.499797533437e-02 true resid norm 1.466612675583e-01 ||r(i)||/||b|| 1.061203687852e-02</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> 4 KSP preconditioned resid norm 2.829814271435e-02 true resid norm 7.546171390493e-02 ||r(i)||/||b|| 5.460217985345e-03</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> 5 KSP preconditioned resid norm 7.431048995318e-03 true resid norm 1.981613065418e-02 ||r(i)||/||b|| 1.433844891652e-03</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> 6 KSP preconditioned resid norm 3.182040728972e-03 true resid norm 8.485441943932e-03 ||r(i)||/||b|| 6.139850305312e-04</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> 7 KSP preconditioned resid norm 1.030867020459e-03 true resid norm 2.748978721225e-03 ||r(i)||/||b|| 1.989091193167e-04</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> 8 KSP preconditioned resid norm 4.469429300003e-04 true resid norm 1.191847813335e-03 ||r(i)||/||b|| 8.623908111021e-05</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> 9 KSP preconditioned resid norm 1.237303313796e-04 true resid norm 3.299475503456e-04 ||r(i)||/||b|| 2.387416685085e-05</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> 10 KSP preconditioned resid norm 5.822094326756e-05 true resid norm 1.552558487134e-04 ||r(i)||/||b|| 1.123391894522e-05</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> 11 KSP preconditioned resid norm 1.735776150969e-05 true resid norm 4.628736402585e-05 ||r(i)||/||b|| 3.349236115503e-06</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> Linear redistribute_ solve converged due to CONVERGED_RTOL iterations 11</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">KSP Object: (redistribute_) 1 MPI process</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> type: cg</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> maximum iterations=10000, initial guess is zero</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> tolerances: relative=1e-05, absolute=1e-50, divergence=10000.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> left preconditioning</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> using PRECONDITIONED norm type for convergence test</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">PC Object: (redistribute_) 1 MPI process</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> type: jacobi</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> type DIAGONAL</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> linear system matrix = precond matrix:</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> Mat Object: 1 MPI process</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> type: mpiaij</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> rows=48896, cols=48896</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> total: nonzeros=307976, allocated nonzeros=307976</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> total number of mallocs used during MatSetValues calls=0</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> not using I-node (on process 0) routines</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">End of program</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> solve time 0.564714744 seconds</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Starting max value is: 0</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Min value of level 0 is: 0</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Interpolated min value is: 741.978761</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Unused ParmParse Variables:</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> [TOP]::model.type(nvals = 1) :: [3]</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> [TOP]::ref_ratio(nvals = 1) :: [2]</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">AMReX (22.10-20-g3082028e4287) finalized</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">#PETSc Option Table entries:</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">-ksp_type preonly</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">-options_left</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">-pc_type redistribute</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">-redistribute_ksp_converged_reason</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">-redistribute_ksp_monitor_true_residual</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">-redistribute_ksp_type cg</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">-redistribute_ksp_view</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">-redistribute_pc_type jacobi</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">#End of PETSc Option Table entries</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">There are no unused options.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Program ended with exit code: 0</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Best,</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Karthik.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12pt"><b><span style="font-size:12pt">From:<span class="m_-7310754027166719361apple-converted-space"> </span></span></b><span style="font-size:12pt">Barry Smith <</span><a href="mailto:bsmith@petsc.dev" target="_blank"><span style="font-size:12pt;color:purple">bsmith@petsc.dev</span></a><span style="font-size:12pt">><br>
<b>Date:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Friday, 3 February 2023 at 17:41<br>
<b>To:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Chockalingam, Karthikeyan (STFC,DL,HC) <</span><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank"><span style="font-size:12pt;color:purple">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size:12pt">><br>
<b>Cc:<span class="m_-7310754027166719361apple-converted-space"> </span></b></span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:12pt;color:purple">petsc-users@mcs.anl.gov</span></a><span class="m_-7310754027166719361apple-converted-space"><span style="font-size:12pt"> </span></span><span style="font-size:12pt"><</span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:12pt;color:purple">petsc-users@mcs.anl.gov</span></a><span style="font-size:12pt">><br>
<b>Subject:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Re: [petsc-users] Eliminating rows and columns which are zeros</span><u></u><u></u></p>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> We need all the error output for the errors you got below to understand why the errors are happening.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:11pt"><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">On Feb 3, 2023, at 11:41 AM, Karthikeyan Chockalingam - STFC UKRI <</span><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank"><span style="font-size:11pt;color:purple">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size:11pt">>
wrote:</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Hello Barry,</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">I would like to better understand<span class="m_-7310754027166719361apple-converted-space"> </span>pc_type redistribute usage.<span class="m_-7310754027166719361apple-converted-space"> </span></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">I am plan to use pc_type<span class="m_-7310754027166719361apple-converted-space"> </span><u>redistribute</u><span class="m_-7310754027166719361apple-converted-space"> </span>in the context of adaptive mesh refinement on a structured grid in 2D. My
base mesh (level 0) is indexed from 0 to N-1 elements and refined mesh (level 1) is indexed from 0 to 4(N-1) elements. When I construct system matrix A on (level 1); I probably only use 20% of 4(N-1) elements, however the indexes are scattered in the range
of 0 to 4(N-1). That leaves 80% of the rows and columns of the system matrix A on (level 1) to be zero. From your earlier response, I believe this would be a use case for petsc_type redistribute.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> Indeed the linear solve will be more efficient if you use the redistribute solver. </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:11pt"> But I don't understand your plan. With adaptive refinement I would just create the two matrices, one for the initial grid on which you solve the system, this will be a smaller
matrix and then create a new larger matrix for the refined grid (and discard the previous matrix).<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Question (1)</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">If N is really large, I would have to allocate memory of size 4(N-1) for the system matrix A on (level 1). How does pc_type redistribute<span class="m_-7310754027166719361apple-converted-space"><u> </u></span>help? Because, I did
end up allocating memory for a large system, where most of the rows and columns are zeros. Is most of the allotted memory not wasted?<span class="m_-7310754027166719361apple-converted-space"><u> </u></span><u>Is this the correct usage?</u></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:11pt"> See above<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Question (2)</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">I tried using pc_type redistribute for a two level system.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">I have<span class="m_-7310754027166719361apple-converted-space"> </span><b><u>attached</u></b><span class="m_-7310754027166719361apple-converted-space"> </span>the output only for (level 1)</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">The solution converges to right solution but still petsc outputs some error messages.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">[0]PETSC ERROR: WARNING! There are option(s) set that were not used! Could be the program crashed before they were used or a spelling mistake, etc!</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">[0]PETSC ERROR: Option left: name:-options_left (no value)</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">But the there were no unused options</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">#PETSc Option Table entries:</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">-ksp_type preonly</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">-options_left</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">-pc_type redistribute</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">-redistribute_ksp_converged_reason</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">-redistribute_ksp_monitor_true_residual</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">-redistribute_ksp_type cg</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">-redistribute_ksp_view</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">-redistribute_pc_type jacobi</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">#End of PETSc Option Table entries</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><b><span style="font-size:11pt">There are no unused options.</span></b></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Program ended with exit code: 0</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"> </p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:11pt">I cannot explain this<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><br>
Question (2)</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11pt;color:black">[0;39m[0;49m[0]PETSC ERROR: Object is in wrong state</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:11pt;color:black">[0]PETSC ERROR: Matrix is missing diagonal entry in row 0 (65792)</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">What does this error message imply? Given I only use 20% of 4(N-1) indexes, I can imagine most of the diagonal entrees are zero.<span class="m_-7310754027166719361apple-converted-space"> </span><u>Is my understanding correct?</u></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:11pt">Question (3)<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:Menlo;color:black">[0]PETSC ERROR: #5 MatZeroRowsColumnsIS() at /Users/karthikeyan.chockalingam/AMReX/SRC_PKG/petsc/src/mat/interface/matrix.c:6124</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:Menlo;color:black"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">I am using MatZeroRowsColumnsIS to set the homogenous Dirichelet boundary. I don’t follow why I get this error message as the linear system converges to the right solution.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Thank you for your help.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Kind regards,</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Karthik.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:8.5pt;font-family:Menlo;color:black"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12pt"><b><span style="font-size:12pt">From:<span class="m_-7310754027166719361apple-converted-space"> </span></span></b><span style="font-size:12pt">Barry Smith <</span><a href="mailto:bsmith@petsc.dev" target="_blank"><span style="font-size:12pt;color:purple">bsmith@petsc.dev</span></a><span style="font-size:12pt">><br>
<b>Date:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Tuesday, 10 January 2023 at 18:50<br>
<b>To:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Chockalingam, Karthikeyan (STFC,DL,HC) <</span><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank"><span style="font-size:12pt;color:purple">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size:12pt">><br>
<b>Cc:<span class="m_-7310754027166719361apple-converted-space"> </span></b></span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:12pt;color:purple">petsc-users@mcs.anl.gov</span></a><span class="m_-7310754027166719361apple-converted-space"><span style="font-size:12pt"> </span></span><span style="font-size:12pt"><</span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:12pt;color:purple">petsc-users@mcs.anl.gov</span></a><span style="font-size:12pt">><br>
<b>Subject:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Re: [petsc-users] Eliminating rows and columns which are zeros</span><u></u><u></u></p>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> Yes, after the solve the x will contain correct values for ALL the locations including the (zeroed out rows). You use case is exactly what redistribute it for.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> Barry</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:11pt"><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">On Jan 10, 2023, at 11:25 AM, Karthikeyan Chockalingam - STFC UKRI <</span><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank"><span style="font-size:11pt;color:purple">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size:11pt">>
wrote:</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Thank you Barry. This is great!</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">I plan to solve using ‘-pc_type redistribute’ after applying the Dirichlet bc using</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span class="m_-7310754027166719361s1"><span style="font-size:9pt;font-family:Menlo;color:rgb(108,54,169)">MatZeroRowsColumnsIS</span></span><span style="font-size:9pt;font-family:Menlo;color:black">(</span><span class="m_-7310754027166719361s2"><span style="font-size:9pt;font-family:Menlo;color:rgb(50,109,116)">A</span></span><span style="font-size:9pt;font-family:Menlo;color:black">,<span class="m_-7310754027166719361apple-converted-space"> </span></span><span class="m_-7310754027166719361s2"><span style="font-size:9pt;font-family:Menlo;color:rgb(50,109,116)">isout</span></span><span style="font-size:9pt;font-family:Menlo;color:black">,<span class="m_-7310754027166719361apple-converted-space"> </span></span><span class="m_-7310754027166719361s3"><span style="font-size:9pt;font-family:Menlo;color:rgb(28,0,207)">1</span></span><span style="font-size:9pt;font-family:Menlo;color:black">,<span class="m_-7310754027166719361apple-converted-space"> </span></span><span class="m_-7310754027166719361s2"><span style="font-size:9pt;font-family:Menlo;color:rgb(50,109,116)">x</span></span><span style="font-size:9pt;font-family:Menlo;color:black">,<span class="m_-7310754027166719361apple-converted-space"> </span></span><span class="m_-7310754027166719361s2"><span style="font-size:9pt;font-family:Menlo;color:rgb(50,109,116)">b)</span></span><span style="font-size:9pt;font-family:Menlo;color:black">;<span class="m_-7310754027166719361apple-converted-space"> </span></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9pt;font-family:Menlo;color:black"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">While I retrieve the solution data from x (after the solve) – can I index them using the original ordering (if I may say that)?</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Kind regards,</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Karthik.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(181,196,223);padding:3pt 0cm 0cm">
<p class="MsoNormal" style="margin-bottom:12pt"><b><span style="font-size:12pt">From:<span class="m_-7310754027166719361apple-converted-space"> </span></span></b><span style="font-size:12pt">Barry Smith <</span><a href="mailto:bsmith@petsc.dev" target="_blank"><span style="font-size:12pt;color:purple">bsmith@petsc.dev</span></a><span style="font-size:12pt">><br>
<b>Date:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Tuesday, 10 January 2023 at 16:04<br>
<b>To:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Chockalingam, Karthikeyan (STFC,DL,HC) <</span><a href="mailto:karthikeyan.chockalingam@stfc.ac.uk" target="_blank"><span style="font-size:12pt;color:purple">karthikeyan.chockalingam@stfc.ac.uk</span></a><span style="font-size:12pt">><br>
<b>Cc:<span class="m_-7310754027166719361apple-converted-space"> </span></b></span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:12pt;color:purple">petsc-users@mcs.anl.gov</span></a><span class="m_-7310754027166719361apple-converted-space"><span style="font-size:12pt"> </span></span><span style="font-size:12pt"><</span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:12pt;color:purple">petsc-users@mcs.anl.gov</span></a><span style="font-size:12pt">><br>
<b>Subject:<span class="m_-7310754027166719361apple-converted-space"> </span></b>Re: [petsc-users] Eliminating rows and columns which are zeros</span><u></u><u></u></p>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><a href="https://petsc.org/release/docs/manualpages/PC/PCREDISTRIBUTE/#pcredistribute" target="_blank"><span style="font-size:11pt;color:purple">https://petsc.org/release/docs/manualpages/PC/PCREDISTRIBUTE/#pcredistribute</span></a><span style="font-size:11pt">
-pc_type redistribute</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">It does everything for you. Note that if the right hand side for any of the "zero" rows is nonzero then the system is inconsistent and the system does not have a solution.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Barry</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12pt"><span style="font-size:11pt"><br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</span><u></u><u></u></p>
</div>
</div>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">On Jan 10, 2023, at 10:30 AM, Karthikeyan Chockalingam - STFC UKRI via petsc-users <</span><a href="mailto:petsc-users@mcs.anl.gov" target="_blank"><span style="font-size:11pt;color:purple">petsc-users@mcs.anl.gov</span></a><span style="font-size:11pt">>
wrote:</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Hello,</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">I am assembling a MATIJ of size N, where a very large number of rows (and corresponding columns), are zeros. I would like to potentially eliminate them before the solve.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">For instance say N=7</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9pt;font-family:Menlo;color:rgb(93,108,121)">0 0<span class="m_-7310754027166719361apple-converted-space"> </span>0<span class="m_-7310754027166719361apple-converted-space"> </span>0 0 0 0</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9pt;font-family:Menlo;color:rgb(93,108,121)">0 1 -1<span class="m_-7310754027166719361apple-converted-space"> </span>0 0 0 0</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9pt;font-family:Menlo;color:rgb(93,108,121)">0 -1 2<span class="m_-7310754027166719361apple-converted-space"> </span>0 0 0 -1</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9pt;font-family:Menlo;color:rgb(93,108,121)">0 0<span class="m_-7310754027166719361apple-converted-space"> </span>0<span class="m_-7310754027166719361apple-converted-space"> </span>0 0 0 0</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9pt;font-family:Menlo;color:rgb(93,108,121)">0 0<span class="m_-7310754027166719361apple-converted-space"> </span>0<span class="m_-7310754027166719361apple-converted-space"> </span>0 0 0 0</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9pt;font-family:Menlo;color:rgb(93,108,121)">0 0<span class="m_-7310754027166719361apple-converted-space"> </span>0<span class="m_-7310754027166719361apple-converted-space"> </span>0 0 0 0</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-size:9pt;font-family:Menlo;color:rgb(93,108,121)">0 0<span class="m_-7310754027166719361apple-converted-space"> </span>-1 0 0 0 1</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">I would like to reduce it to a 3x3</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">1 -1 0</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">-1 2 -1</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">0 -1 1</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">I do know the size N.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Q1) How do I do it?</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Q2) Is it better to eliminate them as it would save a lot of memory?</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Q3) At the moment, I don’t know which rows (and columns) have the zero entries but with some effort I probably can find them. Should I know which rows (and columns) I am eliminating?</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Thank you.</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt">Karthik.</span><u></u><u></u></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<p style="font-variant-caps:normal;text-align:start;word-spacing:0px">
<span style="font-size:6pt;font-family:Helvetica">This email and any attachments are intended solely for the use of the named recipients. If you are not the intended recipient you must not use, disclose, copy or distribute this email or any of its attachments<span class="m_-7310754027166719361apple-converted-space"> </span>and
should notify the sender immediately and delete this email from your system. UK Research and Innovation (UKRI) has taken every reasonable precaution to minimise risk of this email or any attachments containing viruses or malware but the recipient should carry
out its own virus and malware checks before opening the attachments. UKRI does not accept any liability for any losses or damages which the recipient may sustain due to presence of any viruses. </span><span style="font-size:13.5pt;font-family:Helvetica"><u></u><u></u></span></p>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><petsc_redistribute.txt></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
</div>
</div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><petsc_error_redistribute.txt><petsc_amrex_error_redistribute.txt><problem.c></span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"> </span></p>
</div>
</div>
</div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:11pt"><adaptive_mesh_level.png></span></p>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><span style="font-size:11pt"><u></u> <u></u></span></p>
</div>
</div>
</div></blockquote></div><br clear="all"><div><br></div>-- <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>