[petsc-dev] Broken MatMatMult_MPIAIJ_MPIDense

Pierre Jolivet pierre.jolivet at enseeiht.fr
Sun Sep 22 01:03:56 CDT 2019


Jed,
I’m not sure how easy it is to put more than a few lines of code on GitLab, so I’ll just send the (tiny) source here, as a follow-up of our discussion https://gitlab.com/petsc/petsc/merge_requests/2069#note_220229648 <https://gitlab.com/petsc/petsc/merge_requests/2069#note_220229648>.
Please find attached a .cpp showing the brokenness of C=A*B with A of type MPIAIJ and B of type MPIDense when the LDA of B is not equal to its number of local rows.
It does [[1,1];[1,1]] * [[0,1,2,3];[0,1,2,3]]
C should be equal to 2*B, but it’s not, unless lda = m (= 1).
Mat Object: 2 MPI processes
  type: mpidense
0.0000000000000000e+00 1.0000000000000000e+00 2.0000000000000000e+00 3.0000000000000000e+00
0.0000000000000000e+00 1.0000000000000000e+00 2.0000000000000000e+00 3.0000000000000000e+00

If you change Bm here https://www.mcs.anl.gov/petsc/petsc-dev/src/mat/impls/aij/mpi/mpimatmatmult.c.html#line549 <https://www.mcs.anl.gov/petsc/petsc-dev/src/mat/impls/aij/mpi/mpimatmatmult.c.html#line549> to the LDA of B, you’ll get the correct result.
Mat Object: 2 MPI processes
  type: mpidense
0.0000000000000000e+00 2.0000000000000000e+00 4.0000000000000000e+00 6.0000000000000000e+00
0.0000000000000000e+00 2.0000000000000000e+00 4.0000000000000000e+00 6.0000000000000000e+00

Unfortunately, w.r.t. MR 2069, I still don’t get the same results with a plain view LDA > m (KO) and a view + duplicate LDA = m (OK).
So there might be something else to fix (or this might not even be a correct fix), but the only reproducer I have right now is the full solver.

Thanks,
Pierre

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20190922/73705eff/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: matmatmult.cpp
Type: application/octet-stream
Size: 1545 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20190922/73705eff/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20190922/73705eff/attachment-0001.html>


More information about the petsc-dev mailing list