arrayfire.opencl module

Functions specific to OpenCL backend.

This module provides interoperability with other OpenCL libraries.

class arrayfire.opencl.DEVICE_TYPE[source]

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[source]

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)[source]

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)[source]

Delete a device

Parameters:

dev : cl_device_id

ctx : cl_context

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

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()[source]

Get native (unsorted) OpenCL device ID

Returns:

idx : int.

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:

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)[source]

Set a device as current active device

Parameters:

dev : cl_device_id

ctx : cl_context

arrayfire.opencl.set_device_id(idx)[source]

Set native (unsorted) OpenCL device ID

Parameters:

idx : int.

Specifies the cl_device_id of the device.