PETSc version 3.17.0
Fix/Edit manual page

# PetscDeviceContextSetCurrentContext

Set the current active PetscDeviceContext

### Synopsis

    #include "petscdevice.h"
    PetscErrorCode PetscDeviceContextSetCurrentContext(PetscDeviceContext dctx)

Not Collective, Asynchronous

### Input Parameter

| dctx | - The PetscDeviceContext

### Notes

This routine can be used to set the defacto "root" PetscDeviceContext to a user-defined implementation by calling this routine immediately after PetscInitialize() and ensuring that PetscDevice is not greedily intialized. In this case the user is responsible for destroying their PetscDeviceContext before PetscFinalize() returns.

The old context is not stored in any way by this routine; if one is overriding a context that they themselves do not control, one should take care to temporarily store it by calling PetscDeviceContextGetCurrentContext() before calling this routine.

### See Also

PetscDeviceContextGetCurrentContext(), PetscDeviceContextFork(),
PetscDeviceContextJoin(), PetscDeviceContextCreate()

### 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