HcclCommMemReg

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

x

Atlas A2 training product/Atlas A2 inference product

x

Atlas 200I/500 A2 inference product

x

Atlas inference product

x

Atlas training product

x

Function

Registers the allocated memory with the communicator and obtains the corresponding registered handle.

Prototype

1
HcclResult HcclCommMemReg(HcclComm comm, const char *memTag, const CommMem *mem, HcclMemHandle *memHandle)

Parameters

Parameter

Input/Output

Description

comm

Input

Communicator handle.

The HcclComm type is defined as follows:

1
typedef void *HcclComm;

memTag

Input

Memory string tag. The maximum length is HCCL_OP_TAG_LEN_MAX.

const uint32_t HCCL_OP_TAG_LEN_MAX = 255;

mem

Input

Memory information. For the definition of the CommMem type, see CommMem.

memHandle

Output

Memory handle.

The definition of the HcclMemHandle type is as follows:

1
typedef void *HcclMemHandle;

Returns

HcclResult: HCCL_SUCCESS on success, or else failure.

Restrictions

  • In a communicator, one memTag can be registered to only one memory block.
  • In a communicator, repeatedly registering the same memTag and mem reuses the existing registered memory handle.
  • In a communicator, memory registration cannot overlap.

Example

1
2
3
4
5
6
7
8
HcclComm comm; // Communicator handle, whose obtainment process is omitted.
char* memTag = "memTag"; // Memory tag
CommMem memInfo; // Memory information
memInfo.addr = 0x00; // Set the address of the allocated memory.
memInfo.size = 1024; // Set the size of the allocated memory.
memInfo.type = COMM_MEM_TYPE_DEVICE; // Set the type of the allocated memory.
HcclMemHandle memHandle; // Memory handle.
HcclCommMemReg(comm, memTag, &memInfo, &memHandle);