RecvOperation

Description

Receives data from a specified communication card. Send and Recv must be used together.

Figure 1 Send and Recv data transmission and receiving

Definition

struct RecvParam {
    int rank = 0;
    int rankSize = 0;
    int rankRoot = 0;
    uint32_t srcRank = 1;
    std::string backend = "hccl";
    HcclComm hcclComm = nullptr;
    CommMode commMode = COMM_MULTI_PROCESS;
    std::string rankTableFile;
    std::string commDomain;
    uint8_t rsv[64] = {0};
};

Parameters

Member

Type

Default Value

Description

rank

int

0

Communication ID of the current card

rankSize

int

0

Number of communication cards

rankRoot

int

0

Primary communication rank

srcRank

uint32_t

1

ID of the destination rank

backend

std::string

"hccl"

Communication backend indication. Only "hccl" is supported.

hcclComm

HcclComm

nullptr

Pointer to the HCCL communicator.

By default, this parameter is left blank. The ATB is created by users. If the user wants to manage the communicator, the communicator pointer needs to be passed. The ATB uses the passed communicator pointer to execute the communication operator.

commMode

CommMode

COMM_MULTI_PROCESS

Communication mode. For details, see CommMode. In the scenario where hccl multi-thread is applied, a communicator can only be imported externally.

rankTableFile

std::string

-

Path of the configuration file for cluster information, which applies to single-node and multi-node communication scenarios. Currently, only the HCCL backend is supported. If a ranktable is configured for a single-node system, the ranktable is used to initialize the communicator.

For details about the ranktable configuration, see .

commDomain

std::string

-

Communicator name used by a communication device group when there are multiple communicators. Currently, only hccl is supported.

rsv[64]

uint8_t

{0}

Reserved

Input

Parameter

Dimension

Data Type

Format

Description

x

[d0, ..., dn]

"hccl": float16/float/int8/int16/int32/int64/bf16

ND

Input tensor

Output

Parameter

Dimension

Data Type

Format

Description

output

[d0, ..., dn]

"hccl": float16/float/int8/int16/int32/int64/bf16

ND

Output tensor with the same dimensions as the input.

Restrictions

  • Only the Atlas A2 inference products is supported.
  • rank, rankSize, and rankRoot must meet the following conditions:
    • 0 ≤ rank < rankSize
    • 0 ≤ rankRoot < rankSize
    • 0 ≤ destRank < rankSize
  • If there are multiple users, ATB_SHARE_MEMORY_NAME_SUFFIX (see ATB Environment Variables) needs to be used to distinguish the shared memory and synchronize initialization information.
  • When the communication operator of the ATB exits abnormally, run the following commands to clear the residual data to avoid affecting subsequent operations.
    rm -rf /dev/shm/sem.lccl*
    rm -rf /dev/shm/sem.hccl*
    ipcrm -a