Function: create_config

Applicability

Product

Supported

Atlas 350 Accelerator Card

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas training product

Atlas inference product

Atlas 200I/500 A2 inference product

Description

Creates data of the aclprofConfig type as the profiling configuration.

Created aclProfConfig data can be reused in multiple calls. You need to ensure the consistency and accuracy of the data.

To destroy data of the aclprofConfig type, call Function: destroy_config.

Prototype

  • C Prototype
    1
    aclprofConfig *aclprofCreateConfig(uint32_t *deviceIdlist, uint32_t deviceNums, aclprofAicoreMetrics aicoreMetrics, aclprofAicoreEvents *aicoreEvents, uint64_t dataTypeConfig)
    
  • Python Function
    1
    prof_config = acl.prof.create_config(device_list, aicore_metrics, aicore_events, data_type_config)
    

Parameters

Parameter

Description

device_list

List, device ID list. Set it based on the device ID in the actual environment.

aicore_metrics

Int, aclprofAicoreMetrics.

aicore_events

Int, AI Core event, which is set to 0.

data_type_config

Int. Select from the following aclproftype values in logical OR format (for example, ACL_PROF_ACL_API|ACL_PROF_AICORE_METRICS) as the parameter value of data_type_config. Each value indicates a type of profile data.

  • ACL_PROF_ACL_API: collects profile data of APIs, including the synchronous/asynchronous memory copy latencies between the host and devices.
  • ACL_PROF_TASK_TIME: collects operator delivery and execution duration data, as well as basic operator information, to provide more comprehensive performance analysis data.
  • ACL_PROF_TASK_TIME_L0: collects operator delivery and execution duration data. Compared with ACL_PROF_TASK_TIME, ACL_PROF_TASK_TIME_L0 does not collect basic operator information, so the performance overhead during collection is smaller, and this enables more accurate collection of statistics on time duration data.
  • ACL_PROF_AICORE_METRICS: collects AI Core metrics. This macro must be included in the OR logic for aicore_metrics to take effect.
  • ACL_PROF_TASK_MEMORY: specifies whether to collect the memory usage of CANN operators. Only data of GE operators is collected.
  • ACL_PROF_AICPU: collects traces of AI CPU tasks, including the start and end of each task.
  • ACL_PROF_L2CACHE: L2 Cache data collection.
  • ACL_PROF_HCCL_TRACE: collects communication data.
  • ACL_PROF_MSPROFTX: profile data output by the user and upper-layer framework program. In the application script, you need to add one of the following APIs:
  • ACL_PROF_TRAINING_TRACE: collects iteration traces.
  • ACL_PROF_RUNTIME_API: collects runtime API profile data.

Return Value

Return Value

Description

prof_config

int.

  • If a non-zero value is returned, the operation is successful. The return value is the pointer address of the aclprofConfig type.
  • If 0 is returned, the operation fails.

Restrictions

  • Use the acl.prof.destroy_config API to destroy data of the aclprofConfig type. If data is not destroyed, the memory cannot be freed.