aclrtMemP2PMap

Applicable Products

Product

Supported

Ascend 950PR/Ascend 950DT

√

Atlas A3 training products/Atlas A3 inference products

√

Atlas A2 training products/Atlas A2 inference products

√

Atlas 200I/500 A2 inference products

☓

Atlas inference products

√

Atlas training products

√

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; otherwise, failure. For details, see aclError.