PetscDeviceContext#

Container to manage stream dependencies and the various solver handles for asynchronous device compute.

Synopsis#

#include <petscdevicetypes.h> 
typedef struct _p_PetscDeviceContext *PetscDeviceContext;

Notes#

Public APIs taking a PetscDeviceContext require a valid context or, where supported, PetscDeviceContextDefault. Obtain the current context with PetscDeviceContextGetCurrentContext() and pass it explicitly; NULL does not select an implicit context. This requirement also applies to operations with no work, such as zero-length memory operations. PetscDeviceContextDestroy() accepts the address of a null handle.

In builds using the C-only device-interface fallback, PetscDeviceContextCreate() and PetscDeviceContextGetCurrentContext() return null handles. These handles remain valid arguments to the fallback APIs. This exception does not apply to host contexts in builds using the C++ device interface.

See Also#

PetscDevice, PetscDeviceContextCreate(), PetscDeviceContextSetDevice(), PetscDeviceContextDestroy(), PetscDeviceContextFork(), PetscDeviceContextJoin()

Level#

beginner

Location#

include/petscdevicetypes.h

Examples#

src/sys/objects/device/tests/ex12.c
src/sys/objects/device/tests/ex2.c
src/sys/objects/device/tests/ex1.c
src/sys/objects/device/tests/ex10.c
src/sys/objects/device/tests/ex11.cxx
src/sys/objects/device/tests/ex13.cxx
src/sys/objects/device/tests/ex1k.kokkos.cxx
src/sys/objects/device/tests/ex3.c
src/sys/objects/device/tests/ex4.c
src/sys/objects/device/tests/ex6.c

Object Header#

_p_PetscDeviceContext in include/petsc/private/deviceimpl.h


Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages