Function: mem_set_pid_to_shareable_handle

Applicable Products

Product

Supported (√/x)

Ascend 950PR

√

Ascend 950DT

x

Atlas A3 training products/Atlas A3 inference products

√

Atlas A2 training products/Atlas A2 inference products

√

Atlas training products

√

Atlas inference products

√

Atlas 200I/500 A2 inference products

√

√

Description

Sets the trustlist of processes that can share the memory. Only the processes configured with the trustlist 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 Values

Return Value

Description

ret

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

Constraints

This API is used to set the process trustlist while calling the aclrtMemExportToShareableHandle API.

This API is not supported in the Ascend RC form.