Preparing Dump Data Files of an Offline Model
Precautions
- Before dumping data, build and run the application project of the model to ensure that the project is normal.
- Dump data is generated during each inference. When the number of iterations is large, the amount of dump data increases accordingly. Therefore, you are advised to perform only one inference when dumping data. For LLMs, dump data is typically voluminous and time-consuming. You can enable operator statistics using dump_data, identify potentially abnormal operators based on the statistics, and then dump only those operators.
- In Docker scenarios, dump is not supported in containers.
- The aclInit() and aclmdlSetDump() APIs are provided to dump data.
Dump Data Generation
Perform the following steps to dump data of the offline model:
- Open the code file of the inference application project where the aclInit() function is located, view the called aclInit() or aclmdlSetDump() function, and obtain the path of the acl.json file.
If aclInit() or aclmdlSetDump() is initialized to empty, pass the acl.json path created in 2 to the call. The acl.json path is relative to the path of the binary file generated during project build.
- Modify the acl.json file in the directory (if the file does not exist, create it in the out directory after project build) and add the dump configuration in the following format.In the model inference scenario, enable dump data collection.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
{ "dump":{ "dump_list":[ { "model_name":"ResNet-101" }, { "model_name":"ResNet-50", "layer":[ "conv1conv1_relu", "res2a_branch2ares2a_branch2a_relu", "res2a_branch1", "pool1" ] } ], "dump_path":"/home/output", "dump_mode":"output", "dump_op_switch":"off", "dump_data":"tensor" } }
In the single-operator calling scenario, enable dump data collection.
1 2 3 4 5 6 7 8
{ "dump":{ "dump_path":"/home/output", "dump_list":[{}], "dump_op_switch":"on", "dump_data":"tensor" } }
- Run the application to generate dump data files. The path and format of the generated dump data files are described as follows.
In model inference scenarios, the disk storage path for dumped data is as follows: {dump_path}/{time}/{device_id}/{model_name}/{model_id}/{data_index}/{dump_file}.
In single-operator calling scenarios (including single-operator model execution and single-operator API execution), the disk storage path for dumped data is as follows: {dump_path}/{time}/{device_id}/{dump_file}.
Table 2 Path format of a dump file Path Key
Description
Note
dump_path
Dump path configured in the acl.json file.
The dump data file is named in the {op_type}.{op_name}.{task_id}.{stream_id}.{timestamp} format.
time
Dump time.
Formatted as YYYYMMDDHHMMSS.
device_id
Device ID.
-
model_name
Model name.
Periods (.), forward slashes (/), backslashes (\), and spaces in model_name are replaced with underscores (_).
model_id
Model ID.
-
data_index
Execution sequence number of each task, indexed starting at 0. This value is increased by 1 every dump.
-
- Periods (.), forward slashes (/), backslashes (\), and spaces in op_type or op_name in the dump file are replaced with underscores (_).
- If the filename exceeds the OS filename length limit (typically 255 characters), the dump file will be renamed to a string of random numbers. You can check the mapping.csv file in the same directory for the name mapping relationship.
- No dump data will be generated for the following operators during graph execution:
- Operators confirmed not to execute on the device before graph execution, including conditional operators (such as if, while, for, and case), data operators (such as Data, RefData, and Const), and data flow operators (such as StackPush, StackPop, Concat, and Split).
- Operators marked by the GE during graph optimization to skip execution on the device. For such operators, the _no_task attribute of attr in the dump graph is true.
- Operators located on unreachable execution branches in the graph.