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]¶
‘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]¶
‘buffers’ : Total number of buffers allocated by memory manager.
‘bytes’ : Total number of bytes allocated by memory manager.
‘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
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.
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
A multi dimensional arrayfire array.
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]¶
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]¶
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.
id of the desired device.
False if double precision not supported.
arrayfire.device.
is_half_supported
(device=None)[source]¶
Check if half precision is supported on specified device.
id of the desired device.
False if half precision not supported.
arrayfire.device.
is_locked_array
(a)[source]¶
Check if the input array is locked by the user.
A multi dimensional arrayfire array.
arrayfire.device.
lock_array
(a)[source]¶
Ask arrayfire to not perform garbage collection on raw data held by an array.
A multi dimensional arrayfire array.
arrayfire.device.
lock_device_ptr
(a)[source]¶
This functions is deprecated. Please use lock_array instead.
arrayfire.device.
print_mem_info
(title='Memory Info', device_id=None)[source]¶
Prints the memory used for the specified device.
Title to display before printing the memory info.
Specifies the device for which the memory info should be displayed.
If None, uses the current device.
Examples
>>> a = af.randu(5,5) >>> af.print_mem_info() Memory Info --------------------------------------------------------- | POINTER | SIZE | AF LOCK | USER LOCK | --------------------------------------------------------- | 0x706400000 | 1 KB | Yes | No | --------------------------------------------------------- >>> b = af.randu(5,5) >>> af.print_mem_info() Memory Info --------------------------------------------------------- | POINTER | SIZE | AF LOCK | USER LOCK | --------------------------------------------------------- | 0x706400400 | 1 KB | Yes | No | | 0x706400000 | 1 KB | Yes | No | --------------------------------------------------------- >>> a = af.randu(1000,1000) >>> af.print_mem_info() Memory Info --------------------------------------------------------- | POINTER | SIZE | AF LOCK | USER LOCK | --------------------------------------------------------- | 0x706500000 | 3.815 MB | Yes | No | | 0x706400400 | 1 KB | Yes | No | | 0x706400000 | 1 KB | No | No | ---------------------------------------------------------
arrayfire.device.
set_device
(num)[source]¶
Change the active device to the specified id.
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.
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.
id of the desired device.
arrayfire.device.
unlock_array
(a)[source]¶
Tell arrayfire to resume garbage collection on raw data held by an array.
A multi dimensional arrayfire array.
arrayfire.device.
unlock_device_ptr
(a)[source]¶
This functions is deprecated. Please use unlock_array instead.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4