[petsc-dev] MatMult

Jed Brown jedbrown at mcs.anl.gov
Wed Oct 9 08:41:55 CDT 2013


Stefano Zampini <s.zampini at cineca.it> writes:

> Just an update: I ran with -info, and saw that the 186x6 matrix uses
> compressed rows routines, whereas 171x21 does not.

Yikes, it looks like all MatMult compressedrow implementations are
broken.  Look at the SeqAIJ implementation, for example:

  if (usecprow) { /* use compressed row format */
    m    = a->compressedrow.nrows;
    ii   = a->compressedrow.i;
    ridx = a->compressedrow.rindex;
    for (i=0; i<m; i++) {
      n           = ii[i+1] - ii[i];
      aj          = a->j + ii[i];
      aa          = a->a + ii[i];
      sum         = 0.0;
      PetscSparseDensePlusDot(sum,x,aa,aj,n);
      /* for (j=0; j<n; j++) sum += (*aa++)*x[*aj++]; */
      y[*ridx++] = sum;
    }
  } else { /* do not use compressed row format */


I'm thinking we should remove the compressedrow branches for MatMult
(the optimization was for MatMultAdd).  A more sophisticated approach
would be to check whether the output Vec is known to be exactly zero
(due to a cached norm) and only use the compressedrow branch in that
case.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20131009/26f7ef8c/attachment.sig>


More information about the petsc-dev mailing list