Maintainability and Testability

The ATB provides the following maintainability and testability:

Except the log system, all other maintainability and testability capabilities are integrated into the msit tool and need to be used using the tool. For details about how to use the tool, see msit Usage Guide.

Log System

The log system of the ATB supports log level classification, standard output, and file output.

  • Log classification
    Log levels include DEBUG, INFO, WARN, ERROR (default), and NULL, as described in Table 1.
    Table 1 Log levels

    Value

    Level

    Description

    0

    DEBUG

    Debug information, which records details about the ATB code. Developers can debug the framework code by viewing debug logs.

    1

    INFO

    Data information, which is related to the operator and the entire graph. You can learn the running status of the entire graph or a single operator by viewing the INFO log.

    2

    WARN

    Warning information, which indicates that a potential error may occur.

    3

    ERROR

    Error information. Error and exception information is printed at this level.

    4

    NULL

    The log function is disabled.

  • Environment variables
    • ASCEND_GLOBAL_LOG_LEVEL
      • Function

        Sets the levels of application logs and module logs. Only debug logs are supported. Note: ATB logs are controlled by environment variables.

      • Example:
        1
        2
        3
        4
        5
        export ASCEND_GLOBAL_LOG_LEVEL=0 # Set the global log level to DEBUG. All modules without a specific MODULE-level setting will use this level.
        export ASCEND_GLOBAL_LOG_LEVEL=1 # Set the global log level to INFO. All modules without a specific MODULE-level setting will use this level.
        export ASCEND_GLOBAL_LOG_LEVEL=2 # Set the global log level to WARNING. All modules without a specific MODULE-level setting will use this level.
        export ASCEND_GLOBAL_LOG_LEVEL=3 # Set the global log level to ERROR. All modules without a specific MODULE-level setting will use this level.
        export ASCEND_GLOBAL_LOG_LEVEL=4 # Set the global log level to OFF. All modules without a specific MODULE-level setting will use this level.
        
    • ASCEND_MODULE_LOG_LEVEL
      • Function

        Sets the log level of each module of app logs. Only debug logs are supported. The module name used by ATB logs is OP. Note that the OP module name is shared by multiple components and is not exclusively occupied by the ATB.

      • Format

        export ASCEND_MODULE_LOG_LEVEL=module_name1=module_level1:module_name2=module_level2:module_name3=module_level3

        module_name: module name. The value can be GE, ASCENDCL, DRV, RUNTIME, or others. For details, see .

        module_level: log level of the corresponding module.

      • Example
        1
        2
        export ASCEND_MODULE_LOG_LEVEL=OP=1 # Set the log level of the component that uses the OP module name to INFO.
        export ASCEND_MODULE_LOG_LEVEL=OP=1:GE=3 # Set the log level of the component that uses the OP module name to INFO and the log level of the component that uses the GE module name to ERROR.
        
    • ASCEND_SLOG_PRINT_TO_STDOUT
      • Function

        Enables or disables log printing. After this function is enabled, logs are not saved in the log file. Instead, the generated logs are printed on the screen.

        Values:

        0: disabled. Logs are saved in the log file, which is the default log output mode.

        1: enabled.

        Other values: invalid

      • Example
        1
        export ASCEND_SLOG_PRINT_TO_STDOUT=1
        
    • ASCEND_PROCESS_LOG_PATH
      • Function

        Sets the log flush path.

        If the path does not exist during log storage, the system automatically creates one. If the path exists, logs are directly stored.

        You can run the echo $ASCEND_PROCESS_LOG_PATH command to view the path configured through environment variables.

        The priority for flushing logs to disks is as follows: ASCEND_PROCESS_LOG_PATH > ASCEND_WORK_PATH > Default log storage path ($HOME/ascend/log)

        For details about ASCEND_WORK_PATH, see .

      • Example
        1
        export ASCEND_PROCESS_LOG_PATH=/home/mypath/log/
        
    • ASCEND_LOG_SYNC_SAVE
      • Description

        Specifies whether to flush the written log file.

      • Example
        1
        export ASCEND_LOG_SYNC_SAVE=1
        
  • Log storage
    1. Log files are stored in [LOG_PATH]/atb. [LOG_PATH] is controlled by the environment variables ASCEND_PROCESS_LOG_PATH and ASCEND_WORK_PATH. The default storage path is $HOME/ascend/log.
    2. The log file is named in the format of atb_[PID]_[Year][Month][Day][Hour][Minute][Second].log, where [PID] indicates a thread ID. Example: atb_253440_20231102065052.log.
  • Space management
    1. The maximum size of a log file is 1 GB, and a maximum of 50 log files can be stored. If the number of log files (stored in the standard naming format) in the current directory reaches the maximum, the earliest log files will be deleted based on the timestamps.
    2. Before generating a log file, the system checks the space of the log storage directory. If the space is less than 10 GB, no more log file will be generated.

DumpTensor

This function is enabled by using the msit tool and is mainly used in the precision debugging scenario. You can configure parameters to specify the tensor binary files of a specific or all operations to be dumped. For details, see DumpTensor Usage Guide.

Saving Operation Information and Kernel Information

The two functions are enabled by using the msit tool. The operation information or kernel information (such as parameters, input tensor shape, and output tensor shape) during running can be saved as a CSV file. For details, see Guide to Saving Operator Information.

Saving CPU Profile Data

This function is enabled using the msit tool. The performance information of each API on the ATB host is saved to a text file for locating host bound performance problems. For details, see Guide to Saving CPU Profile Data.

Saving Topology Information

This function is enabled using the msit tool. The graph structure of any operation in the ATB can be converted into a JSON file and saved to the local PC. The saved JSON file can also be converted into an ONNX file using the msit tool. This file cannot be imported as a model because it lacks weight information. Use tools such as Netron for visualization. For details, see Guide to Saving Topology Information.

Operator Overflow Detection

This function is enabled by using the msit tool to detect operator overflow/underflow during graph running. If an operator overflow occurs during graph running, the ATB outputs error logs or stops subsequent execution based on the user configuration. For details, see Guide to Operator Overflow Detection.