TransferSync

Applicability

Product

Supported (√/x)

Atlas 350 Accelerator Card

x

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

Note: For Atlas A2 training product / Atlas A2 inference product , only the Atlas 800I A2 inference server and A200I A2 Box heterogeneous subrack are supported.

Function Description

Transmits memory with the remote AdxlEngine instance.

Prototype

1
2
3
4
Status TransferSync(const AscendString &remote_engine,
                    TransferOp operation,
                    const std::vector<TransferOpDesc> &op_descs,
                    int32_t timeout_in_millis = 1000)

Parameters

Parameter

Input/Output

Description

remote_engine

Input

Unique identifier of the remote AdxlEngine instance.

operation

Input

Reading the remote memory to the local side or writing the local memory to the remote side.

op_descs

Input

Local and remote addresses for batch operations.

timeout_in_millis

Input

Link disconnection timeout interval, in milliseconds. The default value is 1000.

Example

Click Gitee, download the sample package of the matching version based on the tag name, and obtain the sample from the cplusplus/level1_single_api/12_adxl directory.

Returns

  • SUCCESS: Success.
  • PARAM_INVALID: Incorrect parameter.
  • NOT_CONNECTED: No link is established with the peer end.
  • TIMEOUT: Transmission timeout.
  • Other values: Failure.

Restrictions

  • Before calling this API, call the Connect API to establish a link with the peer end.
  • This API and Initialize must run in the same thread. If you need to switch threads to call this API, first call aclrtGetCurrentContext in Application Development (C&C++) in the thread where Initialize is running to obtain the context. Then, in the new thread, call aclrtSetCurrentContext in Application Development (C&C++) to set the context.
  • The relay memory pool is enabled by default. If the data in op_descs is less than 256 KB, the relay transmission mode is used by default to optimize performance. Otherwise, the system determines whether to use relay transmission or direct transmission based on whether there is any unregistered memory.
  • When the relay memory pool is enabled, if either the local memory or remote memory in op_descs is not registered, the system will determine that relay transmission mode should be used. Unregistered memory is considered as host memory, and users must ensure that the addresses are valid.
  • In relay transmission mode, all entries in op_descs must have the same transmission type. For example, all entries involve writing from local host memory to remote host memory.