aclrtMemP2PMap

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

Atlas inference product

Atlas training product

Function

Establishes a memory page table mapping between two devices in the same process to implement cross-device memory access. However, before performing this operation, you need to call aclrtDeviceEnablePeerAccess to enable data exchange between the two devices.

After this API is called to establish page table mapping, memory page faults will not occur during cross-device access, and the performance is better when the memory is accessed for the first time.

Prototype

1
aclError aclrtMemP2PMap(void *devPtr, size_t size, int32_t dstDevId, uint64_t flags)

Parameters

Parameter

Input/Output

Description

devPtr

Input

Device memory address (for example, the device memory allocated by calling aclrtMalloc). Here, it refers to the memory address of the shared memory provider.

size

Input

Memory size, in bytes

dstDevId

Input

Device ID, which indicates the ID of the shared memory user.

flags

Input

Reserved. The value is fixed at 0.

Returns

0 on success; else, failure. For details, see aclError.