<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>Hi Hong,</div>
<div> </div>
<div>Yes exactly, I would like C2 to maintain the local number of A. Do you think this is possible? I tried to allocated A before with the correct local number and use MAT_REUSE but this gave a segmentation fault.</div>
<div> </div>
<div>Best</div>
<div>Marius </div>
<div>
<div>
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
<div style="margin:0 0 10px 0;"> </div>
<div name="quoted-content"><!--P {
margin-top: 0;
margin-bottom: 0;
}
-->
<div>
<div style="font-family: Calibri , Arial , Helvetica , sans-serif;font-size: 12.0pt;color: rgb(0,0,0);"><span style="color: rgb(50,49,48);background-color: rgb(255,255,255);display: inline;">Marius,</span></div>
<div style="font-family: Calibri , Arial , Helvetica , sans-serif;font-size: 12.0pt;color: rgb(0,0,0);"><span style="color: rgb(50,49,48);background-color: rgb(255,255,255);display: inline;">C1 = Ampidense*Bmpiaij <span style="background-color: rgb(255,255,255);display: inline;">inherits the number of local rows from A and the number of local columns from B.</span></span></div>
<div style="font-family: Calibri , Arial , Helvetica , sans-serif;font-size: 12.0pt;color: rgb(0,0,0);"><span style="color: rgb(50,49,48);background-color: rgb(255,255,255);display: inline;"><span style="background-color: rgb(255,255,255);display: inline;">C2 = Ampidense*Bmpidense is computed via external package Elemental, which petsc does not dictate the parallel layout of C2 in current petsc/elemental interface. I am not sure if we can do it. Do you want C2 maintains local number of A?</span></span></div>
<div style="font-family: Calibri , Arial , Helvetica , sans-serif;font-size: 12.0pt;color: rgb(0,0,0);"><span style="color: rgb(50,49,48);background-color: rgb(255,255,255);display: inline;"><span style="background-color: rgb(255,255,255);display: inline;">Hong</span></span></div>
<div id="appendonsend"> </div>
<div style="font-family: Calibri , Arial , Helvetica , sans-serif;font-size: 12.0pt;color: rgb(0,0,0);"> </div>
<hr style="display: inline-block;width: 98.0%;"/>
<div id="divRplyFwdMsg"><font color="#000000" face="Calibri, sans-serif" style="font-size: 11.0pt;"><b>From:</b> petsc-users <petsc-users-bounces@mcs.anl.gov> on behalf of Stefano Zampini <stefano.zampini@gmail.com><br/>
<b>Sent:</b> Sunday, April 19, 2020 11:26 AM<br/>
<b>To:</b> Marius Buerkle <mbuerkle@web.de><br/>
<b>Cc:</b> PETSc users list <petsc-users@mcs.anl.gov><br/>
<b>Subject:</b> Re: [petsc-users] MatMatMult with MAT_INITIAL_MATRIX</font>
<div> </div>
</div>
<div>
<div>
<div>Matrix C should always inherit the number of local rows from A and the number of local columns from B. Is it not the case for your code? If so, please provide a MWE to reproduce<br/>
Also, which version of PETSc are you using?</div>
<div>
<div class="x_gmail_quote">
<div class="x_gmail_attr">Il Dom 19 Apr 2020, 19:21 Marius Buerkle <<a href="mailto:mbuerkle@web.de" onclick="parent.window.location.href='mailto:mbuerkle@web.de'; return false;" target="_blank">mbuerkle@web.de</a>> ha scritto:</div>
<blockquote class="x_gmail_quote" style="margin: 0 0 0 0.8ex;border-left: 1.0px rgb(204,204,204) solid;padding-left: 1.0ex;"><br/>
Hi,<br/>
<br/>
I have a question about the behavior of MAT_INITIAL_MATRIX for MatMatMult. I a have a set of MPIDENSE and MPIAIJ matrices for which I have defined the number of local rows (and local columns) manually, i.e. not used PETSC_DECIDE for MatSetSizes. The number of local rows is different from what PETSC_DECIDE would choose. If I do a MatMatMult with A=MPIDENSE and B=MPIAIJ with MAT_INITIAL_MATRIX then matrix C will have the number of local rows corresponding to A and B, namely what I have defined with MatSetSizes when creating the matrices A and B. But when both matrices are dense, A=MPIDENSE and B=MPIDENSE, then the resulting matrix C will have different number of local rows, namely what I would get with if I would create the matrix with PETSC_DECIDE. Is this behavior normal? The problem is that I have to multiply both resulting matrices which will then throw a "Nonconforming object sizes error" as they have different number of local rows. Any ideas what goes wrong here?<br/>
<br/>
<br/>
Marius</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div></div></body></html>