Commits

Hong Zhang  committed 5008f5a

split the case 'via matmatmatmult' of MatRARt_SeqAIJ_SeqAIJ info symbolic and numeric phases

  • Participants
  • Parent commits 863a9f9

Comments (0)

Files changed (2)

File src/mat/impls/aij/seq/aij.h

 PETSC_INTERN PetscErrorCode MatGetSymbolicTransposeReduced_SeqAIJ(Mat,PetscInt,PetscInt,PetscInt *[],PetscInt *[]);
 PETSC_INTERN PetscErrorCode MatRestoreSymbolicTranspose_SeqAIJ(Mat,PetscInt *[],PetscInt *[]);
 PETSC_INTERN PetscErrorCode MatTransposeSymbolic_SeqAIJ(Mat,Mat*);
+PETSC_INTERN PetscErrorCode MatTranspose_SeqAIJ(Mat,MatReuse,Mat*);
 PETSC_INTERN PetscErrorCode MatToSymmetricIJ_SeqAIJ(PetscInt,PetscInt*,PetscInt*,PetscInt,PetscInt,PetscInt**,PetscInt**);
 PETSC_INTERN PetscErrorCode MatLUFactorSymbolic_SeqAIJ_inplace(Mat,Mat,IS,IS,const MatFactorInfo*);
 PETSC_INTERN PetscErrorCode MatLUFactorSymbolic_SeqAIJ(Mat,Mat,IS,IS,const MatFactorInfo*);

File src/mat/impls/aij/seq/matrart.c

     /* via matmatmatmult: Rt=R^T, C=R*A*Rt - avoid inefficient sparse inner products */
     /*-------------------------------------------------------------------------------*/
     Mat           Rt;
-    if (scall == MAT_INITIAL_MATRIX) {
-      ierr = MatTranspose(R,MAT_INITIAL_MATRIX,&Rt);CHKERRQ(ierr); 
-      ierr = MatMatMatMult(R,A,Rt,scall,fill,C);CHKERRQ(ierr);
+    if (scall == MAT_INITIAL_MATRIX) { 
+      ierr = PetscLogEventBegin(MAT_RARtSymbolic,A,R,0,0);CHKERRQ(ierr);
+      ierr = MatTranspose_SeqAIJ(R,MAT_INITIAL_MATRIX,&Rt);CHKERRQ(ierr);
+      ierr = MatMatMatMultSymbolic_SeqAIJ_SeqAIJ_SeqAIJ(R,A,Rt,fill,C);CHKERRQ(ierr);
 
       ierr = PetscNew(Mat_RARt,&rart);CHKERRQ(ierr);
       rart->Rt = Rt;
       c->rart  = rart;
       rart->destroy      = (*C)->ops->destroy;
       (*C)->ops->destroy = MatDestroy_SeqAIJ_RARt;
-    } else {
-      c  = (Mat_SeqAIJ*)(*C)->data;
-      rart = c->rart;
-      Rt   = rart->Rt;
-      ierr = MatTranspose(R,MAT_REUSE_MATRIX,&Rt);CHKERRQ(ierr); 
-      ierr = MatMatMatMult(R,A,Rt,scall,fill,C);CHKERRQ(ierr);
-    }
+      ierr = PetscLogEventEnd(MAT_RARtSymbolic,A,R,0,0);CHKERRQ(ierr);
+    } 
+    
+    ierr = PetscLogEventBegin(MAT_RARtNumeric,A,R,0,0);CHKERRQ(ierr);
+    c  = (Mat_SeqAIJ*)(*C)->data;
+    rart = c->rart;
+    Rt   = rart->Rt;
+    ierr = MatTranspose_SeqAIJ(R,MAT_REUSE_MATRIX,&Rt);CHKERRQ(ierr); 
+    ierr = MatMatMatMultNumeric_SeqAIJ_SeqAIJ_SeqAIJ(R,A,Rt,*C);CHKERRQ(ierr);
 #if defined(PETSC_USE_INFO)
     ierr = PetscInfo(*C,"Use Rt=R^T and C=R*A*Rt via MatMatMatMult() to avoid sparse inner products\n");CHKERRQ(ierr); 
 #endif
+    ierr = PetscLogEventEnd(MAT_RARtNumeric,A,R,0,0);CHKERRQ(ierr);
     break;
   }
   PetscFunctionReturn(0);