[petsc-users] What caused this problem."PetscInitialize() must be called before PetscFinalize()"
Barry Smith
bsmith at mcs.anl.gov
Fri Aug 26 18:27:20 CDT 2016
You should still check the error code after the call to PetscInitialize() because if the initialization failed the rest of the code will crash badly.
Barry
> On Aug 26, 2016, at 5:54 PM, 丁老师 <ztdepyahoo at 163.com> wrote:
>
> thanks, but i use c++ language, there is no need to call the error code.
>
>
>
>
>
>
> At 2016-08-26 23:49:44, "Barry Smith" <bsmith at mcs.anl.gov> wrote:
> >
> > You got this message because you did not check the error code for PetscInitialize() and so your program continued running until it reached PetscFinalize() where it could not handle the state since PETSc was not properly initialized.
> >
> > You should have code something like
> >
> > call PetscInitialize(PETSC_NULL_CHARACTER, ierr)
> >
> > if (ierr .ne. 0) then
> > print*,'Error in PetscInitialize ',ierr
> > endif
> >
> >
> >> On Aug 26, 2016, at 2:42 AM, 丁老师 <ztdepyahoo at 163.com> wrote:
> >>
> >> Dear friends:
> >> My code run without any problem yesterday, but it gives me the following error. I do not know what is the reason?
> >> Regards
> >>
> >> [0]PETSC ERROR: #1 PetscOptionsInsertFile() line 563 in /home/ztdep/Downloads/petsc-3.6.3/src/sys/objects/options.c
> >> [0]PETSC ERROR: #2 PetscOptionsInsert() line 720 in /home/ztdep/Downloads/petsc-3.6.3/src/sys/objects/options.c
> >> [0]PETSC ERROR: #3 PetscInitialize() line 828 in /home/ztdep/Downloads/petsc-3.6.3/src/sys/objects/pinit.c
> >>
> >> PetscInitialize() must be called before PetscFinalize()
> >>
> >> Regards
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >>
> >
>
>
>
>
More information about the petsc-users
mailing list