The API call sequence for data transfer is as follows:
The implementation logic of loading data to the memory is managed by the user.
Data transfer within the host, within the device, or between the host and device can be implemented by using the memory copy API calls or by using pointers.
For the Ascend 310 AI Processor in Ascend RC mode, host memory allocation and data transfer within the host or between the host and device are not involved.
Call aclrtGetRunMode to obtain the run mode of the software stack. If ACL_HOST is returned, you only need to allocate host memory. If ACL_DEVICE is returned, you only need to allocate device memory. Although more code logic judgment is introduced, you do not need to care about address alignment of device memory. In the scenario where your app runs on the device, this mode does not require memory copy and promises better performance.
aclrtGetRunMode does not need to be called to obtain the run mode of the software stack. The code logic is simpler. However, address alignment of device memory needs to be guaranteed by the user.