aclInit

Description

Initializes AscendCL. This API is synchronous.

Restrictions

Prototype

aclError aclInit(const char *configPath)

Parameters

Parameter

Input/Output

Description

configPath

Input

Pointer to the 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 initial configurations, pass NULL or an empty JSON configuration file with only a pair of curly brackets {} to the aclInit call.

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

  • Dump configuration involves the model, single-operators, and overflow/underflow operators.
    • 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 "Data Preparation > Inference Scenarios > Preparing Dump Data of an Offline Model (AscendCL) in Model Accuracy Analyzer Instructions. The dump configuration is disabled by default.
    • Overflow/Underflow operator dump configuration (used to export the input and output data of overflow/underflow operators in the model): The exported data is used to analyze overflow/underflow operator causes and locate model accuracy issues. For details about the configuration example, description, and restrictions, see Configuration File Example (Overflow/Underflow Operator Dump Configuration). The dump configuration is disabled by default. Reserved.
  • Profiling configuration. For the configuration example, description, and restrictions, see Profiling Instructions. Profiling is disabled by default.
  • Operator cache aging configuration. To reduce the memory footprint and balance the call 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 10000. For the configuration example and restrictions, see Configuration File Example (Operator Cache Aging Configuration).

Dump configuration and profiling configuration are mutually exclusive. The dump operation could affect system performance, resulting in inaccurate profile data collected by Profiling.

Returns

0 on success; else, failure.

Configuration File Example (Overflow/Underflow Operator Dump Configuration)

Note the following restrictions on the overflow/underflow operator dump configuration:
  • If dump_debug is set to on, the overflow/underflow operator configuration is enabled. If dump_debug is not set or set to off, the overflow/underflow operator configuration is disabled.
  • If the overflow/underflow operator configuration is enabled, dump_path must be set, indicating the storage path of the exported data file.
    The path can be either absolute or relative.
    • An absolute path starts with a slash (/), for example, /home/HwHiAiUser/output.
    • A relative path starts with a directory name, for example, output.

    For details about how to parse the exported data file, see Overflow/Underflow Operator Data Collection and Analysis.

  • The overflow/underflow operator configuration cannot be enabled if the model dump configuration or single-operator dump configuration is enabled. Otherwise, an error is returned.
The following gives a configuration example.
{
    "dump":{
        "dump_path":"output",
        "dump_debug":"on"
    }
}

Configuration File Example (Operator Cache Aging Configuration)

Note the following restrictions on the operator cache aging configuration:

The following gives a configuration example.

{
        "max_opqueue_num": "10000"
}

Related APIs

AscendCL provides more flexible APIs for enabling Dump or Profiling. Unlike aclInit, these APIs can be called repeatedly in a process, allowing varied Dump/Profiling configurations with each call.

See Also

For the API call example, see AscendCL Initialization and Deinitialization.