SendOperation

Applicable Products

Hardware Model

Supported or Not

Atlas 350 accelerator card

x

Atlas A3 inference products/Atlas A3 training products

Atlas A2 training products/Atlas A2 inference products

Atlas training products

x

Atlas inference products

x

Atlas 200I/500 A2 inference products

x

Description

Sends the input of the current communication card to the specified communication card. Send and Recv must be used together.

Figure 1 Send and Recv data transmission and receiving

Definition

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
struct SendParam {
    int rank = 0;
    int rankSize = 0;
    int rankRoot = 0;
    uint32_t destRank = 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

destRank

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, 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

[dim_0, dim_1, ..., dim_n]

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

ND

Input tensor.

Restrictions

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