HcclServerType
Function
Sets the HCCL server type.
Prototype
1
|
void HcclServerType(enum HcclServerType type, const char *soc=nullptr) |
Parameters
|
Parameter |
Input/Output |
Description |
||
|---|---|---|---|---|
|
type |
Input |
HCCL server type. The type is the HcclServerType enumeration class, which is defined as follows:
|
||
|
soc |
Input |
Ascend AI Processor model. Configure the server type for the model. This parameter is optional. If it is set to nullptr or "", the server type is configured for all models supported by the operator. Ensure that the value of soc is within the range of Ascend AI Processor models supported by the operator, that is, the AddConfig API has been called for registration. For details about the rules, see the ASCEND_COMPUTE_UNIT field in the build configuration file CMakePresets.json in the operator project directory. The value of this field is automatically generated when msOpGen is used to create a project. |
Restrictions
- Before using this API, you need to register the operator as an MC2 operator through the MC2 API. After the registration, an OpMC2Def structure is returned.
- When the server type is configured for a specific Ascend AI Processor model and all Ascend AI Processor models, the configuration for the specific Ascend AI Processor model has a higher priority.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
class MC2Custom : public OpDef { public: MC2Custom(const char* name) : OpDef(name) { this->Input("x").ParamType(REQUIRED).DataType({ge::DT_FLOAT}).Format({ge::FORMAT_ND}); this->Input("y").ParamType(REQUIRED).DataType({ge::DT_FLOAT}).Format({ge::FORMAT_ND}); this->Output("z").ParamType(REQUIRED).DataType({ge::DT_FLOAT}).Format({ge::FORMAT_ND}); this->Attr("group").AttrType(REQUIRED).String(); this->AICore().AddConfig("ascendxxx1"); this->AICore().AddConfig("ascendxxx2"); this->MC2().HcclGroup("group"); // Set the communicator name to group. this->MC2().HcclServerType(HcclServerType::AICPU, "ascendxxx1"); // Set the communication mode of the ascendxxx1 model to AI CPU. this->MC2().HcclServerType(HcclServerType::AICORE); // Set the communication mode of the ascendxxx2 model to AI Core. } }; OP_ADD(MC2Custom); |