arrayfire.device module

Functions to handle the available devices in the backend.

arrayfire.device.alloc_device(num_bytes)[source]

Allocate a buffer on the device with specified number of bytes.

arrayfire.device.alloc_host(num_bytes)[source]

Allocate a buffer on the host with specified number of bytes.

arrayfire.device.alloc_pinned(num_bytes)[source]

Allocate a buffer on the host using pinned memory with specified number of bytes.

arrayfire.device.device_gc()[source]

Ask the garbage collector to free all unlocked memory

arrayfire.device.device_info()[source]
Returns a map with the following fields:
  • ‘device’: Name of the current device.
  • ‘backend’: The current backend being used.
  • ‘toolkit’: The toolkit version for the backend.
  • ‘compute’: The compute version of the device.
arrayfire.device.device_mem_info()[source]
Returns a map with the following fields:
  • ‘alloc’: Contains the map of the following
    • ‘buffers’ : Total number of buffers allocated by memory manager.
    • ‘bytes’ : Total number of bytes allocated by memory manager.
  • ‘lock’: Contains the map of the following
    • ‘buffers’ : Total number of buffers currently in scope.
    • ‘bytes’ : Total number of bytes currently in scope.
arrayfire.device.eval(*args)[source]

Evaluate the input

Parameters:args : arguments to be evaluated
arrayfire.device.free_device(ptr)[source]

Free the device memory allocated by alloc_device

arrayfire.device.free_host(ptr)[source]

Free the host memory allocated by alloc_host

arrayfire.device.free_pinned(ptr)[source]

Free the pinned memory allocated by alloc_pinned

arrayfire.device.get_device()[source]

Returns the id of the current device.

arrayfire.device.get_device_count()[source]

Returns the number of devices available.

arrayfire.device.get_device_ptr(a)[source]

Get the raw device pointer of an array

Parameters:

a: af.Array

  • A multi dimensional arrayfire array.
Returns:
  • internal device pointer held by a
arrayfire.device.info()[source]
Displays the information about the following:
  • ArrayFire build and version number.
  • The number of devices available.
  • The names of the devices.
  • The current device being used.
arrayfire.device.info_str(verbose=False)[source]
Returns information about the following as a string:
  • ArrayFire version number.
  • The number of devices available.
  • The names of the devices.
  • The current device being used.
arrayfire.device.init()[source]
arrayfire.device.is_dbl_supported(device=None)[source]

Check if double precision is supported on specified device.

Parameters:

device: optional: int. default: None.

id of the desired device.

Returns:
  • True if double precision supported.

    • False if double precision not supported.
arrayfire.device.lock_array(a)[source]

Ask arrayfire to not perform garbage collection on raw data held by an array.

Parameters:

a: af.Array

  • A multi dimensional arrayfire array.
arrayfire.device.lock_device_ptr(a)[source]

This functions is deprecated. Please use lock_array instead.

arrayfire.device.set_device(num)[source]

Change the active device to the specified id.

Parameters:

num: int.

id of the desired device.

arrayfire.device.sync(device=None)[source]

Block until all the functions on the device have completed execution.

Parameters:

device: optional: int. default: None.

id of the desired device.

arrayfire.device.unlock_array(a)[source]

Tell arrayfire to resume garbage collection on raw data held by an array.

Parameters:

a: af.Array

  • A multi dimensional arrayfire array.
arrayfire.device.unlock_device_ptr(a)[source]

This functions is deprecated. Please use unlock_array instead.