#include "petscdevice.h" PetscErrorCode PetscDeviceContextJoin(PetscDeviceContext dctx, PetscInt n, PetscDeviceContextJoinMode joinMode, PetscDeviceContext **dsub)Not Collective, Asynchronous
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 |
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.
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] ->