GetCoreNum

Function Usage

Obtains the number of cores on the current hardware platform. If the AI Core architecture is cube/vector separated, the number of vector cores is returned. If the architecture is coupled, the number of AI Cores is returned.

Prototype

1
uint32_t GetCoreNum(void) const

Parameters

None

Returns

Atlas training product: In coupled mode, the number of AI Cores is returned.

Atlas inference product: In coupled mode, the number of AI Cores is returned.

Atlas A2 training product/Atlas A2 inference product: In separated mode, the number of Vector Cores is returned.

Atlas A3 training product/Atlas A3 inference product: In separated mode, the number of Vector Cores is returned.

Atlas 350 Accelerator Card: In separated mode, the number of Vector Cores is returned.

Restrictions

None

Examples

1
2
3
4
5
6
7
ge::graphStatus TilingXXX(gert::TilingContext* context) {
    auto ascendcPlatform = platform_ascendc::PlatformAscendC(context->GetPlatformInfo());
    auto coreNum = ascendcPlatform.GetCoreNum();
    // ... Design the tiling policy based on the number of cores.
    context->SetBlockDim(coreNum);
    return ret;
}