[petsc-users] MatMatMult

Emmanuel Ayala juaneah at gmail.com
Wed Feb 26 23:38:20 CST 2020


Hi everyone,

Recently I installed the PETSc version 3.12.4 in optimized mode:

./configure --with-debugging=0 COPTFLAGS='-O2 -march=native -mtune=native'
CXXOPTFLAGS='-O2 -march=native -mtune=native' FOPTFLAGS='-O2 -march=native
-mtune=native' --download-mpich=1 --download-fblaslapack=1
--with-cxx-dialect=C++11

When I perform MatMatMult(A,B,MAT_REUSE_MATRIX,PETSC_DEFAULT,&C), for
sparse A and dense B matrices, then:

In the special case where matrix B (and hence C) are dense you can create
the correctly sized matrix C yourself and then call this routine with
MAT_REUSE_MATRIX
<https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatReuse.html#MatReuse>,
rather than first having MatMatMult
<https://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Mat/MatMatMult.html#MatMatMult>()
create it for you. You can NEVER do this if the matrix C is sparse.

So, for these new release 3.12.4, if you create C as a dense matrix it is
necessary to apply a MatAssemblyBegin() and MatAssemblyEnd() after the
matrix multiplication, other wise it's not possible to perform further
operations.

It does not happen in the 3.11.3 version, where MatAssembly after
multiplication it's not necessary.

Kind regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200226/268949ee/attachment.html>


More information about the petsc-users mailing list