Context class C wrapper¶
Overview¶
// global functions DPCTL_API bool DPCTLContext_AreEq( __dpctl_keep const DPCTLSyclContextRef CtxRef1, __dpctl_keep const DPCTLSyclContextRef CtxRef2 ); DPCTL_API __dpctl_give DPCTLSyclContextRef DPCTLContext_Copy(__dpctl_keep const DPCTLSyclContextRef CRef); DPCTL_API __dpctl_give DPCTLSyclContextRef DPCTLContext_Create( __dpctl_keep const DPCTLSyclDeviceRef DRef, error_handler_callback* handler, int properties ); DPCTL_API __dpctl_give DPCTLSyclContextRef DPCTLContext_CreateFromDevices( __dpctl_keep const DPCTLDeviceVectorRef DVRef, error_handler_callback* handler, int properties ); DPCTL_API void DPCTLContext_Delete(__dpctl_take DPCTLSyclContextRef CtxRef); DPCTL_API size_t DPCTLContext_DeviceCount(__dpctl_keep const DPCTLSyclContextRef CRef); DPCTL_API DPCTLSyclBackendType DPCTLContext_GetBackend(__dpctl_keep const DPCTLSyclContextRef CtxRef); DPCTL_API __dpctl_give DPCTLDeviceVectorRef DPCTLContext_GetDevices(__dpctl_keep const DPCTLSyclContextRef CRef); DPCTL_API size_t DPCTLContext_Hash(__dpctl_keep DPCTLSyclContextRef CtxRef);
Detailed Documentation¶
Global Functions¶
DPCTL_API bool DPCTLContext_AreEq( __dpctl_keep const DPCTLSyclContextRef CtxRef1, __dpctl_keep const DPCTLSyclContextRef CtxRef2 )
Checks if two DPCTLSyclContextRef objects point to the same sycl::context.
Parameters:
CtxRef1 |
First opaque pointer to the sycl context. |
CtxRef2 |
Second opaque pointer to the sycl context. |
Returns:
True if the underlying sycl::context are same, false otherwise.
DPCTL_API __dpctl_give DPCTLSyclContextRef DPCTLContext_Copy(__dpctl_keep const DPCTLSyclContextRef CRef)
Returns a copy of the DPCTLSyclContextRef object.
Parameters:
CRef |
DPCTLSyclContextRef object to be copied. |
Returns:
A new DPCTLSyclContextRef created by copying the passed in DPCTLSyclContextRef object.
DPCTL_API __dpctl_give DPCTLSyclContextRef DPCTLContext_Create( __dpctl_keep const DPCTLSyclDeviceRef DRef, error_handler_callback* handler, int properties )
Constructs a new SYCL context for the given SYCL device using the optional async error handler and properties bit flags.
Parameters:
DRef |
Opaque pointer to a SYCL device. |
handler |
A callback function that will be invoked by the async_handler used during context creation. Can be NULL if no async_handler is needed. |
properties |
An optional combination of bit flags to define context properties. Currently, dpctl does not use this argument. |
Returns:
A new opaque pointer wrapping a SYCL context.
DPCTL_API __dpctl_give DPCTLSyclContextRef DPCTLContext_CreateFromDevices( __dpctl_keep const DPCTLDeviceVectorRef DVRef, error_handler_callback* handler, int properties )
Constructs a new SYCL context for the given vector of SYCL devices using the optional async error handler and properties bit flags.
Parameters:
DVRef |
An opaque pointer to a std::vector of DPCTLSyclDeviceRef opaque pointers. |
handler |
A callback function that will be invoked by the async_handler used during context creation. Can be NULL if no async_handler is needed. |
properties |
An optional combination of bit flags to define context properties. Currently, dpctl does not use this argument. |
Returns:
A new opaque pointer wrapping a SYCL context.
DPCTL_API void DPCTLContext_Delete(__dpctl_take DPCTLSyclContextRef CtxRef)
Delete the pointer after casting it to sycl::context.
Parameters:
CtxRef |
The DPCTLSyclContextRef pointer to be deleted. |
DPCTL_API size_t DPCTLContext_DeviceCount(__dpctl_keep const DPCTLSyclContextRef CRef)
Returns the number of devices associated with sycl::context referenced by DPCTLSyclContextRef object.
Parameters:
CRef |
DPCTLSyclContexRef object to query. |
Returns:
A positive count on success or zero on error.
DPCTL_API DPCTLSyclBackendType DPCTLContext_GetBackend(__dpctl_keep const DPCTLSyclContextRef CtxRef)
Returns the sycl backend for the DPCTLSyclContextRef pointer.
Parameters:
CtxRef |
An opaque pointer to a sycl::context. |
Returns:
The sycl backend for the DPCTLSyclContextRef returned as a DPCTLSyclBackendType enum type.
DPCTL_API __dpctl_give DPCTLDeviceVectorRef DPCTLContext_GetDevices(__dpctl_keep const DPCTLSyclContextRef CRef)
Returns a vector of devices associated with sycl::context referenced by DPCTLSyclContextRef object.
Parameters:
CRef |
DPCTLSyclContexRef object to query. |
Returns:
A DPCTLDeviceVectorRef with devices associated with given CRef.
DPCTL_API size_t DPCTLContext_Hash(__dpctl_keep DPCTLSyclContextRef CtxRef)
Wrapper over std::hash<sycl::context>’s operator()
Parameters:
CtxRef |
The DPCTLSyclContextRef pointer. |
Returns:
Hash value of the underlying sycl::context
instance.