HCCL Template Parameters

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

x

Atlas inference product AI Core

x

Atlas inference product Vector Core

x

Atlas training product

x

Function Usage

The template parameters need to be passed when an HCCL object is created.

Prototype

The HCCL class is defined as follows. For details about the template parameters, see Table 1 HCCL class template parameters.

1
2
template <HcclServerType serverType = HcclServerType::HCCL_SERVER_TYPE_AICPU, const auto &config = DEFAULT_CFG>
class Hccl;

Parameters

Table 1 HCCL class template parameters

Parameter

Description

serverType

Supported server type. The HcclServerType type is defined as follows:

For the Atlas A2 training product/Atlas A2 inference product, only HCCL_SERVER_TYPE_AICPU is supported currently.

For the Atlas A3 training product/Atlas A3 inference product, only HCCL_SERVER_TYPE_AICPU is supported currently.

For the Atlas 350 Accelerator Card, only HCCL_SERVER_TYPE_CCU is supported currently.

1
2
3
4
5
enum HcclServerType {
HCCL_SERVER_TYPE_AICPU = 0,
HCCL_SERVER_TYPE_CCU,
HCCL_SERVER_TYPE_END // Reserved.
}

config

Specifies the core that delivers tasks to the server. The type is HcclServerConfig, which is defined as follows. The default value is DEFAULT_CFG = {CoreType::DEFAULT, 0}.

1
2
3
4
struct HcclServerConfig {
    CoreType type;  // Type of the core that delivers tasks to the server.
    int64_t blockId;  // ID of the core that delivers tasks to the server.
};

CoreType is defined as follows:

1
2
3
4
5
enum class CoreType: uint8_t {
    DEFAULT,  // No AIC or AIV core is specified.
    ON_AIV,     // AIV core is specified.
    ON_AIC     // AIC core is specified.
};

Returns

None

Constraints

None

Examples

Create an HCCL object by passing the template parameter config. Specify that the HCCL client sends communication messages to the server only on core 10 of AIV, instead of specifying the running core by calling the GetBlockIdx API.
1
2
3
4
5
6
static constexpr HcclServerConfig HCCL_CFG = {CoreType::ON_AIV, 10};
// Select AI CPU as the server.
Hccl<HcclServerType::HCCL_SERVER_TYPE_AICPU, HCCL_CFG> hccl; 

// Select CCU as the server.
Hccl<HcclServerType::HCCL_SERVER_TYPE_CCU, HCCL_CFG> hccl;