SetOpType

Function

Sets the communication task type.

Prototype

1
uint32_t SetOpType(uint32_t opType)

Parameters

Table 1 Parameters

Parameter

Input/Output

Description

opType

Input

Type of a communication task. The type is uint32_t. HCCL APIs provide the enumeration definition HcclCMDType as the value of the parameter.

For the Atlas A2 training products/Atlas A2 inference products, the supported communication task types are HCCL_CMD_ALLREDUCE, HCCL_CMD_ALLGATHER, HCCL_CMD_REDUCE_SCATTER, HCCL_CMD_ALLTOALL, and HCCL_CMD_BATCH_WRITE.

For the Atlas A3 training products/Atlas A3 inference products, the supported communication task types are HCCL_CMD_ALLREDUCE, HCCL_CMD_ALLGATHER, HCCL_CMD_REDUCE_SCATTER, HCCL_CMD_ALLTOALL, HCCL_CMD_ALLTOALLV, and HCCL_CMD_BATCH_WRITE.

Returns

  • 0: Setting succeeded.
  • Other values: Setting failed.

Restrictions

None

Example

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
const char *groupName = "testGroup";
uint32_t opType = HCCL_CMD_REDUCE_SCATTER;
std::string algConfig = "ReduceScatter=level0:doublering";
AscendC::Mc2CcTilingConfig mc2CcTilingConfig(groupName, opType, algConfig, HCCL_REDUCE_RESERVED);
mc2CcTilingConfig.SetReduceType(HCCL_REDUCE_SUM);
mc2CcTilingConfig.GetTiling(tiling->mc2InitTiling);
mc2CcTilingConfig.GetTiling(tiling->reduceScatterTiling);

algConfig = "AllGather=level0:doublering";
mc2CcTilingConfig.SetGroupName(groupName);
mc2CcTilingConfig.SetOpType(HCCL_CMD_ALLGATHER); // Set the communication task type.
mc2CcTilingConfig.SetAlgConfig(algConfig);
mc2CcTilingConfig.SetSkipLocalRankCopy(0);
mc2CcTilingConfig.SetSkipBufferWindowCopy(1);
mc2CcTilingConfig.GetTiling(tiling->allGatherTiling);