mindstudio-probe 1.1.0__py3-none-any.whl → 1.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mindstudio_probe-1.1.0.dist-info → mindstudio_probe-1.2.1.dist-info}/METADATA +7 -6
- mindstudio_probe-1.2.1.dist-info/RECORD +396 -0
- {mindstudio_probe-1.1.0.dist-info → mindstudio_probe-1.2.1.dist-info}/WHEEL +1 -1
- {mindstudio_probe-1.1.0.dist-info → mindstudio_probe-1.2.1.dist-info}/entry_points.txt +0 -1
- msprobe/CMakeLists.txt +5 -0
- msprobe/README.md +51 -20
- msprobe/config.json +2 -3
- msprobe/core/advisor/advisor.py +8 -3
- msprobe/core/common/const.py +264 -15
- msprobe/core/common/exceptions.py +27 -3
- msprobe/core/common/file_utils.py +176 -26
- msprobe/core/common/inplace_op_checker.py +15 -0
- msprobe/core/common/inplace_ops.yaml +3 -0
- msprobe/core/common/log.py +27 -9
- msprobe/core/common/utils.py +204 -77
- msprobe/core/common_config.py +49 -14
- msprobe/core/compare/acc_compare.py +274 -198
- msprobe/core/compare/check.py +32 -33
- msprobe/core/compare/compare_cli.py +32 -14
- msprobe/core/compare/highlight.py +283 -127
- msprobe/core/compare/layer_mapping/__init__.py +19 -0
- msprobe/core/compare/layer_mapping/data_scope_parser.py +246 -0
- msprobe/core/compare/layer_mapping/layer_mapping.py +249 -0
- msprobe/core/compare/layer_mapping/postprocess_pass.py +95 -0
- msprobe/core/compare/merge_result/merge_result.py +380 -0
- msprobe/core/compare/merge_result/merge_result_cli.py +31 -0
- msprobe/core/compare/multiprocessing_compute.py +2 -2
- msprobe/core/compare/npy_compare.py +135 -144
- msprobe/core/compare/utils.py +419 -274
- msprobe/core/data_dump/data_collector.py +60 -28
- msprobe/core/data_dump/data_processor/base.py +84 -36
- msprobe/core/data_dump/data_processor/factory.py +5 -3
- msprobe/core/data_dump/data_processor/mindspore_processor.py +152 -18
- msprobe/core/data_dump/data_processor/pytorch_processor.py +267 -110
- msprobe/core/data_dump/json_writer.py +29 -1
- msprobe/core/data_dump/scope.py +119 -39
- msprobe/core/grad_probe/constant.py +27 -13
- msprobe/core/grad_probe/grad_compare.py +18 -1
- msprobe/core/grad_probe/utils.py +30 -2
- msprobe/core/overflow_check/abnormal_scene.py +189 -0
- msprobe/core/overflow_check/api_info.py +55 -0
- msprobe/core/overflow_check/checker.py +138 -0
- msprobe/core/overflow_check/filter.py +157 -0
- msprobe/core/overflow_check/ignore_rules.yaml +55 -0
- msprobe/core/overflow_check/level.py +22 -0
- msprobe/core/overflow_check/utils.py +28 -0
- msprobe/docs/01.installation.md +96 -7
- msprobe/docs/02.config_introduction.md +50 -23
- msprobe/docs/03.config_examples.md +2 -9
- msprobe/docs/04.kernel_dump_PyTorch.md +73 -0
- msprobe/docs/05.data_dump_PyTorch.md +93 -61
- msprobe/docs/06.data_dump_MindSpore.md +200 -95
- msprobe/docs/07.accuracy_checker_PyTorch.md +28 -28
- msprobe/docs/08.accuracy_checker_online_PyTorch.md +1 -6
- msprobe/docs/09.accuracy_checker_MindSpore.md +44 -8
- msprobe/docs/10.accuracy_compare_PyTorch.md +114 -50
- msprobe/docs/11.accuracy_compare_MindSpore.md +340 -48
- msprobe/docs/12.overflow_check_PyTorch.md +2 -2
- msprobe/docs/13.overflow_check_MindSpore.md +6 -6
- msprobe/docs/15.free_benchmarking_PyTorch.md +4 -5
- msprobe/docs/16.free_benchmarking_MindSpore.md +56 -37
- msprobe/docs/17.grad_probe.md +5 -6
- msprobe/docs/19.monitor.md +561 -0
- msprobe/docs/20.monitor_performance_baseline.md +52 -0
- msprobe/docs/21.visualization_PyTorch.md +466 -0
- msprobe/docs/22.visualization_MindSpore.md +481 -0
- msprobe/docs/23.generate_operator_PyTorch.md +107 -0
- msprobe/docs/24.code_mapping_Mindspore.md +28 -0
- msprobe/docs/25.tool_function_introduction.md +29 -0
- msprobe/docs/26.data_dump_PyTorch_baseline.md +37 -0
- msprobe/docs/27.dump_json_instruction.md +521 -0
- msprobe/docs/FAQ.md +29 -2
- msprobe/docs/accuracy_checker_MindSpore/accuracy_checker_MindSpore_baseline.md +14 -0
- msprobe/docs/data_dump_MindSpore/data_dump_MindSpore_baseline.md +22 -0
- msprobe/docs/data_dump_MindSpore/dynamic_graph_quick_start_example.md +211 -0
- msprobe/docs/img/compare_result.png +0 -0
- msprobe/docs/img/merge_result.png +0 -0
- msprobe/docs/img/monitor/cpu_info.png +0 -0
- msprobe/docs/img/visualization/fuzzy_match_ms.png +0 -0
- msprobe/docs/img/visualization/fuzzy_match_pt.png +0 -0
- msprobe/docs/img/visualization/tensorboard_1.png +0 -0
- msprobe/docs/img/visualization/tensorboard_2.png +0 -0
- msprobe/docs/img/visualization/vis_browser_1.png +0 -0
- msprobe/docs/img/visualization/vis_browser_2.png +0 -0
- msprobe/docs/img/visualization/vis_precision_info.png +0 -0
- msprobe/docs/img/visualization/vis_search_info.png +0 -0
- msprobe/docs/img/visualization/vis_show_info.png +0 -0
- msprobe/docs/img/visualization/vis_showcase.png +0 -0
- msprobe/docs/img/visualization/vis_unmatch_info.png +0 -0
- msprobe/docs/visualization/GPTModel.png +0 -0
- msprobe/docs/visualization/ParallelMLP.png +0 -0
- msprobe/docs/visualization/layer_mapping_example.md +132 -0
- msprobe/docs/visualization/mapping.png +0 -0
- msprobe/docs/visualization/mapping1.png +0 -0
- msprobe/docs/visualization/module_name.png +0 -0
- msprobe/docs/visualization/module_name1.png +0 -0
- msprobe/docs/visualization/no_mapping.png +0 -0
- msprobe/docs/visualization/no_mapping1.png +0 -0
- msprobe/docs/visualization/no_mapping_analyze.png +0 -0
- msprobe/docs/visualization/top_layer.png +0 -0
- msprobe/mindspore/__init__.py +25 -0
- msprobe/mindspore/api_accuracy_checker/api_accuracy_checker.py +151 -151
- msprobe/mindspore/api_accuracy_checker/api_info.py +21 -6
- msprobe/mindspore/api_accuracy_checker/api_runner.py +43 -18
- msprobe/mindspore/api_accuracy_checker/base_compare_algorithm.py +21 -7
- msprobe/mindspore/api_accuracy_checker/checker_support_api.yaml +77 -0
- msprobe/mindspore/api_accuracy_checker/cmd_parser.py +64 -1
- msprobe/mindspore/api_accuracy_checker/compute_element.py +64 -31
- msprobe/mindspore/api_accuracy_checker/data_manager.py +301 -0
- msprobe/mindspore/api_accuracy_checker/main.py +28 -3
- msprobe/mindspore/api_accuracy_checker/multi_api_accuracy_checker.py +212 -0
- msprobe/mindspore/api_accuracy_checker/multi_data_manager.py +60 -0
- msprobe/mindspore/api_accuracy_checker/type_mapping.py +22 -5
- msprobe/mindspore/api_accuracy_checker/utils.py +34 -17
- msprobe/mindspore/cell_processor.py +33 -12
- msprobe/mindspore/code_mapping/bind.py +264 -0
- msprobe/mindspore/code_mapping/cmd_parser.py +40 -0
- msprobe/mindspore/code_mapping/graph.py +49 -0
- msprobe/mindspore/code_mapping/graph_parser.py +226 -0
- msprobe/mindspore/code_mapping/main.py +24 -0
- msprobe/mindspore/code_mapping/processor.py +34 -0
- msprobe/mindspore/common/const.py +35 -13
- msprobe/mindspore/common/log.py +5 -9
- msprobe/mindspore/common/utils.py +88 -4
- msprobe/mindspore/compare/distributed_compare.py +22 -24
- msprobe/mindspore/compare/ms_compare.py +333 -268
- msprobe/mindspore/compare/ms_graph_compare.py +95 -52
- msprobe/mindspore/debugger/debugger_config.py +7 -1
- msprobe/mindspore/debugger/precision_debugger.py +87 -12
- msprobe/mindspore/dump/dump_tool_factory.py +3 -1
- msprobe/mindspore/dump/hook_cell/api_registry.py +95 -18
- msprobe/mindspore/dump/hook_cell/hook_cell.py +60 -38
- msprobe/mindspore/dump/hook_cell/primitive_hooks.py +45 -30
- msprobe/mindspore/dump/hook_cell/support_wrap_ops.yaml +36 -1
- msprobe/mindspore/dump/hook_cell/wrap_api.py +92 -1
- msprobe/mindspore/dump/jit_dump.py +17 -5
- msprobe/mindspore/dump/kernel_dump/kernel_config.py +33 -0
- msprobe/mindspore/dump/kernel_graph_dump.py +9 -4
- msprobe/mindspore/dump/kernel_kbyk_dump.py +2 -4
- msprobe/mindspore/dym_loader/hook_dynamic_loader.cc +140 -0
- msprobe/mindspore/dym_loader/hook_dynamic_loader.h +53 -0
- msprobe/mindspore/free_benchmark/api_pynative_self_check.py +156 -41
- msprobe/mindspore/free_benchmark/common/handler_params.py +1 -2
- msprobe/mindspore/free_benchmark/common/utils.py +19 -4
- msprobe/mindspore/free_benchmark/data/support_wrap_ops.yaml +0 -204
- msprobe/mindspore/free_benchmark/handler/base_handler.py +3 -3
- msprobe/mindspore/free_benchmark/handler/check_handler.py +4 -5
- msprobe/mindspore/free_benchmark/handler/fix_handler.py +4 -4
- msprobe/mindspore/free_benchmark/handler/handler_factory.py +4 -4
- msprobe/mindspore/free_benchmark/perturbation/add_noise.py +2 -2
- msprobe/mindspore/free_benchmark/perturbation/base_perturbation.py +15 -6
- msprobe/mindspore/free_benchmark/perturbation/bit_noise.py +2 -2
- msprobe/mindspore/free_benchmark/perturbation/exchange_value.py +2 -2
- msprobe/mindspore/free_benchmark/perturbation/improve_precision.py +13 -6
- msprobe/mindspore/free_benchmark/perturbation/perturbation_factory.py +2 -2
- msprobe/mindspore/free_benchmark/self_check_tool_factory.py +2 -2
- msprobe/mindspore/grad_probe/global_context.py +28 -8
- msprobe/mindspore/grad_probe/grad_analyzer.py +50 -24
- msprobe/mindspore/grad_probe/grad_monitor.py +16 -1
- msprobe/mindspore/grad_probe/grad_stat_csv.py +33 -5
- msprobe/mindspore/grad_probe/hook.py +35 -12
- msprobe/mindspore/grad_probe/utils.py +18 -5
- msprobe/mindspore/mindtorch/__init__.py +18 -0
- msprobe/mindspore/mindtorch/mindtorch_adaptor.py +255 -0
- msprobe/mindspore/ms_config.py +27 -16
- msprobe/mindspore/overflow_check/kernel_graph_overflow_check.py +9 -4
- msprobe/mindspore/runtime.py +15 -0
- msprobe/mindspore/service.py +285 -113
- msprobe/mindspore/task_handler_factory.py +15 -0
- msprobe/msprobe.py +48 -10
- msprobe/pytorch/__init__.py +8 -6
- msprobe/pytorch/api_accuracy_checker/common/config.py +62 -0
- msprobe/pytorch/api_accuracy_checker/common/utils.py +31 -16
- msprobe/pytorch/api_accuracy_checker/compare/algorithm.py +41 -8
- msprobe/pytorch/api_accuracy_checker/compare/api_precision_compare.py +103 -271
- msprobe/pytorch/api_accuracy_checker/compare/api_precision_standard.yaml +4 -1
- msprobe/pytorch/api_accuracy_checker/compare/compare.py +69 -68
- msprobe/pytorch/api_accuracy_checker/compare/compare_column.py +54 -0
- msprobe/pytorch/api_accuracy_checker/compare/compare_input.py +51 -0
- msprobe/pytorch/api_accuracy_checker/compare/compare_utils.py +2 -4
- msprobe/pytorch/api_accuracy_checker/generate_op_script/config_op.json +9 -0
- msprobe/pytorch/api_accuracy_checker/generate_op_script/op_generator.py +478 -0
- msprobe/pytorch/api_accuracy_checker/generate_op_script/operator_replication.template +365 -0
- msprobe/pytorch/api_accuracy_checker/precision_standard/absolute_threshold.py +106 -0
- msprobe/pytorch/api_accuracy_checker/precision_standard/accumulative_error_compare.py +107 -0
- msprobe/pytorch/api_accuracy_checker/precision_standard/base_standard.py +151 -0
- msprobe/pytorch/api_accuracy_checker/precision_standard/benchmark_compare.py +226 -0
- msprobe/pytorch/api_accuracy_checker/precision_standard/binary_consistency.py +68 -0
- msprobe/pytorch/api_accuracy_checker/precision_standard/standard_config.py +218 -0
- msprobe/pytorch/api_accuracy_checker/precision_standard/standard_register.py +104 -0
- msprobe/pytorch/api_accuracy_checker/precision_standard/thousandth_standard.py +63 -0
- msprobe/pytorch/api_accuracy_checker/precision_standard/ulp_compare.py +200 -0
- msprobe/pytorch/api_accuracy_checker/run_ut/data_generate.py +63 -2
- msprobe/pytorch/api_accuracy_checker/run_ut/multi_run_ut.py +21 -15
- msprobe/pytorch/api_accuracy_checker/run_ut/run_overflow_check.py +54 -22
- msprobe/pytorch/api_accuracy_checker/run_ut/run_ut.py +140 -71
- msprobe/pytorch/api_accuracy_checker/run_ut/run_ut_utils.py +49 -8
- msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/attl.py +9 -24
- msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/client.py +4 -12
- msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/device_dispatch.py +5 -3
- msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/dump_dispatch.py +9 -4
- msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/server.py +3 -11
- msprobe/pytorch/api_accuracy_checker/tensor_transport_layer/utils.py +2 -2
- msprobe/pytorch/bench_functions/confusion_transpose.py +5 -1
- msprobe/pytorch/bench_functions/matmul_backward.py +12 -0
- msprobe/pytorch/bench_functions/npu_fusion_attention.py +142 -16
- msprobe/pytorch/bench_functions/rotary_mul.py +4 -0
- msprobe/pytorch/bench_functions/swiglu.py +10 -2
- msprobe/pytorch/common/parse_json.py +7 -6
- msprobe/pytorch/common/utils.py +101 -7
- msprobe/pytorch/compare/distributed_compare.py +17 -30
- msprobe/pytorch/compare/pt_compare.py +44 -22
- msprobe/pytorch/debugger/debugger_config.py +46 -27
- msprobe/pytorch/debugger/precision_debugger.py +42 -12
- msprobe/pytorch/dump/kernel_dump/kernel_config.py +33 -0
- msprobe/pytorch/dump/module_dump/module_dump.py +86 -0
- msprobe/pytorch/{module_processer.py → dump/module_dump/module_processer.py} +81 -10
- msprobe/pytorch/free_benchmark/common/constant.py +15 -0
- msprobe/pytorch/free_benchmark/common/counter.py +15 -0
- msprobe/pytorch/free_benchmark/common/enums.py +15 -0
- msprobe/pytorch/free_benchmark/common/params.py +10 -2
- msprobe/pytorch/free_benchmark/common/utils.py +29 -4
- msprobe/pytorch/free_benchmark/compare/grad_saver.py +20 -5
- msprobe/pytorch/free_benchmark/compare/single_benchmark.py +2 -0
- msprobe/pytorch/free_benchmark/perturbed_layers/npu/add_noise.py +3 -1
- msprobe/pytorch/free_benchmark/perturbed_layers/npu/bit_noise.py +6 -4
- msprobe/pytorch/free_benchmark/perturbed_layers/npu/change_value.py +2 -0
- msprobe/pytorch/free_benchmark/perturbed_layers/npu/improve_precision.py +4 -0
- msprobe/pytorch/free_benchmark/result_handlers/base_handler.py +41 -47
- msprobe/pytorch/free_benchmark/result_handlers/fix_handler.py +6 -5
- msprobe/pytorch/free_benchmark/result_handlers/preheat_handler.py +0 -4
- msprobe/pytorch/grad_probe/grad_monitor.py +23 -6
- msprobe/pytorch/grad_probe/grad_stat_csv.py +40 -10
- msprobe/pytorch/hook_module/__init__.py +1 -1
- msprobe/pytorch/hook_module/hook_module.py +14 -11
- msprobe/pytorch/hook_module/register_optimizer_hook.py +59 -0
- msprobe/pytorch/hook_module/support_wrap_ops.yaml +35 -0
- msprobe/pytorch/hook_module/wrap_distributed.py +6 -8
- msprobe/pytorch/hook_module/wrap_functional.py +0 -38
- msprobe/pytorch/monitor/__init__.py +0 -0
- msprobe/pytorch/monitor/anomaly_analyse.py +201 -0
- msprobe/pytorch/monitor/anomaly_detect.py +425 -0
- msprobe/pytorch/monitor/csv2tb.py +166 -0
- msprobe/pytorch/monitor/distributed/__init__.py +0 -0
- msprobe/pytorch/monitor/distributed/distributed_ops.yaml +19 -0
- msprobe/pytorch/monitor/distributed/stack_blacklist.yaml +5 -0
- msprobe/pytorch/monitor/distributed/wrap_distributed.py +283 -0
- msprobe/pytorch/monitor/features.py +108 -0
- msprobe/pytorch/monitor/module_hook.py +1076 -0
- msprobe/pytorch/monitor/module_metric.py +172 -0
- msprobe/pytorch/monitor/module_spec_verifier.py +95 -0
- msprobe/pytorch/monitor/optimizer_collect.py +333 -0
- msprobe/pytorch/monitor/unittest/__init__.py +0 -0
- msprobe/pytorch/monitor/unittest/test_monitor.py +160 -0
- msprobe/pytorch/monitor/utils.py +321 -0
- msprobe/pytorch/monitor/visualizer.py +59 -0
- msprobe/pytorch/online_dispatch/__init__.py +2 -3
- msprobe/pytorch/online_dispatch/compare.py +29 -38
- msprobe/pytorch/online_dispatch/dispatch.py +58 -27
- msprobe/pytorch/online_dispatch/dump_compare.py +21 -9
- msprobe/pytorch/online_dispatch/single_compare.py +53 -32
- msprobe/pytorch/online_dispatch/torch_ops_config.yaml +1 -1
- msprobe/pytorch/online_dispatch/utils.py +49 -21
- msprobe/pytorch/parse_tool/lib/compare.py +21 -27
- msprobe/pytorch/parse_tool/lib/config.py +6 -8
- msprobe/pytorch/parse_tool/lib/file_desc.py +15 -1
- msprobe/pytorch/parse_tool/lib/interactive_cli.py +10 -10
- msprobe/pytorch/parse_tool/lib/parse_exception.py +7 -7
- msprobe/pytorch/parse_tool/lib/parse_tool.py +12 -12
- msprobe/pytorch/parse_tool/lib/utils.py +33 -53
- msprobe/pytorch/parse_tool/lib/visualization.py +11 -10
- msprobe/pytorch/pt_config.py +31 -8
- msprobe/pytorch/service.py +188 -108
- msprobe/visualization/__init__.py +14 -0
- msprobe/visualization/builder/__init__.py +14 -0
- msprobe/visualization/builder/graph_builder.py +222 -0
- msprobe/visualization/builder/msprobe_adapter.py +227 -0
- msprobe/visualization/compare/__init__.py +14 -0
- msprobe/visualization/compare/graph_comparator.py +180 -0
- msprobe/visualization/compare/mode_adapter.py +197 -0
- msprobe/visualization/graph/__init__.py +14 -0
- msprobe/visualization/graph/base_node.py +119 -0
- msprobe/visualization/graph/distributed_analyzer.py +318 -0
- msprobe/visualization/graph/graph.py +209 -0
- msprobe/visualization/graph/node_colors.py +95 -0
- msprobe/visualization/graph/node_op.py +39 -0
- msprobe/visualization/graph_service.py +288 -0
- msprobe/visualization/utils.py +217 -0
- mindstudio_probe-1.1.0.dist-info/RECORD +0 -287
- msprobe/docs/04.acl_config_examples.md +0 -78
- msprobe/mindspore/compare/layer_mapping.py +0 -146
- msprobe/mindspore/compare/modify_mapping.py +0 -107
- msprobe/mindspore/free_benchmark/decorator/dec_forward.py +0 -57
- msprobe/mindspore/free_benchmark/decorator/decorator_factory.py +0 -122
- msprobe/pytorch/functional/module_dump.py +0 -84
- {mindstudio_probe-1.1.0.dist-info → mindstudio_probe-1.2.1.dist-info}/LICENSE +0 -0
- {mindstudio_probe-1.1.0.dist-info → mindstudio_probe-1.2.1.dist-info}/top_level.txt +0 -0
- /msprobe/mindspore/{free_benchmark/decorator → code_mapping}/__init__.py +0 -0
- /msprobe/pytorch/{functional → dump/module_dump}/__init__.py +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
1
|
+
# Copyright (c) 2024-2025, Huawei Technologies Co., Ltd.
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
5
|
# you may not use this file except in compliance with the License.
|
|
7
6
|
# You may obtain a copy of the License at
|
|
8
7
|
#
|
|
@@ -13,16 +12,17 @@
|
|
|
13
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
13
|
# See the License for the specific language governing permissions and
|
|
15
14
|
# limitations under the License.
|
|
16
|
-
"""
|
|
17
15
|
|
|
18
16
|
import os
|
|
19
17
|
import time
|
|
20
|
-
import numpy as np
|
|
21
18
|
from collections import namedtuple
|
|
22
|
-
|
|
19
|
+
|
|
20
|
+
import numpy as np
|
|
21
|
+
|
|
22
|
+
from msprobe.core.common.file_utils import create_directory, load_npy, save_npy_to_txt, write_csv, os_walk_for_files
|
|
23
23
|
from msprobe.pytorch.parse_tool.lib.config import Const
|
|
24
24
|
from msprobe.pytorch.parse_tool.lib.parse_exception import ParseException
|
|
25
|
-
from msprobe.
|
|
25
|
+
from msprobe.pytorch.parse_tool.lib.utils import Util
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
class Compare:
|
|
@@ -126,7 +126,7 @@ class Compare:
|
|
|
126
126
|
all_close = np.allclose(data_left, data_right, atol=al, rtol=rl)
|
|
127
127
|
np.seterr(divide='raise')
|
|
128
128
|
cos_sim = np.dot(data_left, data_right) / (
|
|
129
|
-
|
|
129
|
+
np.sqrt(np.dot(data_left, data_left)) * np.sqrt(np.dot(data_right, data_right)))
|
|
130
130
|
err_cnt = 0
|
|
131
131
|
total_cnt = data_left.shape[0]
|
|
132
132
|
diff_table_columns = ['Index', 'Left', 'Right', 'Diff']
|
|
@@ -240,20 +240,14 @@ class Compare:
|
|
|
240
240
|
|
|
241
241
|
def convert_api_dir_to_npy(self, dump_dir, param, output_dir, msaccucmp_path):
|
|
242
242
|
dump_dir = self.util.path_strip(dump_dir)
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
self.convert_dump_to_npy(file_path, param, output_path, msaccucmp_path)
|
|
255
|
-
path_depth = root.count(os.sep)
|
|
256
|
-
if path_depth <= Const.MAX_TRAVERSAL_DEPTH:
|
|
257
|
-
yield root, _, files
|
|
258
|
-
else:
|
|
259
|
-
_[:] = []
|
|
243
|
+
files = os_walk_for_files(dump_dir, Const.MAX_TRAVERSAL_DEPTH)
|
|
244
|
+
filepaths = [os.path.join(file['root'], file['file']) for file in files]
|
|
245
|
+
for path in filepaths:
|
|
246
|
+
filename = os.path.basename(path)
|
|
247
|
+
parts = filename.split(".")
|
|
248
|
+
if len(parts) < 5:
|
|
249
|
+
continue
|
|
250
|
+
op_name = parts[1]
|
|
251
|
+
timestamp = parts[-1]
|
|
252
|
+
output_path = os.path.join(output_dir, op_name, timestamp)
|
|
253
|
+
self.convert_dump_to_npy(path, param, output_path, msaccucmp_path)
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
1
|
+
# Copyright (c) 2024-2025, Huawei Technologies Co., Ltd.
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
5
|
# you may not use this file except in compliance with the License.
|
|
7
6
|
# You may obtain a copy of the License at
|
|
8
7
|
#
|
|
@@ -13,14 +12,13 @@
|
|
|
13
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
13
|
# See the License for the specific language governing permissions and
|
|
15
14
|
# limitations under the License.
|
|
16
|
-
"""
|
|
17
15
|
|
|
18
16
|
import os
|
|
17
|
+
|
|
19
18
|
import numpy as np
|
|
20
19
|
|
|
21
20
|
|
|
22
21
|
class Const:
|
|
23
|
-
|
|
24
22
|
MS_ACCU_CMP_PATH = '/usr/local/Ascend/ascend-toolkit/latest/tools/operator_cmp/compare/msaccucmp.py'
|
|
25
23
|
MS_ACCU_CMP_FILE_NAME = 'msaccucmp.py'
|
|
26
24
|
ROOT_DIR = ""
|
|
@@ -33,7 +31,7 @@ class Const:
|
|
|
33
31
|
OFFLINE_DUMP_CONVERT_PATTERN = \
|
|
34
32
|
r"^([A-Za-z0-9_-]+)\.([A-Za-z0-9_-]+)\.([0-9]+)(\.[0-9]+)?\.([0-9]{1,255})" \
|
|
35
33
|
r"\.([a-z]+)\.([0-9]{1,255})(\.[x0-9]+)?\.npy$"
|
|
36
|
-
NUMPY_PATTERN = r"^[\w\-_
|
|
34
|
+
NUMPY_PATTERN = r"^[\w\-_.]+\.npy$"
|
|
37
35
|
NPY_SUFFIX = ".npy"
|
|
38
36
|
PKL_SUFFIX = ".pkl"
|
|
39
37
|
DIRECTORY_LENGTH = 4096
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Copyright (c) 2024-2025, Huawei Technologies Co., Ltd.
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
# you may not use this file except in compliance with the License.
|
|
6
|
+
# You may obtain a copy of the License at
|
|
7
|
+
#
|
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
#
|
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
# See the License for the specific language governing permissions and
|
|
14
|
+
# limitations under the License.
|
|
15
|
+
|
|
2
16
|
import os
|
|
3
17
|
|
|
4
18
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
1
|
+
# Copyright (c) 2024-2025, Huawei Technologies Co., Ltd.
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
5
|
# you may not use this file except in compliance with the License.
|
|
7
6
|
# You may obtain a copy of the License at
|
|
8
7
|
#
|
|
@@ -13,13 +12,14 @@
|
|
|
13
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
13
|
# See the License for the specific language governing permissions and
|
|
15
14
|
# limitations under the License.
|
|
16
|
-
|
|
17
|
-
import cmd
|
|
15
|
+
|
|
18
16
|
import argparse
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
import cmd
|
|
18
|
+
|
|
21
19
|
from msprobe.pytorch.parse_tool.lib.config import Const
|
|
22
20
|
from msprobe.pytorch.parse_tool.lib.parse_exception import catch_exception
|
|
21
|
+
from msprobe.pytorch.parse_tool.lib.parse_tool import ParseTool
|
|
22
|
+
from msprobe.pytorch.parse_tool.lib.utils import Util
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
class InteractiveCli(cmd.Cmd):
|
|
@@ -81,7 +81,7 @@ class InteractiveCli(cmd.Cmd):
|
|
|
81
81
|
self.util.check_files_in_path(args.my_dump_path)
|
|
82
82
|
self.util.check_files_in_path(args.golden_dump_path)
|
|
83
83
|
if self.util.dir_contains_only(args.my_dump_path, ".npy") and \
|
|
84
|
-
|
|
84
|
+
self.util.dir_contains_only(args.golden_dump_path, ".npy"):
|
|
85
85
|
self.parse_tool.do_compare_converted_dir(args)
|
|
86
86
|
else:
|
|
87
87
|
self.parse_tool.do_vector_compare(args)
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
1
|
+
# Copyright (c) 2024-2025, Huawei Technologies Co., Ltd.
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
5
|
# you may not use this file except in compliance with the License.
|
|
7
6
|
# You may obtain a copy of the License at
|
|
8
7
|
#
|
|
@@ -13,13 +12,13 @@
|
|
|
13
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
13
|
# See the License for the specific language governing permissions and
|
|
15
14
|
# limitations under the License.
|
|
16
|
-
|
|
15
|
+
|
|
17
16
|
import logging
|
|
17
|
+
|
|
18
18
|
from msprobe.core.common.exceptions import FileCheckException
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
class ParseException(Exception):
|
|
22
|
-
|
|
23
22
|
PARSE_INVALID_PATH_ERROR = 0
|
|
24
23
|
PARSE_NO_FILE_ERROR = 1
|
|
25
24
|
PARSE_NO_MODULE_ERROR = 2
|
|
@@ -51,4 +50,5 @@ def catch_exception(func):
|
|
|
51
50
|
except FileCheckException:
|
|
52
51
|
log.error("Command execution failed")
|
|
53
52
|
return result
|
|
53
|
+
|
|
54
54
|
return inner
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
1
|
+
# Copyright (c) 2024-2025, Huawei Technologies Co., Ltd.
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
5
|
# you may not use this file except in compliance with the License.
|
|
7
6
|
# You may obtain a copy of the License at
|
|
8
7
|
#
|
|
@@ -13,17 +12,18 @@
|
|
|
13
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
13
|
# See the License for the specific language governing permissions and
|
|
15
14
|
# limitations under the License.
|
|
16
|
-
|
|
15
|
+
|
|
17
16
|
import argparse
|
|
18
17
|
import os
|
|
19
18
|
from collections import namedtuple
|
|
20
19
|
|
|
20
|
+
from msprobe.core.common.file_utils import create_directory
|
|
21
|
+
from msprobe.pytorch.parse_tool.lib.compare import Compare
|
|
21
22
|
from msprobe.pytorch.parse_tool.lib.config import Const
|
|
23
|
+
from msprobe.pytorch.parse_tool.lib.parse_exception import catch_exception, ParseException
|
|
22
24
|
from msprobe.pytorch.parse_tool.lib.utils import Util
|
|
23
|
-
from msprobe.pytorch.parse_tool.lib.compare import Compare
|
|
24
25
|
from msprobe.pytorch.parse_tool.lib.visualization import Visualization
|
|
25
|
-
|
|
26
|
-
from msprobe.core.common.file_utils import create_directory
|
|
26
|
+
|
|
27
27
|
|
|
28
28
|
class ParseTool:
|
|
29
29
|
def __init__(self):
|
|
@@ -117,7 +117,8 @@ class ParseTool:
|
|
|
117
117
|
self.util.check_path_valid(args.golden_dump_path)
|
|
118
118
|
self.util.check_file_path_format(args.my_dump_path, Const.NPY_SUFFIX)
|
|
119
119
|
self.util.check_file_path_format(args.golden_dump_path, Const.NPY_SUFFIX)
|
|
120
|
-
compare_data_args = namedtuple('compare_data_args',
|
|
120
|
+
compare_data_args = namedtuple('compare_data_args',
|
|
121
|
+
['my_dump_path', 'golden_dump_path', 'save', 'rtol', 'atol', 'count'])
|
|
121
122
|
compare_data_args.__new__.__defaults__ = (False, 0.001, 0.001, 20)
|
|
122
123
|
res = compare_data_args(args.my_dump_path, args.golden_dump_path, args.save, args.rtol, args.atol, args.count)
|
|
123
124
|
self.compare.compare_data(res)
|
|
@@ -132,8 +133,7 @@ class ParseTool:
|
|
|
132
133
|
" '-m' and '-g'.")
|
|
133
134
|
raise ParseException("My directory path and golden directory path is same.")
|
|
134
135
|
output_path = self.util.path_strip(args.output_path) if args.output_path else Const.BATCH_COMPARE_DIR
|
|
135
|
-
|
|
136
|
-
os.makedirs(output_path, mode=0o750)
|
|
136
|
+
create_directory(output_path)
|
|
137
137
|
self.compare.compare_converted_dir(my_dump_dir, golden_dump_dir, output_path)
|
|
138
138
|
|
|
139
139
|
@catch_exception
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
1
|
+
# Copyright (c) 2024-2025, Huawei Technologies Co., Ltd.
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
5
|
# you may not use this file except in compliance with the License.
|
|
7
6
|
# You may obtain a copy of the License at
|
|
8
7
|
#
|
|
@@ -13,24 +12,24 @@
|
|
|
13
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
13
|
# See the License for the specific language governing permissions and
|
|
15
14
|
# limitations under the License.
|
|
16
|
-
|
|
15
|
+
|
|
16
|
+
import hashlib
|
|
17
17
|
import os
|
|
18
18
|
import re
|
|
19
|
-
import sys
|
|
20
19
|
import subprocess
|
|
21
|
-
import
|
|
20
|
+
import sys
|
|
22
21
|
import time
|
|
23
|
-
import numpy as np
|
|
24
22
|
from collections import namedtuple
|
|
23
|
+
|
|
24
|
+
import numpy as np
|
|
25
|
+
from msprobe.core.common.const import FileCheckConst
|
|
26
|
+
from msprobe.core.common.file_utils import change_mode, check_other_user_writable, \
|
|
27
|
+
check_path_executable, check_path_owner_consistent
|
|
28
|
+
from msprobe.core.common.file_utils import check_file_or_directory_path, remove_path, check_file_type, os_walk_for_files
|
|
29
|
+
from msprobe.pytorch.common.log import logger
|
|
25
30
|
from msprobe.pytorch.parse_tool.lib.config import Const
|
|
26
31
|
from msprobe.pytorch.parse_tool.lib.file_desc import DumpDecodeFileDesc, FileDesc
|
|
27
32
|
from msprobe.pytorch.parse_tool.lib.parse_exception import ParseException
|
|
28
|
-
from msprobe.core.common.file_utils import change_mode, check_other_user_writable,\
|
|
29
|
-
check_path_executable, check_path_owner_consistent
|
|
30
|
-
from msprobe.core.common.const import FileCheckConst
|
|
31
|
-
from msprobe.core.common.file_utils import check_file_or_directory_path, remove_path, check_file_type
|
|
32
|
-
from msprobe.pytorch.common.log import logger
|
|
33
|
-
|
|
34
33
|
|
|
35
34
|
try:
|
|
36
35
|
from rich.traceback import install
|
|
@@ -81,16 +80,8 @@ class Util:
|
|
|
81
80
|
|
|
82
81
|
@staticmethod
|
|
83
82
|
def get_subfiles_count(directory):
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
check_file_or_directory_path(root, isdir=True)
|
|
87
|
-
file_count += len(files)
|
|
88
|
-
path_depth = root.count(os.sep)
|
|
89
|
-
if path_depth <= Const.MAX_TRAVERSAL_DEPTH:
|
|
90
|
-
yield root, _, files
|
|
91
|
-
else:
|
|
92
|
-
_[:] = []
|
|
93
|
-
return file_count
|
|
83
|
+
files = os_walk_for_files(directory, Const.MAX_TRAVERSAL_DEPTH)
|
|
84
|
+
return len(files)
|
|
94
85
|
|
|
95
86
|
@staticmethod
|
|
96
87
|
def get_sorted_subdirectories_names(directory):
|
|
@@ -143,25 +134,19 @@ class Util:
|
|
|
143
134
|
zero_mask = (data == 0)
|
|
144
135
|
data[zero_mask] += np.finfo(float).eps
|
|
145
136
|
return data
|
|
146
|
-
|
|
137
|
+
|
|
147
138
|
@staticmethod
|
|
148
139
|
def dir_contains_only(path, endfix):
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
return False
|
|
154
|
-
path_depth = root.count(os.sep)
|
|
155
|
-
if path_depth <= Const.MAX_TRAVERSAL_DEPTH:
|
|
156
|
-
yield root, _, files
|
|
157
|
-
else:
|
|
158
|
-
_[:] = []
|
|
140
|
+
files = os_walk_for_files(path, Const.MAX_TRAVERSAL_DEPTH)
|
|
141
|
+
for file in files:
|
|
142
|
+
if not file['file'].endswith(endfix):
|
|
143
|
+
return False
|
|
159
144
|
return True
|
|
160
|
-
|
|
145
|
+
|
|
161
146
|
@staticmethod
|
|
162
147
|
def localtime_str():
|
|
163
148
|
return time.strftime("%Y%m%d%H%M%S", time.localtime())
|
|
164
|
-
|
|
149
|
+
|
|
165
150
|
@staticmethod
|
|
166
151
|
def change_filemode_safe(path):
|
|
167
152
|
change_mode(path, FileCheckConst.DATA_FILE_AUTHORITY)
|
|
@@ -222,7 +207,7 @@ class Util:
|
|
|
222
207
|
|
|
223
208
|
def list_numpy_files(self, path, extern_pattern=''):
|
|
224
209
|
return self.list_file_with_pattern(path, Const.NUMPY_PATTERN, extern_pattern,
|
|
225
|
-
|
|
210
|
+
self._gen_numpy_file_info)
|
|
226
211
|
|
|
227
212
|
def create_columns(self, content):
|
|
228
213
|
if not Columns:
|
|
@@ -273,20 +258,15 @@ class Util:
|
|
|
273
258
|
self.check_path_valid(path)
|
|
274
259
|
file_list = {}
|
|
275
260
|
re_pattern = re.compile(pattern)
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
path_depth = dir_path.count(os.sep)
|
|
286
|
-
if path_depth <= Const.MAX_TRAVERSAL_DEPTH:
|
|
287
|
-
yield dir_path, _, file_names
|
|
288
|
-
else:
|
|
289
|
-
_[:] = []
|
|
261
|
+
files = os_walk_for_files(path, Const.MAX_TRAVERSAL_DEPTH)
|
|
262
|
+
for file in files:
|
|
263
|
+
name = file["file"]
|
|
264
|
+
match = re_pattern.match(name)
|
|
265
|
+
if not match:
|
|
266
|
+
continue
|
|
267
|
+
if extern_pattern != '' and re_pattern.match(extern_pattern) and not re.match(extern_pattern, name):
|
|
268
|
+
continue
|
|
269
|
+
file_list[name] = gen_info_func(name, match, file["root"])
|
|
290
270
|
return file_list
|
|
291
271
|
|
|
292
272
|
def check_file_path_format(self, path, suffix):
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
#
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
1
|
+
# Copyright (c) 2024-2025, Huawei Technologies Co., Ltd.
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
#
|
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
5
|
# you may not use this file except in compliance with the License.
|
|
7
6
|
# You may obtain a copy of the License at
|
|
8
7
|
#
|
|
@@ -13,14 +12,14 @@
|
|
|
13
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
13
|
# See the License for the specific language governing permissions and
|
|
15
14
|
# limitations under the License.
|
|
16
|
-
|
|
15
|
+
|
|
17
16
|
import json
|
|
18
|
-
import numpy as np
|
|
19
17
|
|
|
18
|
+
import numpy as np
|
|
19
|
+
from msprobe.core.common.file_utils import FileOpen, load_npy, save_npy_to_txt
|
|
20
20
|
from msprobe.pytorch.parse_tool.lib.config import Const
|
|
21
|
-
from msprobe.pytorch.parse_tool.lib.utils import Util
|
|
22
21
|
from msprobe.pytorch.parse_tool.lib.parse_exception import ParseException
|
|
23
|
-
from msprobe.
|
|
22
|
+
from msprobe.pytorch.parse_tool.lib.utils import Util
|
|
24
23
|
|
|
25
24
|
|
|
26
25
|
class Visualization:
|
|
@@ -65,6 +64,8 @@ class Visualization:
|
|
|
65
64
|
self.util.log.error("%s %s in line %s" % ("JSONDecodeError", str(e), pkl_line))
|
|
66
65
|
self.util.log.warning("Please check the pkl file")
|
|
67
66
|
raise ParseException(ParseException.PARSE_JSONDECODE_ERROR) from e
|
|
67
|
+
if not isinstance(msg, list) or len(msg) == 0:
|
|
68
|
+
break
|
|
68
69
|
info_prefix = msg[0]
|
|
69
70
|
if not info_prefix.startswith(api_name):
|
|
70
71
|
continue
|
|
@@ -75,7 +76,7 @@ class Visualization:
|
|
|
75
76
|
self.util.log.info(" File \"{}\", line {}, in {}".format(item[0], item[1], item[2]))
|
|
76
77
|
self.util.log.info(" {}".format(item[3]))
|
|
77
78
|
continue
|
|
78
|
-
if len(msg) > 5 and len(msg[5]) >=
|
|
79
|
+
if len(msg) > 5 and len(msg[5]) >= 3:
|
|
79
80
|
summery_info = " [{}][dtype: {}][shape: {}][max: {}][min: {}][mean: {}]" \
|
|
80
81
|
.format(msg[0], msg[3], msg[4], msg[5][0], msg[5][1], msg[5][2])
|
|
81
82
|
if not title_printed:
|
msprobe/pytorch/pt_config.py
CHANGED
|
@@ -14,11 +14,13 @@
|
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
16
|
import os
|
|
17
|
+
import re
|
|
17
18
|
|
|
18
19
|
from msprobe.core.common.const import Const
|
|
19
20
|
from msprobe.core.common.exceptions import MsprobeException
|
|
20
|
-
from msprobe.core.common.file_utils import FileOpen, load_json
|
|
21
|
+
from msprobe.core.common.file_utils import FileOpen, load_json, check_file_or_directory_path, check_crt_valid
|
|
21
22
|
from msprobe.core.common.log import logger
|
|
23
|
+
from msprobe.core.common.utils import is_int
|
|
22
24
|
from msprobe.core.common_config import BaseConfig, CommonConfig
|
|
23
25
|
from msprobe.core.grad_probe.constant import level_adp
|
|
24
26
|
from msprobe.core.grad_probe.utils import check_bounds
|
|
@@ -38,17 +40,38 @@ class TensorConfig(BaseConfig):
|
|
|
38
40
|
self.host = json_config.get("host", "")
|
|
39
41
|
self.port = json_config.get("port", -1)
|
|
40
42
|
self.tls_path = json_config.get("tls_path", "./")
|
|
43
|
+
self.online_run_ut_recompute = json_config.get("online_run_ut_recompute", False)
|
|
41
44
|
self.check_config()
|
|
42
45
|
self._check_file_format()
|
|
43
|
-
self.
|
|
46
|
+
if self.online_run_ut:
|
|
47
|
+
self._check_online_run_ut()
|
|
44
48
|
|
|
45
49
|
def _check_file_format(self):
|
|
46
50
|
if self.file_format is not None and self.file_format not in ["npy", "bin"]:
|
|
47
51
|
raise Exception("file_format is invalid")
|
|
48
52
|
|
|
49
|
-
def
|
|
50
|
-
if
|
|
51
|
-
raise Exception("
|
|
53
|
+
def _check_online_run_ut(self):
|
|
54
|
+
if not isinstance(self.online_run_ut, bool):
|
|
55
|
+
raise Exception(f"online_run_ut: {self.online_run_ut} is invalid.")
|
|
56
|
+
|
|
57
|
+
if not isinstance(self.online_run_ut_recompute, bool):
|
|
58
|
+
raise Exception(f"online_run_ut_recompute: {self.online_run_ut_recompute} is invalid.")
|
|
59
|
+
|
|
60
|
+
if self.nfs_path:
|
|
61
|
+
check_file_or_directory_path(self.nfs_path, isdir=True)
|
|
62
|
+
return
|
|
63
|
+
|
|
64
|
+
if self.tls_path:
|
|
65
|
+
check_file_or_directory_path(self.tls_path, isdir=True)
|
|
66
|
+
check_file_or_directory_path(os.path.join(self.tls_path, "client.key"))
|
|
67
|
+
check_file_or_directory_path(os.path.join(self.tls_path, "client.crt"))
|
|
68
|
+
check_crt_valid(os.path.join(self.tls_path, "client.crt"))
|
|
69
|
+
|
|
70
|
+
if not isinstance(self.host, str) or not re.match(Const.ipv4_pattern, self.host):
|
|
71
|
+
raise Exception(f"host: {self.host} is invalid.")
|
|
72
|
+
|
|
73
|
+
if not isinstance(self.port, int) or not (0 < self.port <= 65535):
|
|
74
|
+
raise Exception(f"port: {self.port} is invalid, port range 0-65535.")
|
|
52
75
|
|
|
53
76
|
|
|
54
77
|
class StatisticsConfig(BaseConfig):
|
|
@@ -70,7 +93,7 @@ class OverflowCheckConfig(BaseConfig):
|
|
|
70
93
|
self.check_overflow_config()
|
|
71
94
|
|
|
72
95
|
def check_overflow_config(self):
|
|
73
|
-
if self.overflow_nums is not None and not
|
|
96
|
+
if self.overflow_nums is not None and not is_int(self.overflow_nums):
|
|
74
97
|
raise Exception("overflow_num is invalid")
|
|
75
98
|
if self.check_mode is not None and self.check_mode not in ["all", "aicore", "atomic"]:
|
|
76
99
|
raise Exception("check_mode is invalid")
|
|
@@ -170,7 +193,7 @@ class FreeBenchmarkCheckConfig(BaseConfig):
|
|
|
170
193
|
)
|
|
171
194
|
|
|
172
195
|
def _check_preheat_config(self):
|
|
173
|
-
if not
|
|
196
|
+
if not is_int(self.preheat_step):
|
|
174
197
|
msg = "preheat_step is invalid, it should be an integer"
|
|
175
198
|
logger.error_log_with_exp(
|
|
176
199
|
msg, MsprobeException(MsprobeException.INVALID_PARAM_ERROR, msg)
|
|
@@ -180,7 +203,7 @@ class FreeBenchmarkCheckConfig(BaseConfig):
|
|
|
180
203
|
logger.error_log_with_exp(
|
|
181
204
|
msg, MsprobeException(MsprobeException.INVALID_PARAM_ERROR, msg)
|
|
182
205
|
)
|
|
183
|
-
if not
|
|
206
|
+
if not is_int(self.max_sample):
|
|
184
207
|
msg = "max_sample is invalid, it should be an integer"
|
|
185
208
|
logger.error_log_with_exp(
|
|
186
209
|
msg, MsprobeException(MsprobeException.INVALID_PARAM_ERROR, msg)
|