[petsc-users] MatAXPY, creations and destructions

Jed Brown jedbrown at mcs.anl.gov
Sat Nov 9 01:11:58 CST 2013


Lukasz Kaczmarczyk <Lukasz.Kaczmarczyk at glasgow.ac.uk> writes:

> Hello,
>
> Just to confirm. More destructions than creations after use MatAXPY it
> is known bug in petsc? Could you confirm that you have the same
> problem, or it is something unique to my implementation.

Thanks for the report.  I have fixed the problem in 'next' and will
merge it into 'maint' in a day or two.

commit 03c4025afd7bfddd354430f069f83de621f6646b (jed/fix-mat-header-replace-log)
Author: Jed Brown <jedbrown at mcs.anl.gov>
Date:   Sat Nov 9 00:03:28 2013 -0700

    MatHeaderReplace: fix duplicate call to PetscLogObjectDestroy
    
    PetscLogObjectDestroy includes tallying of creations and destructions,
    but MatHeaderReplace already calls PetscHeaderDestroy_Private, which
    calls PetscLogObjectDestroy itself.  This led to tallies with more
    destructions than creations for operations when calling functions that
    use MatHeaderReplace (like MatAXPY and MatAYPX).
    
    Reported-by: Lukasz Kaczmarczyk <Lukasz.Kaczmarczyk at glasgow.ac.uk>

diff --git a/src/mat/utils/gcreate.c b/src/mat/utils/gcreate.c
index b00fcaa..cbe1f72 100644
--- a/src/mat/utils/gcreate.c
+++ b/src/mat/utils/gcreate.c
@@ -363,7 +363,6 @@ PETSC_EXTERN PetscErrorCode MatHeaderReplace(Mat A,Mat C)
 
   ((PetscObject)A)->refct = refct;
 
-  ierr = PetscLogObjectDestroy((PetscObject)C);CHKERRQ(ierr);
   ierr = PetscFree(C);CHKERRQ(ierr);
   PetscFunctionReturn(0);
 }

-------------- 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-users/attachments/20131109/258ee104/attachment.pgp>


More information about the petsc-users mailing list