Pierre: > Hello, > I'm implementing MatMatMult for A of type MPIBAIJ, B and C of type > MPIDENSE. > 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 Hong
