Environment Variable List
This document describes the environment variables that can be used when developers build AI applications and services based on CANN.
Environment variables can be implemented using commands, APIs, and configurations, including the export command, putenv/getenv/setenv/unsetenv/clearenv functions, os.environ, and os.getenv. It is recommended that the user should set environment variables before starting application processes. Otherwise, environment variable access conflicts may occur, causing program exceptions.
For details about environment variables related to collective communication, see Reference > Environment Variable Reference in Huawei Collective Communication Library (HCCL).
For details about PyPTO environment variables, see PyPTO Operator Development.
Installation
Environment Variable |
Description |
|---|---|
Storage path of shared files. Set this environment variable if you require all shared files generated during component build and runtime to be flushed to a unified directory. |
|
Storage path for node-exclusive files. Set this environment variable if you require all node-exclusive files generated during component build and runtime to be flushed to a unified directory. |
|
Installation path of the user custom operator package. Set this environment variable if the custom operator package generated during build needs to be installed in a specified path. |
|
Number of processes for the knowledge base management module to query the knowledge base. |
Graph Build
Environment Variable |
Description |
|---|---|
DUMP_GE_GRAPH sets the graph dump mode. |
|
DUMP_GRAPH_LEVEL sets the graph to dump. |
|
Controls the type of the dump file to be generated. |
|
Sets the path for storing dump graph files. The path can be an absolute path or a relative path of the script execution path. |
|
By default, memory reuse is enabled during graph build on the Ascend platform. In fault locating scenarios, if developers suspect that the computation result is abnormal due to memory reuse errors, they can use this environment variable to allocate memory to an operator separately. |
|
Set this environment variable when converting a single-operator JSON file to an offline model and you intend to exclusively adopt TBE operators during model conversion. The conversion process will not search for AI CPU operators, and an error will be thrown if the corresponding TBE operator is missing. |
|
Specifies the number of CPU cores available for graph build. |
|
Enables or disables the single-thread build during model conversion. |
|
In the TensorFlow training scenario, if computational graph build fails, the training process is terminated by default and the remaining graphs are not delivered to the device. You can set this environment variable to make TF Adapter continuously deliver computational graphs to the device without terminating the training process when graph build fails. |
Operator Build
Environment Variable |
Description |
|---|---|
Parallel build configuration. Set this environment variable to enable parallel build, which delivers superior performance in large network scenarios. |
|
Maximum disk capacity of the cache directory under each AI processor. Set this environment variable when the operator build cache function is enabled. |
|
Specifies the percentage of cache space to be reserved when the operator compilation cache function is enabled. When the occupied compilation cache space reaches ASCEND_MAX_OP_CACHE_SIZE and old kernel files need to be purged, the system will reserve a proportion of the cache space as specified by this variable. The default value is 50, measured in percent. |
|
Specifies whether to skip operator prototype deliverable verification when an operator is integrated to a graph. The deliverables include the implementation of the adaptation functions for operator integration into the graph, such as shape deduction. |
Resource Configuration
Environment Variable |
Description |
|---|---|
Specifies the logical ID of the AI processor used by the current process. |
|
Specifies the devices that are visible to the current process. One or more device IDs can be specified at a time. By using this environment variable, you can adjust the devices without modifying the application. |
|
Controls whether to allow operators to transfer data without passing through the L2 cache. |
|
Specifies the path for storing the heterogeneous resource description file. |
Operator Execution
Environment Variable |
Description |
|---|---|
Sets the number of operator information entries cached on the host for an aclnn API. The cached operator information includes the workspace size, operator executor, and tiling details. |
Graph Execution
Environment Variable |
Description |
|---|---|
During graph execution, enabling the multi-stream concurrency function can improve network performance in certain scenarios. Currently, the multi-stream concurrency function is disabled by default. If you want to enable this function in dynamic shape scenario, you can use this environment variable to enable it. |
|
In training and online inference scenarios, this environment variable can be used to enable multi-thread task scheduling of the graph executor (host) for the network in dynamic shape graph mode. |
AOE Tuning
Environment Variable |
Description |
|---|---|
Sets the path of the custom repository generated after Auto Tune. |
|
Initiates tuning again. This environment variable takes effect only when subgraph tuning or operator tuning is enabled. |
|
Sets the AOE tuning mode in online inference and training scenarios. |
AMCT Model Compression
Environment Variable |
Description |
|---|---|
Sets the log level of framework-specific log files (amct_pytorch.log for PyTorch; amct_caffe.log for Caffe; amct_onnx.log for ONNX), as well as the log level of logs output by each quantization layer during precision simulation model generation. |
|
Sets the log level of information printed to the screen. This environment variable applies only to quantization of the PyTorch framework, Caffe framework, and ONNX network model. |
|
Configures log flushing behaviors during post-training quantization. This environment variable applies only to quantization performed by calling aclgrphCalibration. |
Profiling
Environment Variable |
Description |
|---|---|
Enables or disables the profiling function. |
|
Sets profiling configuration options in training or online inference scenarios. |
Logging
Environment Variable |
Description |
|---|---|
Sets the log flush path. |
|
Enables or disables the printing of application logs on the host. After this function is enabled, logs are not saved in the log file. Instead, the generated logs are directly printed and displayed. |
|
Sets the level of application logs and module logs. Only debug logs are supported. |
|
Sets the level of each module of app logs. Only debug logs are supported. |
|
Enables or disables event logging for applications. |
|
Specifies the timeout for flushing app logs from the device to the host. |
|
Sets the number of log files of each process stored in the application log directories (plog and device-id) in the |
|
Sets the core dump semaphore for trace processing. |
|
Specifies the processing mode for log congestion. |
|
Sets the aging policy for trace log files. The value range is [10, 1000]. |
Fault Information Collection
Environment Variable |
Description |
|---|---|
Specifies the storage path for fault information, including dump graphs, abnormal data of AI Core operators, and operator compilation logs. The path can be an absolute path or a relative path (relative to the working directory of the running program or command), on which users must have the read, write, and execute permissions. If the target path does not exist, the system will automatically create all missing directories under the specified path. |
|
Enables or disables abnormal operator dump when reproducing fault scenarios. When this function is enabled, input and output data, workspace details, and tiling information of faulty operators are exported. |
|
Specifies the storage directory for abnormal operator dump data. Both absolute paths and relative paths (relative to the executable program) are supported. The specified path can contain uppercase letters, lowercase letters, digits, underscores (_), hyphens (-), and periods (.). The user must have read, write, and execute permissions on the path. If the target directory does not exist, the system will automatically create all missing directories along the path. If this path is not configured, abnormal operator dump data will be saved in the current execution directory of the application by default. |
Environment Variables to Be Deprecated in Later Versions
Environment Variable |
Description |
|---|---|
Configures the memory allocation mode used during network running. |
|
Determines whether to call the host execution function registered by the operator during graph execution to implement the host execution logic and kernel delivery. |