<div dir="ltr">Failing for empty matrices sucks of MKL.<div>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>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>A GAMG test should give you an empty local marix on the coarse grid on rank != 0.</div></div><br><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">petsc-dev@mcs.anl.gov</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
All,<br>
<br>
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>
<br>
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>
<br>
--Richard<br>
</div>
</blockquote></div>