Troubleshoot¶
Debug Dump Binaries (DDB) generation¶
The DDB contains useful information for functional debugging of the RBLN NPU, such as the input of the RBLN Compiler, the error log of each compile pass, and the progress status of the compilation. Note that all DDB files are securely encrypted.
To generate the DDB, set the environment variable RBLN_DEBUG_LEVEL:
RBLN_DEBUG_LEVEL=1:DDBgeneration, without model parametersRBLN_DEBUG_LEVEL=2:DDBgeneration, including model parameters
Setting RBLN_DEBUG_LEVEL=2 is better for debugging, but if it is not possible to share the model parameters, setting RBLN_DEBUG_LEVEL=1 is a suitable option.
To diagnose a problem, rerun the compilation command for the affected model with RBLN_DEBUG_LEVEL=2.
The following example uses the PyTorch ResNet50 model in the RBLN Model Zoo to demonstrate DDB generation on an NPU:
If a DDB directory is generated, it contains files similar to the following:
Create a tarball containing all DDB files and submit it via the RBLN Forum with detailed descriptions for further assistance:
Device selection¶
If your system contains multiple RBLN NPU devices, you have the option to assign a specific device ID to your process by utilizing the RBLN_DEVICES environment variable. The device ID (NPU ID) can be obtained from the CLI tool rbln-smi.
Note
RBLN_VISIBLE_DEVICES is an alias of RBLN_DEVICES and accepts the same comma-separated list of device IDs. If both are set to different values, RBLN_DEVICES takes precedence, and a one-time warning reports the ignored variable.
Performance tuning¶
While most of the compiled model consists of NPU operations, some CPU-based operations may still be present. The performance of these operations can vary based on the host CPU environment.
To improve the performance of the CPU-based operations, you can adjust the number of threads using the following methods.
1. Thread count¶
Option 1. Using an Environment Variable
Set the number of threads by defining the environment variable before running the model:
Option 2. Using the Python API
You can also set the number of threads directly with set_num_threads():
2. Optimal thread count¶
The optimal number of threads depends on your host CPU environment. While you can manually adjust it, a utility function, search_num_threads(), is provided to automate the process:
In this example, 16 threads provide the best performance. The optimal thread count may vary depending on your host system, so running this benchmark is recommended to find the best value.