mindspore.hal.max_memory_reserved

View Source On Gitee
mindspore.hal.max_memory_reserved(device_target=None)[source]

Returns the peak value of the total memory managed by the memory pool since the process was started. This api will be deprecated and removed in future versions, please use the api mindspore.runtime.max_memory_reserved() instead.

Note

  • For the CPU device, 0 is always returned.

Parameters

device_target (str, optional) – The target device specified, should be one of "CPU" , "GPU" and "Ascend" . Default None , represents the current device set by context.

Returns

int, in Byte.

Examples

>>> import mindspore
>>> a = mindspore.tensor(mindspore.ops.ones([1, 2]), mindspore.float32)
>>> b = mindspore.tensor(mindspore.ops.ones([1, 2]), mindspore.float32)
>>> c = mindspore.ops.add(a, b).asnumpy()
>>> print(mindspore.hal.max_memory_reserved())
1073741824