[petsc-dev] MatMatMult

Hong hzhang at mcs.anl.gov
Tue Jun 6 10:57:10 CDT 2017


> Hello,
> I'm implementing MatMatMult for A of type MPIBAIJ, B and C of type
> 1) I copied around some code for the case where A is of type MPIAIJ. Any
> reason why communications and computations are not overlapped in the
> MatMatMult implementation? http://www.mcs.anl.gov/petsc/p
> etsc-current/src/mat/impls/aij/mpi/mpimatmatmult.c.html#line556

Do you mean overlapping
MPI_Isend()/MPI_Waitany() in MatMPIDenseScatter()
with local call MatMatMultNumeric_SeqAIJ_SeqDense() ?

I guess you can implement overlapping. If it gives better performance, you
can improve MatMatMultNumeric_MPIAIJ_MPIDense().

> 2) I'm having trouble when scall == MAT_REUSE_MATRIX. Here,
> http://www.mcs.anl.gov/petsc/petsc-current/src/mat/impls/den
> se/mpi/mpidense.c.html#line1208 it looks that the numeric part of the
> MatMatMult (which is called when scall == MAT_REUSE_MATRIX) is hardwired to
> this routine http://www.mcs.anl.gov/petsc/petsc-current/src/mat/impls/aij
> /mpi/mpimatmatmult.c.html#line376.

Thus, at runtime, this call fails http://www.mcs.anl.gov/petsc/p
> etsc-current/src/mat/interface/matrix.c.html#line9492 because it is
> trying to cast a matrix to Mat_MPIAIJ instead of Mat_MPIBAIJ. Any chance
> you could let me know how to dispatch the call (*(*C)->ops->matmultnumeric)
> to the proper implementation (depending on the type of A)?

You define
(*C)->ops->matmultnumeric = MatMatMultNumeric_MPIBAIJ_MPIDense;
 in your MatMatMultSymbolic_MPIBAIJ_MPIDense

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20170606/db0a62b3/attachment.html>

More information about the petsc-dev mailing list