Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
☓ |
√ |
|
☓ |
|
☓ |
|
☓ |
|
☓ |
Obtains the virtual address pointer on the symmetric memory for a rank ID, based on the symmetric memory window handle and offset.
1 | HcclResult HcclSymWinGetPeerPointer(HcclCommSymWindow winHandle, size_t offset, uint32_t peerRank, void** ptr) |
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. |
HcclResult: HCCL_SUCCESS on success, or else failure.
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);