[petsc-users] error handling
Dave May
dave.mayhem23 at gmail.com
Mon Jan 20 12:40:49 CST 2020
On Mon 20. Jan 2020 at 19:39, Sam Guo <sam.guo at cd-adapco.com> wrote:
> I don't have a specific case yet. Currently every call of PETSc is
> checked. If ierr is not zero, print the error and return. For example,
> Mat A; /* problem matrix */
> EPS eps; /* eigenproblem solver context */
> EPSType type;
> PetscReal error,tol,re,im;
> PetscScalar kr,ki; Vec xr,xi; 25
> PetscInt n=30,i,Istart,Iend,nev,maxit,its,nconv;
> PetscErrorCode ierr;
> ierr = SlepcInitialize(&argc,&argv,(char*)0,help);CHKERRQ(ierr);
> ierr = PetscOptionsGetInt(NULL,NULL,"-n",&n,NULL);CHKERRQ(ierr);
> ierr = PetscPrintf(PETSC_COMM_WORLD,"\n1-D Laplacian Eigenproblem,
> n=%D\n\n",n);CHKERRQ(ierr);
>
> I am wondering if the memory is lost by calling CHKERRQ.
>
No.
> On Mon, Jan 20, 2020 at 10:14 AM Dave May <dave.mayhem23 at gmail.com> wrote:
>
>>
>>
>> On Mon 20. Jan 2020 at 19:11, Sam Guo <sam.guo at cd-adapco.com> wrote:
>>
>>> Dear PETSc dev team,
>>> If PETSc function returns an error, what's the correct way to clean
>>> PETSc?
>>>
>>
>> The answer depends on the error message reported. Send the complete error
>> message and a better answer can be provided.
>>
>> Particularly how to clean up the memory?
>>>
>>
>> Totally depends on the objects which aren’t being freed. You need to
>> provide more information
>>
>> Thanks
>> Dave
>>
>>
>>> Thanks,
>>> Sam
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20200120/969b4d51/attachment.html>
More information about the petsc-users
mailing list