# arrayfire.device module

Functions to handle the available devices in the backend.

`arrayfire.device.``alloc_device`(num_bytes)

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

`arrayfire.device.``alloc_host`(num_bytes)

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

`arrayfire.device.``alloc_pinned`(num_bytes)

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

`arrayfire.device.``device_gc`()

  Ask the garbage collector to free all unlocked memory

`arrayfire.device.``device_info`()
  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`()
  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)

  Evaluate the input

  Parameters: | args : arguments to be evaluated

`arrayfire.device.``free_device`(ptr)

  Free the device memory allocated by alloc_device

`arrayfire.device.``free_host`(ptr)

  Free the host memory allocated by alloc_host

`arrayfire.device.``free_pinned`(ptr)

  Free the pinned memory allocated by alloc_pinned

`arrayfire.device.``get_device`()

  Returns the id of the current device.

`arrayfire.device.``get_device_count`()

  Returns the number of devices available.

`arrayfire.device.``get_device_ptr`(a)

  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`()
  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)
  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`()

`arrayfire.device.``is_dbl_supported`(device=None)

  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)

  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)

  This functions is deprecated. Please use lock_array instead.

`arrayfire.device.``set_device`(num)

  Change the active device to the specified id.

  Parameters:

  num: int.

  > id of the desired device.

`arrayfire.device.``sync`(device=None)

  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)

  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)

  This functions is deprecated. Please use unlock_array instead.