Function: allocator_set_get_addr_from_block_func_to_desc

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas training product

Atlas inference product

Atlas 200I/500 A2 inference product

Function

Sets the callback function for obtaining the device memory address based on the allocated block when the user-provided Allocator is used.

Prototype

  • C Prototype
    1
    aclError aclrtAllocatorSetGetAddrFromBlockFuncToDesc(aclrtAllocatorDesc allocatorDesc, aclrtAllocatorGetAddrFromBlockFunc func)
    
  • Python Function
    1
    ret = acl.rt.allocator_set_get_addr_from_block_func_to_desc(allocatorDesc, func)
    

Parameters

Parameter

Description

allocatorDesc

Int, pointer address of the allocator descriptor. Call acl.rt.allocator_create_desc to set the Allocator description in advance.

func

  • Callback function for obtaining the device memory address based on the allocated block.

    Callback function definition:

    def allocator_get_addr_from_block_func(block):
        pass

Return Value

Returned Value

Description

ret

Int, 0 on success; else, failure.