---
title: 使用约束
description: "- 进入系统休眠前，需要确保将正在运行的AI推理业务、媒体数据处理业务等进程退出。等待唤醒成功后，再继续执行业务。"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/programug/acldevg/aclpythondevg_0094.html
sourcePath: /source/zh/canncommercial/900/programug/acldevg/aclpythondevg_0094.html
indexId: 68e87134432c0401359fe1eb4a0a451bf77c964954e3b3926e102c1d5d8af8b971
---
# 使用约束

- 进入系统休眠前，需要确保将正在运行的AI推理业务、媒体数据处理业务等进程退出。等待唤醒成功后，再继续执行业务。
- 不支持使用fork函数创建多个进程，且在进程中调用pyacl接口的场景，否则进程运行时会报错或者卡死。
- 不支持在  acl.rt.memcpy_async(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0119.html)
、  acl.rt.memset_async(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0119.html)
接口等异步操作内存过程中使用fork以及封装了fork的函数，如system、posix_spawnp等，否则会导致进程运行时会报错，甚至卡死等不可预期的错误。
- 对于创建类接口（例如：  acl.rt.create_stream(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0079.html)
、  acl.rt.create_event(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0090.html)
、  acl.create_data_buffer(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0016.html)
等），用户调用该类接口创建对应的资源后，资源使用完成后，建议及时调用对应的销毁类接口（例如：  acl.rt.destroy_stream(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0081.html)
、  acl.rt.destroy_event(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0092.html)
、  acl.destroy_data_buffer(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0017.html)
等），否则，程序可能会异常。
- 对于销毁类接口（例如：  acl.rt.destroy_stream(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0081.html)
、  acl.rt.destroy_event(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0092.html)
、  acl.rt.free(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0115.html)
、  acl.destroy_data_buffer(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0017.html)
等），用户调用该类接口后，不能继续使用已释放或销毁的资源，建议用户调用销毁类接口后，将相关资源设置为无效值（例如，设置为None）。
- 对于Atlas 训练系列产品，物理机场景下，一个Device上最多只能支持64个用户进程，Host最多只能支持Device个数*64个进程；虚拟机场景下，一个Device上最多只能支持32个用户进程，Host最多只能支持Device个数*32个进程。
- 对于Atlas 推理系列产品，物理机场景下，一个Device上最多只能支持64个用户进程，Host最多只能支持Device个数*64个进程；虚拟机场景下，一个Device上最多只能支持32个用户进程，Host最多只能支持Device个数*32个进程。
- 对于Atlas 200I/500 A2 推理产品，一个Device上最多只能支持64个用户进程，Host最多只能支持Device个数*64个进程。
- 对于Atlas A2训练系列产品/Atlas 800I A2推理产品，一个Device上最多只能支持63个用户进程，Host最多只能支持Device个数*63个进程。
- 对于Atlas A3 训练系列产品 / Atlas A3 推理系列产品，一个Device上最多只能支持63个用户进程，Host最多只能支持Device个数*63个进程。
- 对于Atlas 350 加速卡，一个Device上最多只能支持64个用户进程，Host最多只能支持Device个数*64个进程。
- 使用内存申请接口（例如  acl.rt.malloc(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0110.html)
、  acl.media.dvpp_malloc(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/dvpp/aclpythondevg_01_0223.html)
等）申请内存后，为确保内存中不会有脏数据，建议在使用内存前先调用  acl.rt.memset(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0118.html)
或  acl.rt.memset_async(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0119.html)
接口先清空内存，例如acl.rt.memset(dev_buffer_ptr, dev_buffer_size, 0, dev_buffer_size)。
- Ascend RC形态下，如果应用程序中涉及  acl.rt.malloc(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0110.html)
、  acl.media.dvpp_malloc(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/dvpp/aclpythondevg_01_0223.html)
、  hi_mpi_dvpp_malloc(https://www.hiascend.comdocument/detail/zh/canncommercial/900/API/dvpp/aclpythondevg_01_0416.html)
等内存申请接口，应用程序在Device上运行时，当前默认在内存不足时，应用程序可能会挂起，等待内存资源，用户可以根据实际需求选择启用操作系统提供的一些配置（例如，enable_oom_killer），这样在内存不足时，应用程序会自动退出，不会一直等待。
  若启用enable_oom_killer，您需登录Device，在“/proc/sys/vm”
  目录下，以root用户启用enable_oom_killer，命令示例如下，1表示启用，0表示禁用：

```
echo 1 > enable_oom_killer
```
