Restrictions

Table 1 Restrictions

Category

Restriction

Processes

  • Do not use the fork function to create multiple AscendCL API caller processes, as this may lead to errors or cause processes to stop responding at runtime.
  • For physical machines, a device supports a maximum of 64 user processes, and a host supports a maximum of 64 processes multiplied by the number of devices. For virtual machines, a device supports a maximum of 32 user processes, and a host supports a maximum of 32 processes multiplied by the number of devices.

Allocation and deallocation APIs

  • Use the allocation and deallocation APIs in pairs (for example, the aclrtCreateStream and aclrtDestroyStream pair, the aclrtCreateEvent and aclrtDestroyEvent pair, and the aclCreateDataBuffer and aclDestroyDataBuffer pair). Ensure that any allocations that are no longer needed are destroyed in a timely manner, as failure to do so may impact the app's ability to function properly.
  • Once a deallocation API (such as aclrtDestroyStream, aclrtDestroyEvent, aclrtFree, or aclDestroyDataBuffer) is called, the allocation is destroyed and is no longer available. Consequently, it is a good practice to set the allocation to an invalid value (for example, NULL) in subsequent API calls.

Memory

  • Do not use fork or fork-encapsulated functions (such as system and posix_spawnp) for asynchronous memory manipulations (by using calls to APIs such as aclrtMemcpyAsync and aclrtMemsetAsync). Doing so may result in unexpected errors at runtime and may possibly cause the process to stop responding.
  • 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 first use the aclrtMemset or aclrtMemsetAsync call to initialize the memory, for example, aclrtMemset(devBufferPtr, devBufferSize, 0, devBufferSize).