GetBlockNum

Supported Products

Product

Supported/Unsupported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

Atlas inference product's AI Core

Atlas inference product's Vector Core

x

Atlas training products

Function Usage

Obtains the number of cores configured for the current task, which is used for multi-core logic control in the code.

Prototype

1
__aicore__ inline int64_t GetBlockNum()

Parameters

None

Return Value Description

Number of cores configured for the current task

Constraints

None

Example

1
2
3
4
5
6
#include "kernel_operator.h"
// Use block_num for simple tiling computation in the core. It is recommended that complex tiling be performed on the host.
__aicore__ inline void InitTilingParam(int32_t& totalSize, int32_t& loopSize)
{
    loopSize = totalSize / AscendC::GetBlockNum();
};