:orphan:
# PetscBuildTwoSidedType
algorithm for setting up two-sided communication for use with `PetscSF` 
## Synopsis
```
typedef enum {
  PETSC_BUILDTWOSIDED_NOTSET     = -1,
  PETSC_BUILDTWOSIDED_ALLREDUCE  = 0,
  PETSC_BUILDTWOSIDED_IBARRIER   = 1,
  PETSC_BUILDTWOSIDED_REDSCATTER = 2
  /* Updates here must be accompanied by updates in finclude/petscsys.h and the string array in mpits.c */
} PetscBuildTwoSidedType;
```

## Values

- ***`PETSC_BUILDTWOSIDED_ALLREDUCE` -*** classical algorithm using an `MPI_Allreduce()` with
a buffer of length equal to the communicator size. Not memory-scalable due to
the large reduction size. Requires only an MPI-1 implementation.
- ***`PETSC_BUILDTWOSIDED_IBARRIER` -*** nonblocking algorithm based on `MPI_Issend()` and `MPI_Ibarrier()`.
Proved communication-optimal in Hoefler, Siebert, and Lumsdaine (2010). Requires an MPI-3 implementation.
- ***`PETSC_BUILDTWOSIDED_REDSCATTER` -*** similar to above, but use more optimized function
that only communicates the part of the reduction that is necessary.  Requires an MPI-2 implementation.





## See Also
 `PetscCommBuildTwoSided()`, `PetscCommBuildTwoSidedSetType()`, `PetscCommBuildTwoSidedGetType()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/include/petscsystypes.h.html#PetscBuildTwoSidedType">include/petscsystypes.h</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/include/petscsystypes.h)


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