mindspore.hal.max_memory_allocated
- mindspore.hal.max_memory_allocated(device_target=None)[source]
Return the peak memory size of the memory pool actually occupied by Tensor since the process was started. This api will be deprecated and removed in future versions, please use the api
mindspore.runtime.max_memory_allocated()
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"
. DefaultNone
, 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_allocated()) 1536