Function: unmap_mem

Applicable Products

  • Ascend 950PR&950DT products: Supported
  • Atlas A3 products: Supported
  • Atlas A2 products: Supported
  • Atlas 200I/500 A2 inference products: Supported
  • Atlas inference products: Supported
  • Atlas training products: Supported

Function

Unmaps virtual memory from physical memory.

This API needs to work with other APIs to allocate virtual memory with consecutive addresses and maximize the use of physical memory.

  1. Call acl.rt.reserve_mem_address to allocate virtual memory.
  2. Call acl.rt.malloc_physical to allocate physical memory.
  3. Call acl.rt.map_mem to map the virtual memory to the physical memory.
  4. Call specific task APIs to execute tasks.
  5. Call acl.rt.unmap_mem to cancel the mapping between the virtual memory and the physical memory.
  6. Call acl.rt.free_physical to free the physical memory.
  7. Call acl.rt.release_mem_address to free the virtual memory.

Prototype

  • C Prototype

    aclError aclrtUnmapMem(void *virPtr)
    
  • Python Function

    ret = acl.rt.unmap_mem(vir_ptr)
    

Parameters

Parameter Description
vir_ptr Int, virtual address to be unmapped.

Return Values

Return Value Description
ret Int, error code. If 0 is returned, the operation is successful. If other values are returned, the operation fails.

Constraints

On Atlas 200I/500 A2 inference products, this API cannot be called in Ascend RC mode.