Environment Variables
After the ATB is installed, the process-level environment variable setting script set_env.sh is provided to automatically set environment variables. The environment variables automatically become invalid after the user process ends.
ATB Environment Variables
- Basic environment variable
Environment Variable
Description
ATB_HOME_PATH
Path for storing files after the package is installed.
LD_LIBRARY_PATH
Search path list when the dynamic library is loaded in Linux.
PATH
Add the path of the bin directory of the ATB software package to the PATH environment variable. The default path is recommended.
- ATB environment variables
Environment Variable
Default Value
Description
Configuration
Change Description
ATB_STREAM_SYNC_EVERY_KERNEL_ENABLE
0
Used to locate the kernel where the error is reported. When the variable is set to 1, stream synchronization is performed when the execution of each kernel ends.
0: disabled
1: enabled
-
ATB_STREAM_SYNC_EVERY_RUNNER_ENABLE
0
Used to locate the runner where the error is reported. When the variable is set to 1, stream synchronization is performed during the execution of each runner.
0: disabled
1: enabled
-
ATB_STREAM_SYNC_EVERY_OPERATION_ENABLE
0
Used to locate the operation where the error is reported. When the variable is set to 1, synchronization is performed during the execution of each operation.
0: disabled
1: enabled
-
ATB_OPSRUNNER_KERNEL_CACHE_LOCAL_COUNT
1
Number of slots for the local kernel cache.
- When the number of slots increases, the cache hit rate is improved but the retrieval efficiency is reduced.
- When the number of slots decreases, the retrieval efficiency is improved but the cache hit rate is reduced.
The value ranges from 1 to 1024.
You are advised to use the default value. If the default value is changed, the performance and accuracy will be affected. This environment variable will be deleted in later versions. Exercise caution when using it.
The functions of these environment variables will be deprecated in the future. Exercise caution when using these environment variables.
ATB_OPSRUNNER_KERNEL_CACHE_GLOBAL_COUNT
5
Number of slots for the global kernel cache.
- When the number of slots increases, the cache hit rate is improved but the retrieval efficiency is reduced.
- When the number of slots decreases, the retrieval efficiency is improved but the cache hit rate is reduced.
The value ranges from 1 to 1024.
ATB_WORKSPACE_MEM_ALLOC_ALG_TYPE
1
Workspace memory allocation algorithms. The ATB selects different algorithms to compute the workspace size and allocation based on the environment variable configuration. You can select different algorithms to test the workspace allocation.
0: brute force algorithm
1: block allocation algorithm
2: ordered heap algorithm
3: block combination algorithm (degraded version of the SOMAS algorithm)
ATB_COMPARE_TILING_EVERY_KERNEL
0
After each kernel runs, the system compares the tiling content on the NPU before and after the running to check whether tiling memory corruption occurs.
0: disabled
1: enabled
-
ATB_SHARE_MEMORY_NAME_SUFFIX
""
Name suffix of the shared memory. When the communication operator is used by multiple users, this variable needs to be set to distinguish the shared memory.
The value can be any character string.
You are advised to use the default value. If the default value is changed, the performance and accuracy will be affected. This environment variable will be deleted in later versions. Exercise caution when using it.
ATB_MATMUL_SHUFFLE_K_ENABLE
1
Whether to enable Shuffle-K to control the consistency of the accumulation order of the matrix multiplication result when different positions of the matrix are computed. This variable affects the internal accumulation order of the matmul operator.
0: disabled. The accumulation sequence is consistent.
1: enabled. The accumulation sequence is inconsistent.
-
LCCL_PARALLEL
0
This function and deterministic computing cannot be enabled at the same time. LCCL_DETERMINISTIC must be set to 0 or false.
After the multi-communicator parallelism is used, LCCL_PARALLEL must be set to false. Otherwise, the performance in basic scenarios deteriorates. The value cannot be changed during the running.
This environment variable can be used only in the allReduce multi-thread concurrency scenario. Only the
Atlas A2 training products /Atlas A2 inference products with eight cards are supported, and the data volume must be less than 100 MB.true or 1 indicates that the function is enabled. 0 or false indicates that the function is disabled.
The functions of these environment variables will be deprecated with the LCCL function in the future. Exercise caution when using these environment variables.
LCAL_COMM_ID
-
IP address and port number used to initialize the socket binding and connection. When multiple communicators are created on the same device concurrently, this environment variable is used to bind different ports.
The format is ip:port, where ip indicates the IP address of the server where rank0 is located and port indicates the port number.
The IP address is limited to 127.0.0.1, and the port number ranges from 10067 to 10067+commDomain. For details about how to configure commDomain, see Parameters.
Note: The current version does not support multi-server communication, and the ip field is not used.
ASCEND_LAUNCH_BLOCKING
0
Determines whether to enable the synchronization mode during operator execution in the PyTorch training or online inference scenario.
During NPU model training, operators are executed asynchronously by default. As a result, when an error is reported during operator execution, the printed error stack information is not the actual call stack information. When this parameter is set to 1, the operator is forced to run in synchronous mode for proper printing of the call stack information, making it easier to debug and locate problems in the code. If this parameter is set to 0, the asynchronous mode is used.
0: asynchronous mode
1: synchronous mode
- It is valid only when torch_atb is used.
- If it is set to 1:
- Forcing the operator to run in synchronous mode will cause performance deterioration.
- The task_queue operator queue is disabled, and the setting of TASK_QUEUE_ENABLE does not take effect.
- It is supported only by the
Atlas training products andAtlas A2 training products .
-
TASK_QUEUE_ENABLE
1
Status of task_queue operator queue optimization during the operator delivery process.
- 0: Disables task_queue operator dispatch queue optimization.
- 1 or not configured: Enables task_queue operator dispatch queue level 1 optimization.
Level 1 optimization: Enables task_queue operator dispatch queue optimization, dividing the operator dispatch tasks into two segments. One part is placed on the newly added second pipeline, and the first and second pipelines pass tasks through queues, in parallel. This partially masks and reduces the overall dispatch time, improving performance.
- 2: Enables task_queue operator dispatch queue level 2 optimization.
Level 2 optimization: Includes level 1 optimization and adds load balancing for the first and second pipelines, along with second pipeline wake-up acceleration. This only takes effect in binary scenarios, and it is recommended to configure the value to level 2 optimization.
0: disabled.
1: enables level 1 optimization for the dispatch queue.
2: enables level 2 optimization for the dispatch queue.
- It is valid only when torch_atb is used.
- When ASCEND_LAUNCH_BLOCKING is set to 1, the task_queue operator queue is disabled and the TASK_QUEUE_ENABLE setting does not take effect.
- It is supported only by the
Atlas training products andAtlas A2 training products /Atlas A2 inference products .
-
- For details about the environment variables related to ATB logs, see Environment variables.
- Environment variables related to the operator library
Environment Variable
Default Value
Description
Configuration
Change Description
LCCL_DETERMINISTIC
0
Operator deterministic computing switch. After this switch is turned on, all operators that support switch control become deterministic computing. Operators that do not support switch control are not affected.
Currently, this switch only determines whether to enable LCCL deterministic AllReduce (order-preserving). (The affected operations include AllReduceOperation, ReduceScatterOperation, and LinearParallelOperation.) Note that this function takes effect only in the single-server scenario, that is, rankSize <= number of cards on a single server.
Enabling this function has the following impacts:
- The performance of some communication operators is affected.
- The accumulation order of the LCCL communication operators is affected.
0: disabled
1: enabled
The functions of these environment variables will be deprecated with the LCCL function in the future. Exercise caution when using these environment variables.
ASDOPS_QUANT_MIN_NEG_127
0
Minimum value of the int8 quantization output.
You are advised to retain the default setting.
0: The minimum value is -128.
1: The minimum value is -127.
You are advised to use the default value. If the default value is changed, the performance and accuracy will be affected. This environment variable will be deleted in later versions. Exercise caution when using it.