# PetscDeviceContextSynchronize
Block the host until all work queued on a `PetscDeviceContext` has finished 
## Synopsis
```
#include <petscdevice.h> 
PetscErrorCode PetscDeviceContextSynchronize(PetscDeviceContext dctx)
```
Not Collective


## Input Parameters

- ***dctx -*** The `PetscDeviceContext` to synchronize



## Notes
The host will not return from this routine until `dctx` is idle. Any and all memory
operations queued on or otherwise associated with (either explicitly or implicitly via
dependencies) are guaranteed to have finished and be globally visible on return.

In effect, this routine serves as memory and execution barrier.


## DAG representation
```none
  time ->

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





## See Also
 `PetscDeviceContextFork()`, `PetscDeviceContextJoin()`, `PetscDeviceContextQueryIdle()`

## Level
beginner

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