# PetscDeviceContextGetDevice
Get the underlying `PetscDevice` for a `PetscDeviceContext` 
## Synopsis
```
#include <petscdevice.h> 
PetscErrorCode PetscDeviceContextGetDevice(PetscDeviceContext dctx, PetscDevice *device)
```
Not Collective


## Input Parameter

- ***dctx -*** the `PetscDeviceContext`



## Output Parameter

- ***device -*** The `PetscDevice`



## Notes
This is a borrowed reference, the user should not destroy `device`.




## See Also
 `PetscDeviceContextSetDevice()`, `PetscDevice`, `PetscDeviceContextGetDeviceType()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/objects/device/interface/dcontext.cxx.html#PetscDeviceContextGetDevice">src/sys/objects/device/interface/dcontext.cxx</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/objects/device/interface/dcontext.cxx)


[Index of all Sys routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
