.. index:: pair: group; Context class C wrapper .. _doxid-d6/dad/group___context_interface: Context class C wrapper ======================= .. toctree:: :hidden: Overview ~~~~~~~~ .. ref-code-block:: cpp :class: doxyrest-overview-code-block // global functions :ref:`DPCTL_API` bool :ref:`DPCTLContext_AreEq`( :ref:`__dpctl_keep` const :ref:`DPCTLSyclContextRef` CtxRef1, :ref:`__dpctl_keep` const :ref:`DPCTLSyclContextRef` CtxRef2 ); :ref:`DPCTL_API` :ref:`__dpctl_give` :ref:`DPCTLSyclContextRef` :ref:`DPCTLContext_Copy`(:ref:`__dpctl_keep` const :ref:`DPCTLSyclContextRef` CRef); :ref:`DPCTL_API` :ref:`__dpctl_give` :ref:`DPCTLSyclContextRef` :ref:`DPCTLContext_Create`( :ref:`__dpctl_keep` const :ref:`DPCTLSyclDeviceRef` DRef, :ref:`error_handler_callback`* handler, int properties ); :ref:`DPCTL_API` :ref:`__dpctl_give` :ref:`DPCTLSyclContextRef` :ref:`DPCTLContext_CreateFromDevices`( :ref:`__dpctl_keep` const :ref:`DPCTLDeviceVectorRef` DVRef, :ref:`error_handler_callback`* handler, int properties ); :ref:`DPCTL_API` void :ref:`DPCTLContext_Delete`(:ref:`__dpctl_take` :ref:`DPCTLSyclContextRef` CtxRef); :ref:`DPCTL_API` size_t :ref:`DPCTLContext_DeviceCount`(:ref:`__dpctl_keep` const :ref:`DPCTLSyclContextRef` CRef); :ref:`DPCTL_API` :ref:`DPCTLSyclBackendType` :ref:`DPCTLContext_GetBackend`(:ref:`__dpctl_keep` const :ref:`DPCTLSyclContextRef` CtxRef); :ref:`DPCTL_API` :ref:`__dpctl_give` :ref:`DPCTLDeviceVectorRef` :ref:`DPCTLContext_GetDevices`(:ref:`__dpctl_keep` const :ref:`DPCTLSyclContextRef` CRef); :ref:`DPCTL_API` size_t :ref:`DPCTLContext_Hash`(:ref:`__dpctl_keep` :ref:`DPCTLSyclContextRef` CtxRef); .. _details-d6/dad/group___context_interface: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Global Functions ---------------- .. index:: pair: function; DPCTLContext_AreEq .. _doxid-d6/dad/group___context_interface_1gaa6938cd391c1cea91998fae97ba05141: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`DPCTL_API` bool DPCTLContext_AreEq( :ref:`__dpctl_keep` const :ref:`DPCTLSyclContextRef` CtxRef1, :ref:`__dpctl_keep` const :ref:`DPCTLSyclContextRef` CtxRef2 ) Checks if two DPCTLSyclContextRef objects point to the same sycl::context. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - CtxRef1 - First opaque pointer to the sycl context. * - CtxRef2 - Second opaque pointer to the sycl context. .. rubric:: Returns: True if the underlying sycl::context are same, false otherwise. .. index:: pair: function; DPCTLContext_Copy .. _doxid-d6/dad/group___context_interface_1ga2e2a05150e669d9950155c4884d1b12e: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`DPCTL_API` :ref:`__dpctl_give` :ref:`DPCTLSyclContextRef` DPCTLContext_Copy(:ref:`__dpctl_keep` const :ref:`DPCTLSyclContextRef` CRef) Returns a copy of the DPCTLSyclContextRef object. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - CRef - DPCTLSyclContextRef object to be copied. .. rubric:: Returns: A new DPCTLSyclContextRef created by copying the passed in DPCTLSyclContextRef object. .. index:: pair: function; DPCTLContext_Create .. _doxid-d6/dad/group___context_interface_1gacf091019310a589c547dfe0d1e6f5972: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`DPCTL_API` :ref:`__dpctl_give` :ref:`DPCTLSyclContextRef` DPCTLContext_Create( :ref:`__dpctl_keep` const :ref:`DPCTLSyclDeviceRef` DRef, :ref:`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. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - 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. .. rubric:: Returns: A new opaque pointer wrapping a SYCL context. .. index:: pair: function; DPCTLContext_CreateFromDevices .. _doxid-d6/dad/group___context_interface_1ga2017c4e49a0c88ef7fa8e3195eb685b4: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`DPCTL_API` :ref:`__dpctl_give` :ref:`DPCTLSyclContextRef` DPCTLContext_CreateFromDevices( :ref:`__dpctl_keep` const :ref:`DPCTLDeviceVectorRef` DVRef, :ref:`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. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - 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. .. rubric:: Returns: A new opaque pointer wrapping a SYCL context. .. index:: pair: function; DPCTLContext_Delete .. _doxid-d6/dad/group___context_interface_1ga12d2a8bc191c360fe67eae5e1fc78c63: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`DPCTL_API` void DPCTLContext_Delete(:ref:`__dpctl_take` :ref:`DPCTLSyclContextRef` CtxRef) Delete the pointer after casting it to sycl::context. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - CtxRef - The DPCTLSyclContextRef pointer to be deleted. .. index:: pair: function; DPCTLContext_DeviceCount .. _doxid-d6/dad/group___context_interface_1ga835a44d29be8de2b0b6bf4ccb09578be: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`DPCTL_API` size_t DPCTLContext_DeviceCount(:ref:`__dpctl_keep` const :ref:`DPCTLSyclContextRef` CRef) Returns the number of devices associated with sycl::context referenced by DPCTLSyclContextRef object. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - CRef - DPCTLSyclContexRef object to query. .. rubric:: Returns: A positive count on success or zero on error. .. index:: pair: function; DPCTLContext_GetBackend .. _doxid-d6/dad/group___context_interface_1gaa6a2b2cf4f898df8824da1b52ba9ceb6: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`DPCTL_API` :ref:`DPCTLSyclBackendType` DPCTLContext_GetBackend(:ref:`__dpctl_keep` const :ref:`DPCTLSyclContextRef` CtxRef) Returns the sycl backend for the DPCTLSyclContextRef pointer. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - CtxRef - An opaque pointer to a sycl::context. .. rubric:: Returns: The sycl backend for the DPCTLSyclContextRef returned as a DPCTLSyclBackendType enum type. .. index:: pair: function; DPCTLContext_GetDevices .. _doxid-d6/dad/group___context_interface_1gaba52414ec6b07a3a3364f7a5a2c72b13: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`DPCTL_API` :ref:`__dpctl_give` :ref:`DPCTLDeviceVectorRef` DPCTLContext_GetDevices(:ref:`__dpctl_keep` const :ref:`DPCTLSyclContextRef` CRef) Returns a vector of devices associated with sycl::context referenced by DPCTLSyclContextRef object. .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - CRef - DPCTLSyclContexRef object to query. .. rubric:: Returns: A DPCTLDeviceVectorRef with devices associated with given CRef. .. index:: pair: function; DPCTLContext_Hash .. _doxid-d6/dad/group___context_interface_1gaabd017d7d5a9d8510ebbc97ee272e49d: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`DPCTL_API` size_t DPCTLContext_Hash(:ref:`__dpctl_keep` :ref:`DPCTLSyclContextRef` CtxRef) Wrapper over std::hash's operator() .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - CtxRef - The DPCTLSyclContextRef pointer. .. rubric:: Returns: Hash value of the underlying ``sycl::context`` instance.