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 (basic|window|neighbor) - 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
PetscSFcomputed the input root/leafdata with the default CUDA stream.PetscSFwill also use the default stream to process data. Therefore, no stream synchronization is needed betweenPetscSFand 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 aware of GPU streams and
PetscSFwon’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
PetscSFuses. On CUDA (HIP) devices, one can choosecuda(hip) orkokkoswith the default beingcuda(hip). On other devices, the only available backend iskokkos.
Notes#
With -sf_backend kokkos, SF uses PETSc’s shared Kokkos execution space. Changing the current
PetscDeviceContext does not change that execution space. Order input production and output consumption
with respect to the Kokkos execution space; synchronizing a different current context is insufficient.
MPIX stream support with -sf_use_stream_aware_mpi is incomplete and currently limited to CUDA.
The MPI communicator is bound to the CUDA stream selected during PetscSFSetFromOptions() and is not
rebound when the current context changes.
In addition, enabling this option does not reliably select the MPIX enqueue operations. Keep this option
disabled until stream-ordered MPI communication is supported consistently.
With -use_nvshmem, use -sf_backend cuda and keep a fixed CUDA context. The Kokkos/NVSHMEM path does not
bind its dependency events to the Kokkos execution stream. NVSHMEM also uses a separate communication stream;
synchronization of the SF device stream, including at barrier-context completion, only waits for communication
ordered onto that stream. It does not guarantee completion of all NVSHMEM communication.
See Also#
PetscSF - an alternative to low-level MPI calls for data communication, PetscSF, PetscSFCreate(), PetscSFSetType()
Level#
intermediate
Location#
Examples#
src/vec/is/sf/tutorials/ex1.c
src/vec/is/sf/tutorials/ex1f.F90
src/vec/is/sf/tutorials/ex2.c
src/vec/is/sf/tutorials/ex3.c
src/vec/is/is/tests/ex9.c
src/vec/is/sf/tests/ex1.c
src/vec/is/sf/tests/ex17.c
src/vec/is/sf/tests/ex24.c
src/vec/is/sf/tests/ex25.c
src/vec/is/sf/tests/ex26.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