# PetscDeviceContextDuplicate
Duplicates a `PetscDeviceContext` object 
## Synopsis
```
#include <petscdevice.h> 
PetscErrorCode PetscDeviceContextDuplicate(PetscDeviceContext dctx, PetscDeviceContext *dctxdup)
```
Not Collective


## Input Parameter

- ***dctx -*** The `PetscDeviceContext` to duplicate



## Output Parameter

- ***dctxdup -*** The duplicated `PetscDeviceContext`



## Notes
This is a shorthand method for creating a `PetscDeviceContext` with the exact same settings as
another. Note however that `dctxdup` does not share any of the underlying data with `dctx`,
(including its current stream-state) they are completely separate objects.

There is no implied ordering between `dctx` or `dctxdup`.


## DAG representation
```none
  time ->

  -> dctx - |= CALL =| - dctx ---->
                       - dctxdup ->
```





## See Also
 `PetscDeviceContextCreate()`, `PetscDeviceContextSetDevice()`,
`PetscDeviceContextSetStreamType()`

## Level
beginner

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/objects/device/interface/dcontext.cxx.html#PetscDeviceContextDuplicate">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)  
