HcclSymWinGetPeerPointer

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

Obtains the virtual address pointer on the symmetric memory for a rank ID, based on the symmetric memory window handle and offset.

Prototype

1
HcclResult HcclSymWinGetPeerPointer(HcclCommSymWindow winHandle, size_t offset, uint32_t peerRank, void** ptr)

Parameters

Parameter

Input/Output

Description

winHandle

Input

Symmetric memory window resource handle.

offset

Input

Offset obtained by using HcclCommSymWinGet.

peerRank

Input

Rank ID. The value ranges from 0 to rankSize (excluded).

ptr

Output

Pointer to the virtual address in the symmetric memory.

Returns

HcclResult: HCCL_SUCCESS on success, or else failure.

Constraints

Call Example

After the symmetric memory window is registered on the host, the window is passed to the AICPU kernel as a parameter. This function needs to be compiled and executed on the device AICPU. The following is the pseudocode:

AicpuKernelFunc(param):
// Obtain the symmetric window from param.
HcclCommSymWindow temp_win = param.win;
void *src_ptr;
void *dest_ptr;
int srcRankId = 0;
int destRankId = 1;
// Use win + offset + peerRank to obtain the address corresponding to peerRank.
HcclSymWinGetPeerPointer(temp_win, 0, srcRankId, &src_ptr);
HcclSymWinGetPeerPointer(temp_win, 0, destRankId, &dest_ptr);
// The obtained address can be directly read and written using the local copy on the data plane. The thread and size need to be prepared by the caller.
HcommLocalCopyOnThread(thread, dest_ptr, src_ptr, size);