[petsc-dev] MATOP_MAT_MULT

Zhang, Hong hzhang at mcs.anl.gov
Tue Apr 21 10:22:00 CDT 2020


Pierre,
MatMatMult_xxx() is removed from MatOps table. MatMatMult() is replaced by
MatProductCreate()
MatProductSetType(,MATPRODUCT_AB)
MatProductSetFromOptions()
MatProductSymbolic()
MatProductNumeric()

Where/when do you need query a single matrix for its product operation?
Hong

________________________________
From: petsc-dev <petsc-dev-bounces at mcs.anl.gov> on behalf of Pierre Jolivet <pierre.jolivet at enseeiht.fr>
Sent: Tuesday, April 21, 2020 7:50 AM
To: petsc-dev <petsc-dev at mcs.anl.gov>
Subject: [petsc-dev] MATOP_MAT_MULT

Hello,
Am I seeing this correctly?
#include <petsc.h>

int main(int argc,char **args)
{
  Mat               A;
  PetscBool         hasMatMult;
  PetscErrorCode    ierr;

  ierr = PetscInitialize(&argc,&args,NULL,NULL);if (ierr) return ierr;
  ierr = MatCreate(PETSC_COMM_WORLD,&A);CHKERRQ(ierr);
  ierr = MatSetType(A,MATMPIAIJ);CHKERRQ(ierr);
  ierr = MatHasOperation(A,MATOP_MAT_MULT,&hasMatMult);CHKERRQ(ierr);
  printf("%s\n", PetscBools[hasMatMult]);
  ierr = PetscFinalize();
  return ierr;
}

=> FALSE

I believe this is a regression (or at least an undocumented change) introduced here: https://gitlab.com/petsc/petsc/-/merge_requests/2524/
I also believe Stefano raised a similar point there: https://gitlab.com/petsc/petsc/-/issues/608
This is a performance killer in my case because I was previously using this check to know whether I could use MatMatMult or had to loop on all columns and call MatMult on all of them.
There is also a bunch of (previously functioning but now) broken code, e.g., https://www.mcs.anl.gov/petsc/petsc-current/src/mat/impls/transpose/transm.c.html#line105 or https://www.mcs.anl.gov/petsc/petsc-current/src/mat/impls/nest/matnest.c.html#line2105
Is this being addressed/documented?

Thanks,
Pierre
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20200421/abf920cd/attachment-0001.html>


More information about the petsc-dev mailing list