# arrayfire.opencl module

Functions specific to OpenCL backend.

This module provides interoperability with other OpenCL libraries.

class `arrayfire.opencl.``DEVICE_TYPE`

  Bases: `arrayfire.library._Enum`

  ArrayFire wrapper for CL_DEVICE_TYPE

  `ACC` = <arrayfire.opencl.DEVICE_TYPE object>
  `CPU` = <arrayfire.opencl.DEVICE_TYPE object>
  `GPU` = <arrayfire.opencl.DEVICE_TYPE object>
  `UNKNOWN` = <arrayfire.opencl.DEVICE_TYPE object>

class `arrayfire.opencl.``PLATFORM`

  Bases: `arrayfire.library._Enum`

  ArrayFire enum for common platforms

  `AMD` = <arrayfire.opencl.PLATFORM object>
  `APPLE` = <arrayfire.opencl.PLATFORM object>
  `BEIGNET` = <arrayfire.opencl.PLATFORM object>
  `INTEL` = <arrayfire.opencl.PLATFORM object>
  `NVIDIA` = <arrayfire.opencl.PLATFORM object>
  `POCL` = <arrayfire.opencl.PLATFORM object>
  `UNKNOWN` = <arrayfire.opencl.PLATFORM object>

`arrayfire.opencl.``add_device_context`(dev, ctx, que)

  Add a new device to arrayfire opencl device manager

  Parameters: | dev : cl_device_id ctx : cl_context que : cl_command_queue

`arrayfire.opencl.``delete_device_context`(dev, ctx)

  Delete a device

  Parameters: | dev : cl_device_id ctx : cl_context

`arrayfire.opencl.``get_context`(retain=False)

  Get the current OpenCL context being used by ArrayFire.

  Parameters:

  retain : bool. optional. Default: False.

  > Specifies if the context needs to be retained by arrayfire before returning.

  Returns: | context : integer denoting the context id.

`arrayfire.opencl.``get_device_id`()

  Get native (unsorted) OpenCL device ID

  Returns:

  idx : int.

  > Specifies the cl_device_id of the device.

`arrayfire.opencl.``get_device_type`()

  Get opencl device type

`arrayfire.opencl.``get_platform`()

  Get opencl platform

`arrayfire.opencl.``get_queue`(retain)

  Get the current OpenCL command queue being used by ArrayFire.

  Parameters:

  retain : bool. optional. Default: False.

  > Specifies if the context needs to be retained by arrayfire before returning.

  Returns: | queue : integer denoting the queue id.

`arrayfire.opencl.``set_device_context`(dev, ctx)

  Set a device as current active device

  Parameters: | dev : cl_device_id ctx : cl_context

`arrayfire.opencl.``set_device_id`(idx)

  Set native (unsorted) OpenCL device ID

  Parameters:

  idx : int.

  > Specifies the cl_device_id of the device.