Skip to main content
`Ctrl`+`K`

# 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 type - implementation type, see `PetscSFSetType()`

- -sf_rank_order (true|false) - sort composite points for gathers and scatters in MPI 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`PetscSF` 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 - an alternative to low-level MPI calls for data communication, `PetscSF`, `PetscSFCreate()`, `PetscSFSetType()`

## Level

intermediate

## Location

src/vec/is/sf/interface/sf.c

## Examples

src/vec/is/sf/tutorials/ex1f.F90
src/vec/is/sf/tutorials/ex2.c
src/vec/is/sf/tutorials/ex3.c
src/vec/is/sf/tutorials/ex1.c

## Implementations

PetscSFSetFromOptions_Window() in src/vec/is/sf/impls/window/sfwindow.c

Index of all PetscSF routines
Table of Contents for all manual pages
Index of all manual pages