mindspore.hal.memory_stats
- mindspore.hal.memory_stats(device_target=None)[source]
- Returns status information queried from the memory pool, this api will be deprecated and removed in future versions, please use the api - mindspore.runtime.memory_stats()instead.- Note - For the CPU device, a dictionary with empty data 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
- dict, the queried memory information. 
 - 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.memory_stats()) {'total_reserved_memory': 1073741824, 'total_allocated_memory': 1024, 'total_idle_memory': 1073740800, 'total_eager_free_memory': 0, 'max_reserved_memory': 1073741824, 'max_allocated_memory': 1536, 'common_mem_pool_stats': {'block_unit_size': 1073741824, 'block_counts': 1, 'blocks_info': {<capsule object NULL at 0x7f7e8c27b030>: {'block_stream_id': 0, 'block_memory_size': 1073741824}}}, 'persistent_mem_pool_stats': {'block_unit_size': 1073741824, 'block_counts': 0, 'blocks_info': {}}}