HcclCommMemReg
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
x |
|
x |
|
x |
|
x |
|
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:
|
||
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:
|
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); |
Parent topic: Communicator Resource Management