# PetscSFReduceEnd
end a reduction operation started with `PetscSFReduceBegin()` 
## 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()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/interface/sf.c.html#PetscSFReduceEnd">src/vec/is/sf/interface/sf.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/tutorials/ex1.c.html">src/vec/is/sf/tutorials/ex1.c.html</A><BR>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/impls/basic/allgatherv/sfallgatherv.c.html#PetscSFReduceEnd_Allgatherv">PetscSFReduceEnd_Allgatherv in src/vec/is/sf/impls/basic/allgatherv/sfallgatherv.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/impls/basic/sfbasic.c.html#PetscSFReduceEnd_Basic">PetscSFReduceEnd_Basic in src/vec/is/sf/impls/basic/sfbasic.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/impls/window/sfwindow.c.html#PetscSFReduceEnd_Window">PetscSFReduceEnd_Window in src/vec/is/sf/impls/window/sfwindow.c</A><BR>


---
[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](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
