Skip to main content
`Ctrl`+`K`

# PetscDeviceContextSetFromOptions

Configure a `PetscDeviceContext` from the options database

## Synopsis

    #include <petscdevice.h>
    PetscErrorCode PetscDeviceContextSetFromOptions(MPI_Comm comm, PetscDeviceContext dctx)

Collective on `comm` or `dctx`

## Input Parameters

- comm - MPI communicator on which to query the options database (optional)

- dctx - The `PetscDeviceContext` to configure

## Output Parameter

- dctx - The `PetscDeviceContext`

## Options Database Keys

- -device_context_stream_type - type of stream to create inside the `PetscDeviceContext` - `PetscDeviceContextSetStreamType()`

- -device_context_device_type - the type of `PetscDevice` to attach by default - `PetscDeviceType`

## Note

The user may pass `MPI_COMM_NULL` for `comm` in which case the communicator of `dctx` is used (which is always `PETSC_COMM_SELF`).

## See Also

`PetscDeviceContextSetStreamType()`, `PetscDeviceContextSetDevice()`, `PetscDeviceContextView()`

## Level

beginner

## Location

src/sys/objects/device/interface/dcontext.cxx

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