Function: mem_set_pid_to_shareable_handle

C Prototype

aclError aclrtMemSetPidToShareableHandle(uint64_t shareableHandle, int32_t *pid, size_t pidNum)

Python Function

ret = acl.rt.mem_set_pid_to_shareable_handle(shareable_handle, pid)

Function Usage

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.

Input Description

shareable_handle: int, shareable_handle exported through acl.rt.mem_export_to_shareable_handle.

pid: int, array for storing whitelisted 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

ret: int, error code.

Restrictions

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

This API is not supported in Ascend RC form.