Commits

Jed Brown committed 7438872

MatView_MPI_DA() return early if only viewing info, fixes huge performance bug with ksp_view/snes_view

Hg-commit: 55d6eb124990970369f2598c78a24160ecf515ca

Comments (0)

Files changed (1)

src/dm/impls/da/fdda.c

   PetscInt       rstart,rend,*petsc,i;
   IS             is;
   MPI_Comm       comm;
+  PetscViewerFormat format;
 
   PetscFunctionBegin;
+  /* Check whether we are just printing info, in which case MatView() already viewed everything we wanted to view */
+  ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr);
+  if (format == PETSC_VIEWER_ASCII_INFO || format == PETSC_VIEWER_ASCII_INFO_DETAIL) PetscFunctionReturn(0);
+
   ierr = PetscObjectGetComm((PetscObject)A,&comm);CHKERRQ(ierr);
   ierr = PetscObjectQuery((PetscObject)A,"DM",(PetscObject*)&da);CHKERRQ(ierr);
   if (!da) SETERRQ(((PetscObject)A)->comm,PETSC_ERR_ARG_WRONG,"Matrix not generated from a DMDA");