PETSc version 3.17.0
Fix/Edit manual page

# PetscDeviceContextJoin

Converge a set of child contexts

### Synopsis

    #include "petscdevice.h"
    PetscErrorCode PetscDeviceContextJoin(PetscDeviceContext dctx, PetscInt n, PetscDeviceContextJoinMode joinMode, PetscDeviceContext **dsub)

Not Collective, Asynchronous

### Input Parameters

| dctx | - A PetscDeviceContext to converge on
| n | - The number of sub contexts to converge
| joinMode | - The type of join to perform
| dsub | - The sub contexts to converge

### Notes

If PetscDeviceContextFork() creates n edges from a source node which all depend on the source node, then this routine is the exact mirror. That is, it creates a node (represented in dctx) which recieves n edges (and optionally destroys them) which is dependent on the completion of all incoming edges.

If joinMode is PETSC_DEVICE_CONTEXT_JOIN_DESTROY all contexts in dsub will be destroyed by this routine. Thus all sub contexts must have been created with the dctx passed to this routine.

if joinMode is PETSC_DEVICE_CONTEXT_JOIN_NO_SYNC dctx waits for all sub contexts but the sub contexts do not wait for one another afterwards.

If joinMode is PETSC_DEVICE_CONTEXT_JOIN_SYNC all sub contexts will additionally wait on dctx after converging. This has the effect of "synchronizing" the outgoing edges.

### DAG representations

If joinMode is PETSC_DEVICE_CONTEXT_JOIN_DESTROY

      time ->

      -> dctx ---------/- dctx ->
      -> dsub[0] -----/
      ->  ... -------/
      -> dsub[n-1] -/

If joinMode is PETSC_DEVICE_CONTEXT_JOIN_NO_SYNC

      time ->

      -> dctx ---------/- dctx ->
      -> dsub[0] -----/--------->
      ->  ... -------/---------->
      -> dsub[n-1] -/----------->

If joinMode is PETSC_DEVICE_CONTEXT_JOIN_SYNC

      time ->

      -> dctx ---------/- dctx -\----> dctx ------>
      -> dsub[0] -----/          \---> dsub[0] --->
      ->  ... -------/            \--> ... ------->
      -> dsub[n-1] -/              \-> dsub[n-1] ->

### See Also

PetscDeviceContextFork(), PetscDeviceContextSynchronize(), PetscDeviceContextJoinMode

### Level

intermediate

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