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_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 one or more inputs together
Parameters: args : arguments to be evaluated Examples
>>> a = af.constant(1, 3, 3) >>> b = af.constant(2, 3, 3) >>> c = a + b >>> d = a - b >>> af.eval(c, d) # A single kernel is launched here >>> c arrayfire.Array() Type: float [3 3 1 1] 3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 3.0000 3.0000
>>> d arrayfire.Array() Type: float [3 3 1 1] -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000 -1.0000
-
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.get_manual_eval_flag()[source]¶ Query the backend JIT engine to see if the user disabled heuristic evaluation of the JIT tree.
-
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.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.is_locked_array(a)[source]¶ Check if the input array is locked by the user.
Parameters: a: af.Array
- A multi dimensional arrayfire array.
Returns: A bool specifying if the input array is locked.
-
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.set_manual_eval_flag(flag)[source]¶ Tells the backend JIT engine to disable heuristics for determining when to evaluate a JIT tree.
Parameters: flag : optional: bool.
- Specifies if the heuristic evaluation of the JIT tree needs to be disabled.
-
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.