| dbc8283e | 08-Jan-2011 |
Barry Smith <bsmith@mcs.anl.gov> |
do not attempt to free all undestroyed PETSc objects in PetscFinalize() instead just optional print them if the Petsc_InnerComm_keyval is attached to PETSC_COMM_SELF or PETSC_COMM_WORLD then free inn
do not attempt to free all undestroyed PETSc objects in PetscFinalize() instead just optional print them if the Petsc_InnerComm_keyval is attached to PETSC_COMM_SELF or PETSC_COMM_WORLD then free inner communicator and delete attribute from outter communicator Subject: Re: [petsc-maint #60571] DMDestroy crashes if I don't carefully destroy every vector that was created with it From: Barry Smith <bsmith@mcs.anl.gov> Date: January 7, 2011 5:51:17 PM CST To: petsc-maint <petsc-maint@mcs.anl.gov>, Jason Sarich <sarich@mcs.anl.gov> Reply-To: petsc-maint <petsc-maint@mcs.anl.gov>
Jason,
Thanks for reporting this with a reproduceble example.
This is big trouble and I don't have a good solution yet. The problem comes because I keep a list of ALL outstanding objects and just loop over them deleting them. The problem is if one object has a reference to another object (the ISLocalToGlobalMapping is referenced by the Vec) but the referenced object is destroyed, then when the referencer is destroyed it tries to destroy the previously destroyed object (hence the crash).
The reason I want to destroy all objects before existing PetscFinalize() is to make PETSc reentrant (so you can call PetscInitialize() more than once, which is normal to do in a scripting language like Python or MATLAB). If I don't destroy all objects then the extra MPI communicators and attributes in the MPI communicators are not destroyed and next time you enter PETSc and use one of those attributes it points to something that is not valid and gives trouble. Destroying all objects insures proper cleanup, otherwise we'd need some other way in PetscFinalize() to cleanup which appears like extra infrastructure I don't want to have. In a scripting environment (unlike a real language :-) it is unrealistic to expect users to cleanup all objects themselves.
Barry
On Jan 7, 2011, at 4:37 PM, Jason Sarich wrote:
Using petsc-dev changeset: 18100:5f2967045bc2 (1/07/2011 15:34)
PETSc is throwing some errors when I don't destroy my dm-created vectors before destroying the DM. I can reproduce this with snes/examples/tutorials/ex5.c by removing the VecDestroy(x):
sarich@franklin:~/software/petsc-dev/src/snes/examples/tutorials> ./ex5 Number of Newton iterations = 4 [0]PETSC ERROR: --------------------- Error Message ------------------------------------ [0]PETSC ERROR: Invalid argument! [0]PETSC ERROR: Wrong type of object: Parameter # 1! [0]PETSC ERROR: ------------------------------------------------------------------------ [0]PETSC ERROR: Petsc Development HG revision: c082370134d6559807fdad65fb712d89017dee8f HG Date: Mon Jan 03 22:01:17 2011 -0600 [0]PETSC ERROR: See docs/changes/index.html for recent updates. [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting. [0]PETSC ERROR: See docs/index.html for manual pages. [0]PETSC ERROR: ------------------------------------------------------------------------ [0]PETSC ERROR: ./ex5 on a linux-gnu named franklin by sarich Fri Jan 7 16:35:50 2011 [0]PETSC ERROR: Libraries linked from /home/sarich/software/petsc-dev/linux-gnu-cxx-debug/lib [0]PETSC ERROR: Configure run at Tue Jan 4 09:55:51 2011 [0]PETSC ERROR: Configure options --download-mpich=1 --with-shared=1 --download-sowing=1 --with-dynamic=1 PETSC_ARCH=linux-gnu-cxx-debug
Hg-commit: cdec62f65ff5d1a817cd2a47c5f6f27c0b729322
show more ...
|