GetBlockNum

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

Returns

Number of cores configured for the current task

Availability

Atlas Training Series Product

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();
};