Function: mem_set_pid_to_shareable_handle

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

Description

Set the whitelist of processes that can share the memory. Only the processes configured with the whitelist can use the shareable_handle exported by acl.rt.mem_export_to_shareable_handle.

This API must work with other APIs to implement memory sharing. For details, see the description of acl.rt.mem_export_to_shareable_handle.

Prototype

  • C Prototype
    1
    aclError aclrtMemSetPidToShareableHandle(uint64_t shareableHandle, int32_t *pid, size_t pidNum)
    
  • Python Function
    1
    ret = acl.rt.mem_set_pid_to_shareable_handle(shareable_handle, pid)
    

Parameters

Parameter

Description

shareable_handle

Int, shareable handle exported through the acl.rt.mem_export_to_shareable_handle API.

pid

List, array for storing trustlisted process IDs.

You can call acl.rt.device_get_bare_tgid to obtain the process ID. In the Docker scenario, the process ID on the physical machine is obtained. In the non-Docker scenario, the process ID is obtained.

Return Value

Return Value

Description

ret

Int, error code. 0 on success; else, failure.

Restrictions

In the process that calls the aclrtMemExportToShareableHandle API, call this API to set the process whitelist.

Ascend RC does not support this API.