HcommBatchModeStart

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

x

Atlas inference product

x

Atlas training product

x

For Atlas A2 training product/Atlas A2 inference product, only the Atlas 800T A2 training server, Atlas 900 A2 PoD cluster basic unit, and Atlas 200T A2 Box16 heterogeneous subrack are supported.

Function

Enables the batch mode. All data plane API calls (such as HcommLocalCopy and HcommWrite) called between HcommBatchModeStart and HcommBatchModeEnd will be cached instead of being executed immediately. All operations will be submitted and executed collectively when HcommBatchModeEnd is called.

Prototype

1
int32_t HcommBatchModeStart(const char *batchTag)

Parameters

Parameter

Input/Output

Description

batchTag

Input

(Optional) Batch task identifier. If NULL or an empty string is passed, it indicates that the task is a temporary batch task and will not be cached after execution. If a non-empty string is passed, it is used for subsequent identification and management of the batch task.

Note that in scenarios where the communication engine is AICPU+TS, the task cache management feature based on non-empty identifiers is currently not fully supported.

Returns

int32_t: 0 on success; else, failure.

Restrictions

  1. HcommBatchModeStart and HcommBatchModeEnd must be called in pairs and executed in the same thread.
  2. Operations cached in batch mode will be collectively executed only after the HcommBatchModeEnd call.
  3. Only the Atlas 350 Accelerator Card supports both batch mode and immediate execution mode (without calling batch APIs). Other products must use batch mode.

Example

1
2
3
4
5
6
7
8
9
char *tag = "";
// Start the batch mode (a temporary batch task).
HcommBatchModeStart(tag);

// In batch mode, calls to data plane APIs are not executed immediately.
// ...

// End the batch mode and trigger execution.
HcommBatchModeEnd(tag);