Function: init

C Prototype

aclError aclInit(const char *configPath)

Python Function

ret = acl.init(config_path)

Function Usage

pyACL initialization function.

Input Description

config_path: str, path of the configuration file, including the file name.

The configuration file is in JSON format. A JSON file allows up to 10 levels of curly brackets and square brackets, respectively. To use the default configurations, directly call the acl.init interface without passing any parameter or set the configuration file to an empty JSON string (that is, only {} exists in the configuration file).

The configuration file is in JSON format. The following configurations are supported:

  • Dump information configuration, including:
    • Model dump configuration (used to export the input and output data of operators at each layer in the model) and single-operator dump configuration (used to export the input and output data of an operator). The exported data is used to compare with that of a specified model or operator to locate accuracy issues. For details about the configuration example, description, and restrictions, see Configuration File Example (for Model Dump and Single-Operator Dump). Dump is disabled by default.
    • Dump configuration of the exception operator (used to export the input and output data, workspace information, and tiling information of the exception operator). The exported data is used to analyze AI Core errors. For details about the configuration example, see Configuration File Example (Exception Operator Dump Configuration). Dump is disabled by default.
    • Dump configuration of the overflow/underflow operator (used to export the input and output data of the overflow/underflow operator in the model). The exported data is used to analyze overflow/underflow causes and locate model accuracy problems. For details about the configuration example, description, and restrictions, see Example Configuration (Overflow/Underflow Operator Dump). Dump is disabled by default.
  • Profiling configuration. For the configuration example, description, and restrictions, see Profiling Instructions. Profiling is disabled by default.
  • Operator cache aging configuration. To save memory and balance the calling performance, you can use the max_opqueue_num parameter to configure the maximum length of the "operator type and single-operator model" mapping queue. If the length of the mapping queue reaches the maximum, the least used mapping information and single-operator models in the cache are deleted before the most recent mapping information and the corresponding single-operator model are loaded. The default maximum length of the mapping queue is 20000. For details about the configuration example and restrictions, see Example Configuration (Operator Cache Information Aging).
  • Error information report mode configuration, which is used to control the acl.get_recent_err_msg API to obtain error information by process or thread level. By default, error information is obtained by thread level. For details about the example, see Configuration File Example (Configuration of Error Information Reporting Mode).

Dump configuration and profiling configuration should not be both set. The dump operation could affect the system performance, resulting in inaccurate profile data collected by Profiling.

Return Value

ret: int, error code.

Restrictions

  • The acl.init API can be called only once in a process and is used together with the acl.finalize deinitialization API.

  • acl.init must be called before app development using pyACL APIs. Otherwise, an error may occur during the initialization of internal system resources, causing other service exceptions.

API

pyACL provides more flexible APIs for enabling Dump and Profiling. Unlike acl.init, these APIs can be called repeatedly in a process, allowing for varied dump/profiling configurations with each call.

Reference

For the API call example, see Initializing pyACL.