<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
I would suggest avoiding using SBAIJ matrices, at least in the phase of application code development. We implemented <span style="display: inline !important; background-color: rgb(255, 255, 255);" class="ContentPasted0">SBAIJ<span class="ContentPasted0"> for
saving storage, not computational efficiency. SBAIJ does not have as many support as AIJ. After your code works for AIJ, then you may consider taking advantage of smaller storage of SBAIJ (could at cost of communication overhead).</span></span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);" class="elementToProof">
<span style="display: inline !important; background-color: rgb(255, 255, 255);" class="ContentPasted0"><span class="ContentPasted0">Hong</span></span></div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> petsc-users <petsc-users-bounces@mcs.anl.gov> on behalf of Pierre Jolivet via petsc-users <petsc-users@mcs.anl.gov><br>
<b>Sent:</b> Saturday, August 26, 2023 10:20 AM<br>
<b>To:</b> Carl-Johan Thore <carl-johan.thore@liu.se><br>
<b>Cc:</b> petsc-users <petsc-users@mcs.anl.gov><br>
<b>Subject:</b> Re: [petsc-users] PCFIELDSPLIT with MATSBAIJ</font>
<div> </div>
</div>
<div style="line-break:after-white-space"><br>
<div><br>
<blockquote type="cite">
<div>On 27 Aug 2023, at 12:14 AM, Carl-Johan Thore <carl-johan.thore@liu.se> wrote:</div>
<br class="x_Apple-interchange-newline">
<div>
<div class="x_WordSection1" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif">“Well, your A00 and A11 will possibly be SBAIJ also, so you’ll end up with the same issue.”</div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif">I’m not sure I follow. Does PCFIELDSPLIT extract further submatrices from these blocks, or is there</div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif">somewhere else in the code that things will go wrong?</div>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>Ah, no, you are right, in that case it should work.</div>
<br>
<blockquote type="cite">
<div class="x_WordSection1" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif">For the MATNEST I was thinking to get some savings from the block-symmetry at least</div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif">even if symmetry in A00 and A11 cannot be exploited; using SBAIJ for them would just be a</div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif">(pretty big) bonus.</div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif"> </div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif">“I’ll rebase on top of main and try to get it integrated if it could be useful to you (but I’m traveling</div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif">right now so everything gets done more slowly, sorry).”</div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif">Sound great, Thanks again!</div>
</div>
</blockquote>
<div><br>
</div>
<div>The MR is there <a href="https://gitlab.com/petsc/petsc/-/merge_requests/6841">https://gitlab.com/petsc/petsc/-/merge_requests/6841</a>.</div>
<div>I need to add a new code path in MatCreateRedundantMatrix() to make sure the resulting Mat is indeed SBAIJ, but that is orthogonal to the PCFIELDSPLIT issue.</div>
<div>The branch should be usable in its current state.</div>
<div><br>
</div>
<div>Thanks,</div>
<div>Pierre</div>
<div><br>
</div>
<blockquote type="cite">
<div class="x_WordSection1" style="font-family:Helvetica; font-size:12px; font-style:normal; font-variant-caps:normal; font-weight:400; letter-spacing:normal; text-align:start; text-indent:0px; text-transform:none; white-space:normal; word-spacing:0px; text-decoration:none">
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif"> </div>
<div>
<div style="border-width:1pt medium medium; border-style:solid none none; border-color:rgb(225,225,225) currentcolor currentcolor; padding:3pt 0cm 0cm">
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif"><b>From:</b><span class="x_Apple-converted-space"> </span>Pierre Jolivet <pierre.jolivet@lip6.fr><span class="x_Apple-converted-space"> </span><br>
<b>Sent:</b><span class="x_Apple-converted-space"> </span>Saturday, August 26, 2023 4:36 PM<br>
<b>To:</b><span class="x_Apple-converted-space"> </span>Carl-Johan Thore <carl-johan.thore@liu.se><br>
<b>Cc:</b><span class="x_Apple-converted-space"> </span>Carl-Johan Thore <carljohanthore@gmail.com>; petsc-users@mcs.anl.gov<br>
<b>Subject:</b><span class="x_Apple-converted-space"> </span>Re: [petsc-users] PCFIELDSPLIT with MATSBAIJ</div>
</div>
</div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif"> </div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif"> </div>
<div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif"><br>
<br>
</div>
<blockquote style="margin-top:5pt; margin-bottom:5pt">
<div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif">On 26 Aug 2023, at 11:16 PM, Carl-Johan Thore <<a href="mailto:carl-johan.thore@liu.se" style="color:blue; text-decoration:underline">carl-johan.thore@liu.se</a>> wrote:</div>
</div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif"> </div>
<div>
<div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif">"(Sadly) MATSBAIJ is extremely broken, in particular, it cannot be used to retrieve rectangular blocks in MatCreateSubMatrices, thus you cannot get the A01 and A10 blocks in PCFIELDSPLIT.<br>
I have a branch that fixes this, but I haven’t rebased in a while (and I’m AFK right now), would you want me to rebase and give it a go, or must you stick to a release tarball?"<br>
<br>
Ok, would be great if you could look at this! I don't need to stick to any particular branch.<br>
<br>
Do you think MATNEST could be an alternative here?</div>
</div>
</div>
</blockquote>
<div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif"> </div>
</div>
<div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif">Well, your A00 and A11 will possibly be SBAIJ also, so you’ll end up with the same issue.</div>
</div>
<div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif">I’m using both approaches (monolithic SBAIJ or Nest + SBAIJ), it was crashing but I think it was thoroughly fixed in <a href="https://gitlab.com/petsc/petsc/-/commits/jolivet/feature-matcreatesubmatrices-rectangular-sbaij/" style="color:blue; text-decoration:underline">https://gitlab.com/petsc/petsc/-/commits/jolivet/feature-matcreatesubmatrices-rectangular-sbaij/</a></div>
</div>
<div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif">It is ugly code on top of ugly code, so I didn’t try to get it integrated and just used the branch locally, and then moved to some other stuff.</div>
</div>
<div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif">I’ll rebase on top of main and try to get it integrated if it could be useful to you (but I’m traveling right now so everything gets done more slowly, sorry).</div>
</div>
<div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif"> </div>
</div>
<div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif">Thanks,</div>
</div>
<div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif">Pierre</div>
</div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif"><br>
<br>
</div>
<blockquote style="margin-top:5pt; margin-bottom:5pt">
<div>
<div>
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif">My matrix is<br>
[A00 A01;<br>
A01^t A11]<br>
so perhaps with MATNEST I can make use of the block-symmetry at least, and then use MATSBAIJ for<span class="x_Apple-converted-space"> </span><br>
A00 and A11 if it's possible to combine matrix types which the manual seems to imply.<span class="x_Apple-converted-space"> </span><br>
<br>
Kind regards<br>
Carl-Johan<br>
<br>
<br>
<br>
</div>
<blockquote style="margin-top:5pt; margin-bottom:5pt">
<div style="margin:0cm; font-size:11pt; font-family:Calibri,sans-serif">On 26 Aug 2023, at 10:09 PM, Carl-Johan Thore <<a href="mailto:carljohanthore@gmail.com" style="color:blue; text-decoration:underline">carljohanthore@gmail.com</a>> wrote:<br>
<br>
Hi,<br>
<br>
I'm trying to use PCFIELDSPLIT with MATSBAIJ in PETSc 3.19.4.<span class="x_Apple-converted-space"> </span><br>
According to the manual "[t]he fieldsplit preconditioner cannot<span class="x_Apple-converted-space"> </span><br>
currently be used with the MATBAIJ or MATSBAIJ data formats if the<span class="x_Apple-converted-space"> </span><br>
blocksize is larger than 1". Since my blocksize is exactly 1 it would seem that I can use PCFIELDSPLIT. But this fails with "PETSC ERROR: For symmetric format, iscol must equal isrow"<br>
from MatCreateSubMatrix_MPISBAIJ. Tracing backwards one ends up in<span class="x_Apple-converted-space"> </span><br>
fieldsplit.c at<br>
<br>
/* extract the A01 and A10 matrices */ ilink = jac->head;<span class="x_Apple-converted-space"> </span><br>
PetscCall(ISComplement(ilink->is_col, rstart, rend, &ccis)); if<span class="x_Apple-converted-space"> </span><br>
(jac->offdiag_use_amat) { PetscCall(MatCreateSubMatrix(pc->mat,<span class="x_Apple-converted-space"> </span><br>
ilink->is, ccis, MAT_INITIAL_MATRIX, &jac->B)); } else {<br>
PetscCall(MatCreateSubMatrix(pc->pmat, ilink->is, ccis,<span class="x_Apple-converted-space"> </span><br>
MAT_INITIAL_MATRIX, &jac->B)); }<br>
<br>
This, since my A01 and A10 are not square, seems to explain why iscol is not equal to isrow.<br>
From this I gather that it is in general NOT possible to use<span class="x_Apple-converted-space"> </span><br>
PCFIELDSPLIT with MATSBAIJ even with block size 1?<br>
<br>
Kind regards,<br>
Carl-Johan</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</body>
</html>