# PetscEnd
Calls `PetscFinalize()` and then ends the program. This is useful if one wishes a clean exit somewhere deep in the program. 
## Synopsis
```
#include "petscsys.h"   
PetscErrorCode PetscEnd(void)
```
Collective on `PETSC_COMM_WORLD`

Options Database Keys are the same as for `PetscFinalize()`




## Note
See `PetscInitialize()` for more general runtime options.


## See Also
 `PetscInitialize()`, `PetscOptionsView()`, `PetscMallocDump()`, `PetscMPIDump()`, `PetscFinalize()`

## Level
advanced

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/objects/init.c.html#PetscEnd">src/sys/objects/init.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex30.c.html">src/snes/tutorials/ex30.c.html</A><BR>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/objects/init.c)


[Index of all Sys routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
