:orphan:
# PetscSFReduceEnd
end a reduction operation started with `PetscSFReduceBegin()` or `PetscSFReduceWithMemTypeBegin()`
## Synopsis
```
#include "petscsf.h"
PetscErrorCode PetscSFReduceEnd(PetscSF sf, MPI_Datatype unit, const void *leafdata, void *rootdata, MPI_Op op)
```
Collective
## Input Parameters
- ***sf -*** star forest
- ***unit -*** data type
- ***leafdata -*** values to reduce
- ***op -*** reduction operation
## Output Parameter
- ***rootdata -*** result of reduction of values from all leaves of each root
## See Also
`PetscSF`, `PetscSFSetGraph()`, `PetscSFBcastEnd()`, `PetscSFReduceBegin()`, `PetscSFReduceWithMemTypeBegin()`
## Level
intermediate
## Location
src/vec/is/sf/interface/sf.c
## Examples
src/vec/is/sf/tutorials/ex1.c
src/vec/is/sf/tutorials/ex1f.F90
## Implementations
PetscSFReduceEnd_Allgatherv in src/vec/is/sf/impls/basic/allgatherv/sfallgatherv.c
PetscSFReduceEnd_Basic in src/vec/is/sf/impls/basic/sfbasic.c
PetscSFReduceEnd_Window in src/vec/is/sf/impls/window/sfwindow.c
---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/vec/is/sf/interface/sf.c)
[Index of all PetscSF routines](index.md)
[Table of Contents for all manual pages](/manualpages/index.md)
[Index of all manual pages](/manualpages/singleindex.md)