[petsc-users] Finalizing and Initializing during the program run

Jed Brown jedbrown at mcs.anl.gov
Mon Jul 8 11:50:02 CDT 2013


Suraj Prabhakaran <s.prabhakaran at grs-sim.de> writes:

> Dear all,
>
> I am having a strange problem after re-initializing petsc in my
> program. Basically, I finalize petsc (petscFinalize()) and then
> initialize it again (petscInitialize() and petscInitializeFortran())
> after some of the iterations of my problem. 

Run with -malloc_test to confirm that all objects were destroyed before
PetscFinalize.  Objects cannot outlive PETSc.

> Soon after the re-initialization, I get an error in one of the AO
> functions (like AOCreateBasic or AOCreateMapping). Here is a sample
> output of the error
>
> [0]PETSC ERROR: [0] PetscStrcmp line 414 /root/petsc/petsc-3.3-p7/src/sys/utils/str.c
> [0]PETSC ERROR: [0] PetscFListFind line 353 /root/petsc/petsc-3.3-p7/src/sys/dll/reg.c
> [0]PETSC ERROR: [0] AOSetType line 35 /root/petsc/petsc-3.3-p7/src/dm/ao/interface/aoreg.c
> [0]PETSC ERROR: [0] AOCreateBasicIS line 381 /root/petsc/petsc-3.3-p7/src/dm/ao/impls/basic/aobasic.c
> [0]PETSC ERROR: [0] AOCreateBasic line 336 /root/petsc/petsc-3.3-p7/src/dm/ao/impls/basic/aobasic.c

Always send complete error messages.

> Can someone point out what could probably be going wrong here? I do
> the finalize and the initialize only after doing the corresponding
> AODestroys. However, variables malloced with PetscMalloc are
> reused. Could that be a problem?

Yes, that is not allowed.  Why are you calling PetscFinalize in the
first place?  It should be better to just call once when you're really
done with PETSc, including freeing everything allocated using PETSc.
-------------- 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/20130708/caee353f/attachment.pgp>


More information about the petsc-users mailing list