<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">And MKL has the same issues for dense , see for example here <a href="https://gitlab.com/petsc/petsc/-/blob/master/src/mat/impls/dense/seq/dense.c#L2186" class="">https://gitlab.com/petsc/petsc/-/blob/master/src/mat/impls/dense/seq/dense.c#L2186</a><br class=""><div>If A is 0x8 and B is 8x5 then C is correct to be of size 0x5. The rows and columns of the resulting matrix have to follow the rules.</div><div><br class=""></div><div><br class=""><blockquote type="cite" class=""><div class="">On May 31, 2020, at 12:54 AM, Mark Adams <<a href="mailto:mfadams@lbl.gov" class="">mfadams@lbl.gov</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Failing for empty matrices sucks of MKL.<div class="">I don't know of any reason that we care how many columns are in a matrix with no rows. I see no reason not to let it stay the way it is, that is with the number of columns that it should have if it had rows.</div><div class="">I would vote for just doing what you need to do to get the test suite to pass and have a MKL test with zero rows. </div><div class="">A GAMG test should give you an empty local marix on the coarse grid on rank != 0.</div></div><br class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, May 30, 2020 at 2:07 PM Mills, Richard Tran via petsc-dev <<a href="mailto:petsc-dev@mcs.anl.gov" class="">petsc-dev@mcs.anl.gov</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="">
All,<br class="">
<br class="">
I'm working on adding support for matrix products to AIJMKL, and I'm uncertain about some issues surrounding empty matrices. PETSc will happily let me multiply an empty matrix with another (and this arises in the sequential matrix-matrix multiplication routines
when running with multiple MPI ranks and using MPIAIJ), but MKL does not like empty matrices (or matrices with no nonzeros), so I've got code in various places in the existing AIJMKL routines to handle these cases without calling MKL.<br class="">
<br class="">
I'm not quite sure what needs to be done in, say, MatMatMultSymbolic_SeqAIJMKL_SeqAIJMKL(). In the SeqAIJ version, if a matrix A is passed in that has zero rows (that is, A->rmap->N = 0), and matrix B has N columns (B->cmap->N = N), then a matrix C with zero
rows and N columns is created. My question boils down to "Does it mean anything in PETSc to have a matrix with 0 rows but a nonzero number of columns"? It is less complicated if I handle the empty matrix cases by creating a matrix with 0 rows and 0 columns,
but I am not sure if this breaks something. (I'm also not sure what a "matrix" with 0 rows even means.) Also not sure if there is any other info that I need to preserve in the result matrix C, of if it is OK to handle the case of any empty A or B by always
producing the same empty matrix C.<br class="">
<br class="">
--Richard<br class="">
</div>
</blockquote></div>
</div></blockquote></div><br class=""></body></html>