:orphan:
# PetscSFSetFromOptions
set `PetscSF` options using the options database 
## Synopsis
```
#include "petscsf.h" 
PetscErrorCode PetscSFSetFromOptions(PetscSF sf)
```
Logically Collective


## Input Parameter

- ***sf -*** star forest



## Options Database Keys

- ***-sf_type               -*** implementation type, see `PetscSFSetType()`
- ***-sf_rank_order         -*** sort composite points for gathers and scatters in rank order, gathers are non-deterministic otherwise
- ***-sf_use_default_stream -*** Assume callers of `PetscSF` computed the input root/leafdata with the default CUDA stream. `PetscSF` will also
use the default stream to process data. Therefore, no stream synchronization is needed between `PetscSF` and its caller (default: true).
If true, this option only works with `-use_gpu_aware_mpi 1`.
- ***-sf_use_stream_aware_mpi  -*** Assume the underlying MPI is CUDA-stream aware and `PetscSF` won't sync streams for send/recv buffers passed to MPI (default: false).
If true, this option only works with `-use_gpu_aware_mpi 1`.

- ***-sf_backend cuda | hip | kokkos -*** Select the device backend SF uses. Currently `PetscSF` has these backends: cuda, hip and Kokkos.
On CUDA (HIP) devices, one can choose cuda (hip) or kokkos with the default being kokkos. On other devices,
the only available is kokkos.





## See Also
 `PetscSF`, `PetscSFCreate()`, `PetscSFSetType()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/interface/sf.c.html#PetscSFSetFromOptions">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</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/tutorials/ex1f.F90.html">src/vec/is/sf/tutorials/ex1f.F90</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/tutorials/ex2.c.html">src/vec/is/sf/tutorials/ex2.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/tutorials/ex3.c.html">src/vec/is/sf/tutorials/ex3.c</A><BR>

## Implementations

<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/vec/is/sf/impls/window/sfwindow.c.html#PetscSFSetFromOptions_Window">PetscSFSetFromOptions_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](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
