percent_used_mem_on_dev#

ivy.percent_used_mem_on_dev(device, /, *, process_specific=False)[source]#

Get the percentage used memory for a given device string. In case of CPU, the used RAM is returned.

Parameters:
  • device (Union[Device, NativeDevice]) – The device string to convert to native device handle.

  • process_specific (bool, default: False) – Whether the check the memory used by this python process alone. Default is False.

Return type:

float

Returns:

ret – The percentage used memory on the device.

Examples

>>> x = ivy.percent_used_mem_on_dev("cpu", process_specific = False)
>>> print(x)
94.036902561555
>>> x = ivy.percent_used_mem_on_dev("cpu", process_specific = True)
>>> print(x)
0.7024003467681645
>>> x = ivy.as_native_dev("gpu:0")
>>> y = ivy.percent_used_mem_on_dev(x, process_specific = False)
>>> print(y)
0.7095597456708771