Memory management API

表1 Memory management API

API接口

说明

beta)torch_npu.npu.caching_allocator_alloc

torch_npu提供内存管理相关的部分接口,具体可参考torch.cuda

beta)torch_npu.npu.caching_allocator_delete

beta)torch_npu.npu.set_per_process_memory_fraction

beta)torch_npu.npu.empty_cache

beta)torch_npu.npu.memory_stats

beta)torch_npu.npu.memory_stats_as_nested_dict

beta)torch_npu.npu.reset_accumulated_memory_stats

beta)torch_npu.npu.reset_peak_memory_stats

beta)torch_npu.npu.reset_max_memory_allocated

beta)torch_npu.npu.reset_max_memory_cached

beta)torch_npu.npu.memory_allocated

beta)torch_npu.npu.max_memory_allocated

beta)torch_npu.npu.memory_reserved

beta)torch_npu.npu.max_memory_reserved

beta)torch_npu.npu.memory_cached

beta)torch_npu.npu.max_memory_cached

beta)torch_npu.npu.memory_snapshot

beta)torch_npu.npu.memory_summary

torch_npu.npu.empty_virt_addr_cache

轻量化empty_cache,只释放虚拟内存,调用方式与torch_npu.npu.empty_cache类似。

torch_npu.npu.NPUPluggableAllocator

该接口涉及高危操作,具体使用方法请参考torch_npu.npu.NPUPluggableAllocator

torch_npu.npu.change_current_allocator

该接口涉及高危操作,具体使用方法请参考torch_npu.npu.change_current_allocator

torch_npu.npu.host_empty_cache

释放当前由缓存持有的所有未占用的host物理内存。