:orphan:
# PetscSFReduceWithMemTypeBegin
begin reduction of leafdata into rootdata with explicit memory types, to be completed with call to `PetscSFReduceEnd()` 
## Synopsis
```
#include "petscsf.h" 
PetscErrorCode PetscSFReduceWithMemTypeBegin(PetscSF sf, MPI_Datatype unit, PetscMemType leafmtype, const void *leafdata, PetscMemType rootmtype, void *rootdata, MPI_Op op)
```
Collective


## Input Parameters

- ***sf -*** star forest
- ***unit -*** data type
- ***leafmtype -*** memory type of leafdata
- ***leafdata -*** values to reduce
- ***rootmtype -*** memory type of rootdata
- ***op -*** reduction operation



## Output Parameter

- ***rootdata -*** result of reduction of values from all leaves of each root





## See Also
 `PetscSF`, `PetscSFBcastBegin()`, `PetscSFReduceBegin()`, `PetscSFReduceEnd()`

## Level
intermediate

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


---
[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)  
