---
title: 函数：create_config
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/runtimeapi/aclpythondevg_01_0848.html
sourcePath: /source/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0848.html
indexId: c2251e6876f4dee0453902d30cb2eb0625ac4c58b9a6e35a941f2f455209f4f971
---
# 函数：create_config

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | √ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | √ |
| Atlas 训练系列产品 | √ |
| Atlas 推理系列产品 | √ |
| Atlas 200I/500 A2 推理产品 | √ |


#### 功能说明

创建aclprofConfig类型的数据，表示创建Profiling配置数据。

aclProfConfig类型数据可以只创建一次、多处使用，用户需要保证数据的一致性和准确性。

如需销毁aclprofConfig类型的数据，请参见函数：destroy_config。


#### 函数原型

- C函数原型
  1 aclprofConfig *aclprofCreateConfig(uint32_t *deviceIdlist, uint32_t deviceNums, aclprofAicoreMetrics aicoreMetrics, aclprofAicoreEvents *aicoreEvents, uint64_t dataTypeConfig)

- python函数
  1 prof_config = acl.prof.create_config(device_list, aicore_metrics, aicore_events, data_type_config)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| device\_list | list，Device ID列表。须根据实际环境的Device ID配置。 |
| aicore\_metrics | int，表示aclprofAicoreMetrics。 |
| aicore\_events | int，表示AI Core事件，目前配置为0。 |
| data\_type\_config | int，用户选择如下多个aclproftype的值进行逻辑或（例如：ACL\_PROF\_ACL\_API\|ACL\_PROF\_AICORE\_METRICS），作为data\_type\_config参数值。每个值表示某一类性能数据，详细说明如下： ACL\_PROF\_ACL\_API：表示采集接口的性能数据，包括Host与Device之间的同步异步内存复制时延等。 ACL\_PROF\_TASK\_TIME：采集算子下发耗时、算子执行耗时数据以及算子基本信息数据，提供更全面的性能分析数据。 ACL\_PROF\_TASK\_TIME\_L0：采集算子下发耗时、算子执行耗时数据。与ACL\_PROF\_TASK\_TIME相比，由于不采集算子基本信息数据，采集时性能开销较小，可更精准统计相关耗时数据。 ACL\_PROF\_AICORE\_METRICS：表示采集AI Core性能指标数据，逻辑或时必须包括该宏，aicore\_metrics入参处配置的性能指标采集项才有效。 ACL\_PROF\_TASK\_MEMORY：控制CANN算子的内存占用情况采集开关。仅采集GE组件算子。 ACL\_PROF\_AICPU：表示采集AI CPU任务的开始、结束数据。 ACL\_PROF\_L2CACHE：表示采集L2 Cache数据。 ACL\_PROF\_HCCL\_TRACE：控制通信数据采集开关。 ACL\_PROF\_MSPROFTX：获取用户和上层框架程序输出的性能数据。需要先在应用程序脚本中添加如下其中一套接口： mstx API（MindStudio Tools Extension API）接口详细操作请参见《性能调优工具(https://www.hiascend.com/document/detail/zh/canncommercial/900/devaids/Profiling/atlasprofiling\_16\_0144.html)》中的“mstx API使用示例(https://www.hiascend.com/document/detail/zh/canncommercial/900/devaids/Profiling/atlasprofiling\_16\_0142.html)”。 msproftx扩展接口。 ACL\_PROF\_TRAINING\_TRACE：控制迭代轨迹数据采集开关。 ACL\_PROF\_RUNTIME\_API：控制runtime api性能数据采集开关。 |


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| prof\_config | int。 返回非0值表示成功，返回值为返回aclprofConfig类型的指针地址。 返回0表示失败。 |


#### 约束说明

- 使用  acl.prof.destroy_config
接口销毁aclprofConfig类型的数据，如不销毁会导致内存未被释放。

- 与  acl.prof.destroy_config
接口配对使用，先调用acl.prof.create_config接口再调用  acl.prof.destroy_config
接口。
