arrayfire.opencl module

Functions specific to OpenCL backend.

This module provides interoperability with other OpenCL libraries.

class arrayfire.opencl.DEVICE_TYPE(value)[source]

Bases: enum.Enum

ArrayFire wrapper for CL_DEVICE_TYPE

ACC = 8
CPU = 2
GPU = 4
UNKNOWN = -1
class arrayfire.opencl.PLATFORM(value)[source]

Bases: enum.Enum

ArrayFire enum for common platforms

AMD = 0
APPLE = 1
BEIGNET = 4
INTEL = 2
NVIDIA = 3
POCL = 5
UNKNOWN = -1
arrayfire.opencl.add_device_context(dev, ctx, que)[source]

Add a new device to arrayfire opencl device manager

Parameters
devcl_device_id
ctxcl_context
quecl_command_queue
arrayfire.opencl.delete_device_context(dev, ctx)[source]

Delete a device

Parameters
devcl_device_id
ctxcl_context
arrayfire.opencl.get_context(retain=False)[source]

Get the current OpenCL context being used by ArrayFire.

Parameters
retainbool. optional. Default: False.

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

Returns
contextinteger denoting the context id.
arrayfire.opencl.get_device_id()[source]

Get native (unsorted) OpenCL device ID

Returns
idxint.

Specifies the cl_device_id of the device.

arrayfire.opencl.get_device_type()[source]

Get opencl device type

arrayfire.opencl.get_platform()[source]

Get opencl platform

arrayfire.opencl.get_queue(retain)[source]

Get the current OpenCL command queue being used by ArrayFire.

Parameters
retainbool. optional. Default: False.

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

Returns
queueinteger denoting the queue id.
arrayfire.opencl.set_device_context(dev, ctx)[source]

Set a device as current active device

Parameters
devcl_device_id
ctxcl_context
arrayfire.opencl.set_device_id(idx)[source]

Set native (unsorted) OpenCL device ID

Parameters
idxint.

Specifies the cl_device_id of the device.