LayerSynchronizer

An abstract class that users need to inherit from and implement the related APIs. Currently, this class contains only the synchronize_layer API.

Applicability

Product

Supported

Atlas A3 training products/Atlas A3 inference products

√

Atlas A2 training products/Atlas A2 inference products

√

Atlas 200I/500 A2 inference products

x

Atlas inference products

x

Atlas training products

x

Note: For the Atlas A2 training products/Atlas A2 inference products, only the Atlas 800I A2 inference server, Atlas 300I A2 inference card, and A200I A2 Box heterogeneous components are supported.

Function Description

Waits for the specified layer of the model to complete execution. Users need to inherit from LayerSynchronizer and implement this API.

This API is called during the execution of transfer_cache_async. When the API returns a success status, the cache transmission for the current layer begins.

Prototype

1
synchronize_layer(layer_index: int, timeout_in_millis: Optional[int]) -> bool

Parameters

Parameter

Data Type

Description

layer_index

int

Index of a layer.

timeout_in_millis

Optional[int]

Timeout interval, which is not supported currently.

Example

This API is not directly called by users. Instead, it is called by CacheManager as a callback function.

Returns

In normal cases, a message is returned, indicating that whether the synchronization is successful.

If a parameter is incorrect, a TypeError or ValueError may be thrown.

Restrictions

None