Enabling Automatic Tuning
After this command is run, the Kunpeng AutoTuner tunes parameters in the parameter spaces based on service scenario metrics.
Command Function
Enables automatic tuning. The Kunpeng AutoTuner automatically tunes task parameters based on service scenario metrics.
Syntax
1 | devkit kat train [-h] [-l {0,1,2,3}] -t <file> [-p <file>] [-o <dir>] |
Parameter Description
Parameter |
Option |
Description |
|---|---|---|
-h/--help |
- |
Obtains help information. This parameter is optional. |
-l/--log-level |
0/1/2/3 |
Log level, which defaults to 2. This parameter is optional.
NOTE:
The default level is 2 (WARNING).
|
-t/--task-cfg |
- |
Path to the task configuration file. This parameter is mandatory. |
-p/--param-cfg |
- |
Path to the configuration file of application parameters. This parameter is mandatory. |
-o/--output |
- |
Output path of the task result file. If you do not set this parameter, a directory in the format of train-YMD-HMS format is generated in the current directory. Do not use an existing directory. This parameter is optional. |
Example
1 | devkit kat train -t /opt/template/template_Postgresql_20250119_073054/task_Postgresql.json -p /opt/template/template_Postgresql_20250119_073054/param_Postgresql.json -o /opt/template/train |
The task parameters have been configured in the /opt/template/template_Postgresql_20250119_073054/task_Postgresql.json file and the application parameters have been configured in the /opt/template/template_Postgresql_20250119_073054/param_Postgresql.json file. The results are displayed in descending order of performance data.
Command output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | [2025-02-25 11:28:32 UTC] [KAT] [message] - ============================== Auto Tuning Report ============================== [2025-02-25 11:28:32 UTC] [KAT] [message] - Total round : 5 [2025-02-25 11:28:32 UTC] [KAT] [message] - Total run : 6 [2025-02-25 11:28:32 UTC] [KAT] [message] - Fail times : 0 [2025-02-25 11:28:32 UTC] [KAT] [message] - Application : Postgresql [2025-02-25 11:28:32 UTC] [KAT] [message] - Application version : 11.3 [2025-02-25 11:28:32 UTC] [KAT] [message] - Test tool : benchmarksql [2025-02-25 11:28:32 UTC] [KAT] [message] - Tuning direction : high [2025-02-25 11:28:32 UTC] [KAT] [message] - Algorithm : HPO [2025-02-25 11:28:32 UTC] [KAT] [message] - Random initial ratio : 0.5 [2025-02-25 11:28:32 UTC] [KAT] [message] - Performance description : tpmC, transactions per minute [2025-02-25 11:28:32 UTC] [KAT] [message] - Parameter groups : Postgresql [2025-02-25 11:28:32 UTC] [KAT] [message] - Baseline performance : 81.7 [2025-02-25 11:28:32 UTC] [KAT] [message] - Top 5 performance : [2025-02-25 11:28:32 UTC] [KAT] [message] - -------------------------------------------------------------------------------- [2025-02-25 11:28:32 UTC] [KAT] [message] - | Rank | Round | Performance | Improvement (%) | [2025-02-25 11:28:32 UTC] [KAT] [message] - -------------------------------------------------------------------------------- [2025-02-25 11:28:32 UTC] [KAT] [message] - | 1 | round 1 | 121.59 | 48.82 | [2025-02-25 11:28:32 UTC] [KAT] [message] - | 2 | round 2 | 98.48 | 20.54 | [2025-02-25 11:28:32 UTC] [KAT] [message] - | 3 | round 3 | 96.55 | 18.18 | [2025-02-25 11:28:32 UTC] [KAT] [message] - | 4 | round 5 | 84.38 | 3.28 | [2025-02-25 11:28:32 UTC] [KAT] [message] - | 5 | round 4 | 82.07 | 0.45 | [2025-02-25 11:28:32 UTC] [KAT] [message] - -------------------------------------------------------------------------------- [2025-02-25 11:28:32 UTC] [KAT] [message] - Note: [2025-02-25 11:28:32 UTC] [KAT] [message] - The performance value is the return value of the run test step, [2025-02-25 11:28:32 UTC] [KAT] [message] - Performance improvement (%) = [2025-02-25 11:28:32 UTC] [KAT] [message] - (round performance - baseline performance) / baseline performance * 100 [2025-02-25 11:28:32 UTC] [KAT] [message] - Case package locate: /opt/template/train/train-20250225-112832 [2025-02-25 11:28:32 UTC] [KAT] [message] - ================================================================================ |
In the example, the baseline performance is 81.7. After five rounds of automatic tuning, the optimal performance reaches 121.59, representing a 48.82% increase. The directory for saving the tuning result file is provided at the end of the command output, and can be in the later tuning result processing step. (If the tuning process is manually interrupted, the results of all rounds before the interruption are generated.)
The parameter sets after automatic tuning are generated in the /opt/template/train/train-20250225-112832 directory. You can select a parameter set based on the tuning result to adjust application parameters.
1 | ls /opt/template/train/train-20250225-112832
|
Command output:
1 | param_cfg.json task_cfg.json train.db |
This directory contains the data file train.db generated after automatic tuning, the application parameter configuration file param_cfg.json, and the task parameter configuration file task_cfg.json.