[petsc-users] MatMatMult with MAT_INITIAL_MATRIX

Zhang, Hong hzhang at mcs.anl.gov
Sun Apr 19 21:13:34 CDT 2020


Marius,
I'll test it tomorrow.
Hong
________________________________
From: Marius Buerkle <mbuerkle at web.de>
Sent: Sunday, April 19, 2020 7:47 PM
To: Zhang, Hong <hzhang at mcs.anl.gov>
Cc: Stefano Zampini <stefano.zampini at gmail.com>; PETSc users list <petsc-users at mcs.anl.gov>
Subject: Aw: Re: [petsc-users] MatMatMult with MAT_INITIAL_MATRIX

Hi Hong,

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.

Best
Marius


Marius,
C1 = Ampidense*Bmpiaij inherits the number of local rows from A and the number of local columns from B.
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?
Hong


________________________________
From: petsc-users <petsc-users-bounces at mcs.anl.gov> on behalf of Stefano Zampini <stefano.zampini at gmail.com>
Sent: Sunday, April 19, 2020 11:26 AM
To: Marius Buerkle <mbuerkle at web.de>
Cc: PETSc users list <petsc-users at mcs.anl.gov>
Subject: Re: [petsc-users] MatMatMult with MAT_INITIAL_MATRIX

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
Also, which version of PETSc are you using?

Il Dom 19 Apr 2020, 19:21 Marius Buerkle <mbuerkle at web.de<mailto:mbuerkle at web.de>> ha scritto:

Hi,

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?


Marius
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200420/077515a0/attachment.html>


More information about the petsc-users mailing list