<div dir="auto"><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 dir="auto"><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">Il Dom 19 Apr 2020, 19:21 Marius Buerkle <<a href="mailto:mbuerkle@web.de">mbuerkle@web.de</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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<br>
</blockquote></div></div></div>