Restrictions
- It is not allowed to create multiple processes using the fork function and call AscendCL APIs in the created processes. Otherwise, errors may occur or the processes may stop responding in runtime.
- Fork and fork-encapsulated functions, such as system and posix_spawnp, cannot be used during asynchronous memory operations, for example, aclrtMemcpyAsync and aclrtMemsetAsync. Otherwise, unexpected errors even suspension may occur during process runtime.
- For deallocation APIs (such as aclrtDestroyStream, aclrtDestroyEvent, aclrtFree, and aclDestroyDataBuffer), allocations destroyed using these APIs are no longer available. You are advised to set the destroyed allocations to invalid values (for example, NULL) in subsequent API calls.
- A device supports a maximum of 64 user processes.
- When cgroup is configured in the open form, the aclrtMalloc and acldvppMalloc memory management APIs are called in the app logic, and the app runs on the device, the app is suspended in the event of memory insufficiency until memory is available. You can activate some configurations (for example, enable_oom_killer) provided by the OS as required. In this way, the app automatically exits when the memory is insufficient.
To set enable_oom_killer, you need to log in to the device, go to the /proc/sys/vm directory, and activate enable_oom_killer as the root user. The following is a command example, where, 1 indicates activated, and 0 indicates deactivated.
echo 1 > enable_oom_killer
For details about cgroup configuration in open form, see Open-Form Operating Environment Setup Guide.
- After memory is allocated by a call to the AscendCL memory allocation API (such as aclrtMalloc or acldvppMalloc) and before you use the allocated memory, you are advised to call aclrtMemset or aclrtMemsetAsync to initialize the memory, for example, aclrtMemset(devBufferPtr, devBufferSize, 0, devBufferSize).