aclrtMemExportToShareableHandleV2
Applicable Products
Product |
Supported |
|---|---|
√ |
|
☓ |
|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Function
Exports the physical device memory handle obtained by the current process through the aclrtMallocPhysical API so that the physical memory can be shared with other processes.
This API is enhanced based on aclrtMemExportToShareableHandle. You can use the shareType parameter to specify whether to export a shareableHandle within an AI server or from another AI server. An AI server is an umbrella term for a server consisting of multiple devices.
The usage of this API is similar to that of aclrtMemExportToShareableHandle. However, this API must be used together with aclrtMemSetPidToShareableHandleV2 to set the process trustlist and with aclrtMemImportFromShareableHandleV2 to import a shareableHandle.
Prototype
1 | aclError aclrtMemExportToShareableHandleV2(aclrtDrvMemHandle handle, uint64_t flags, aclrtMemSharedHandleType shareType, void *shareableHandle) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
handle |
Input |
Handle for storing physical memory information. For details about the type definition, see aclrtDrvMemHandle. You need to call aclrtMallocPhysical in this process to allocate physical memory. If this API is successfully called, a handle is returned. Each handle must correspond to only one shareableHandle. In the same process, one-to-many or many-to-one mapping is not allowed. Otherwise, an error is reported. For example, if this API is repeatedly called to export data, an error is reported. |
flags |
Input |
Whether to enable process trustlist verification. The value can be either of the following macros:
The macros are defined as follows: #define ACL_RT_VMM_EXPORT_FLAG_DEFAULT 0x0UL #define ACL_RT_VMM_EXPORT_FLAG_DISABLE_PID_VALIDATION 0x1UL |
shareType |
Input |
Type of the exported shareableHandle. For details about the type definition, see aclrtMemSharedHandleType. |
shareableHandle |
Output |
Pointer to the shareableHandle. The memory to which the pointer points is provided by the caller. The size depends on shareType. If shareType is ACL_MEM_SHARE_HANDLE_TYPE_DEFAULT, the pointer points to an uint64_t variable. If shareType is ACL_MEM_SHARE_HANDLE_TYPE_FABRIC, the pointer points to an aclrtMemFabricHandle structure. typedef struct aclrtMemFabricHandle {
uint8_t data[128];
} aclrtMemFabricHandle;
|
Returns
0 on success; otherwise, failure. For details, see aclError.
Restrictions
Atlas 200I/500 A2 inference products in Ascend RC form: This API is not supported.
- Inter-process physical memory sharing within an AI server is supported. If inter-device sharing is required, call the aclrtDeviceEnablePeerAccess API.
- Inter-process, cross-AI server physical memory sharing is only supported by the
Atlas A3 training products /Atlas A3 inference products . - This API does not support the Ascend virtual instance scenario.
- This API does not support the computing power allocation scenario. For details about computing power allocation APIs, see Group Management.