mindspore.runtime.PluggableAllocator
- class mindspore.runtime.PluggableAllocator(path_to_so_file: str, alloc_fn_name: str, free_fn_name: str)[source]
Receive a .so file via ctypes, and dynamically load the alloc and free functions within it. It needs to be used in conjunction with
mindspore.runtime.MemPool
andmindspore.runtime.use_mem_pool()
to take over the memory allocation and free in the MindSpore memory pool.Warning
This is currently supported only in unix OSs.
- Parameters
path_to_so_file (str) – Path in the file system to the .so file containing the allocator functions.
alloc_fn_name (str) – Name of the function to perform the memory allocation in the so file. The signature must be: void* alloc_fn(size_t size, int device, aclrtStream stream); .
free_fn_name (str) – Name of the function to perform the memory release in the so file. The signature must be: void free_fn(void* ptr, size_t size, aclrtStream stream); .
- Supported Platforms:
Ascend