mindspore 2.6.0rc1__cp311-cp311-win_amd64.whl → 2.7.0__cp311-cp311-win_amd64.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.
Potentially problematic release.
This version of mindspore might be problematic. Click here for more details.
- mindspore/.commit_id +1 -1
- mindspore/Microsoft.VisualStudio.Telemetry.dll +0 -0
- mindspore/Newtonsoft.Json.dll +0 -0
- mindspore/__init__.py +2 -2
- mindspore/_c_dataengine.cp311-win_amd64.pyd +0 -0
- mindspore/_c_expression.cp311-win_amd64.pyd +0 -0
- mindspore/_c_mindrecord.cp311-win_amd64.pyd +0 -0
- mindspore/_checkparam.py +42 -11
- mindspore/_extends/builtin_operations.py +3 -3
- mindspore/{_deprecated → _extends/optimize}/__init__.py +9 -3
- mindspore/_extends/optimize/cell_utils.py +96 -0
- mindspore/_extends/parallel_compile/akg_compiler/custom.py +1109 -0
- mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +1 -1
- mindspore/_extends/parse/__init__.py +3 -3
- mindspore/_extends/parse/compile_config.py +44 -22
- mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +1 -2
- mindspore/_extends/parse/parser.py +65 -84
- mindspore/_extends/parse/resources.py +39 -0
- mindspore/_extends/parse/standard_method.py +58 -14
- mindspore/_extends/parse/trope.py +8 -1
- mindspore/_extends/pijit/__init__.py +1 -2
- mindspore/_extends/pijit/pijit_func_white_list.py +2 -5
- mindspore/amp.py +4 -22
- mindspore/atlprov.dll +0 -0
- mindspore/avcodec-59.dll +0 -0
- mindspore/avdevice-59.dll +0 -0
- mindspore/avfilter-8.dll +0 -0
- mindspore/avformat-59.dll +0 -0
- mindspore/avutil-57.dll +0 -0
- mindspore/boost/adasum.py +1 -1
- mindspore/boost/boost_cell_wrapper.py +4 -4
- mindspore/c1.dll +0 -0
- mindspore/c1xx.dll +0 -0
- mindspore/c2.dll +0 -0
- mindspore/common/__init__.py +43 -12
- mindspore/common/_grad_function.py +2 -1
- mindspore/common/_pijit_context.py +28 -7
- mindspore/common/_stub_tensor.py +1 -209
- mindspore/common/_tensor_cpp_method.py +1 -1
- mindspore/common/_tensor_docs.py +178 -53
- mindspore/common/_utils.py +9 -1
- mindspore/common/api.py +377 -203
- mindspore/common/dtype.py +108 -57
- mindspore/common/dump.py +11 -16
- mindspore/common/dynamic_shape/__init__.py +0 -0
- mindspore/common/{auto_dynamic_shape.py → dynamic_shape/auto_dynamic_shape.py} +17 -23
- mindspore/common/dynamic_shape/enable_dynamic.py +197 -0
- mindspore/common/file_system.py +59 -9
- mindspore/common/generator.py +5 -3
- mindspore/common/hook_handle.py +33 -5
- mindspore/common/jit_config.py +1 -1
- mindspore/common/jit_trace.py +84 -105
- mindspore/common/np_dtype.py +3 -3
- mindspore/common/parameter.py +27 -29
- mindspore/common/recompute.py +5 -7
- mindspore/common/sparse_tensor.py +0 -3
- mindspore/common/symbol.py +0 -1
- mindspore/common/tensor.py +117 -131
- mindspore/communication/_comm_helper.py +46 -4
- mindspore/communication/management.py +79 -7
- mindspore/context.py +67 -55
- mindspore/dataset/__init__.py +1 -1
- mindspore/dataset/audio/transforms.py +1 -1
- mindspore/dataset/core/config.py +38 -4
- mindspore/dataset/engine/datasets.py +350 -322
- mindspore/dataset/engine/datasets_user_defined.py +70 -24
- mindspore/dataset/engine/iterators.py +2 -2
- mindspore/dataset/engine/obs/config_loader.py +2 -2
- mindspore/dataset/engine/obs/obs_mindrecord_dataset.py +8 -0
- mindspore/dataset/transforms/c_transforms.py +2 -2
- mindspore/dataset/transforms/py_transforms.py +7 -3
- mindspore/dataset/transforms/transforms.py +10 -6
- mindspore/dataset/vision/__init__.py +1 -1
- mindspore/dataset/vision/py_transforms.py +8 -8
- mindspore/dataset/vision/transforms.py +17 -5
- mindspore/dataset/vision/utils.py +632 -21
- mindspore/dataset/vision/validators.py +1 -0
- mindspore/device_context/ascend/device.py +1 -1
- mindspore/device_context/ascend/op_tuning.py +35 -1
- mindspore/device_context/gpu/__init__.py +2 -2
- mindspore/device_context/gpu/device.py +1 -1
- mindspore/device_context/gpu/op_precision.py +4 -2
- mindspore/device_context/gpu/op_tuning.py +6 -3
- mindspore/device_manager.py +16 -9
- mindspore/dnnl.dll +0 -0
- mindspore/dpcmi.dll +0 -0
- mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +3 -4
- mindspore/experimental/llm_boost/atb/boost_base.py +2 -3
- mindspore/experimental/optim/adadelta.py +13 -20
- mindspore/experimental/optim/adagrad.py +15 -22
- mindspore/experimental/optim/adam.py +17 -24
- mindspore/experimental/optim/adamax.py +14 -22
- mindspore/experimental/optim/adamw.py +28 -34
- mindspore/experimental/optim/asgd.py +15 -25
- mindspore/experimental/optim/lr_scheduler.py +27 -45
- mindspore/experimental/optim/nadam.py +14 -24
- mindspore/experimental/optim/optimizer.py +13 -23
- mindspore/experimental/optim/radam.py +18 -24
- mindspore/experimental/optim/rmsprop.py +14 -25
- mindspore/experimental/optim/rprop.py +15 -26
- mindspore/experimental/optim/sgd.py +9 -19
- mindspore/hal/__init__.py +4 -4
- mindspore/hal/contiguous_tensors_handle.py +2 -2
- mindspore/hal/memory.py +27 -7
- mindspore/include/api/cell.h +65 -5
- mindspore/include/api/cfg.h +24 -7
- mindspore/include/api/context.h +1 -0
- mindspore/include/api/delegate.h +10 -2
- mindspore/include/api/dual_abi_helper.h +100 -19
- mindspore/include/api/graph.h +14 -1
- mindspore/include/api/kernel.h +16 -3
- mindspore/include/api/kernel_api.h +9 -1
- mindspore/include/api/metrics/accuracy.h +9 -0
- mindspore/include/api/model.h +8 -1
- mindspore/include/api/model_group.h +4 -0
- mindspore/include/api/model_parallel_runner.h +2 -0
- mindspore/include/api/status.h +48 -10
- mindspore/include/api/types.h +8 -3
- mindspore/include/c_api/model_c.h +0 -58
- mindspore/include/c_api/tensor_c.h +0 -26
- mindspore/include/dataset/constants.h +9 -0
- mindspore/include/dataset/vision_ascend.h +1 -1
- mindspore/jpeg62.dll +0 -0
- mindspore/mindrecord/tools/cifar10.py +61 -11
- mindspore/mindrecord/tools/cifar10_to_mr.py +5 -0
- mindspore/mindspore_backend_common.dll +0 -0
- mindspore/mindspore_backend_manager.dll +0 -0
- mindspore/mindspore_common.dll +0 -0
- mindspore/mindspore_core.dll +0 -0
- mindspore/mindspore_cpu_res_manager.dll +0 -0
- mindspore/mindspore_dump.dll +0 -0
- mindspore/mindspore_frontend.dll +0 -0
- mindspore/mindspore_glog.dll +0 -0
- mindspore/mindspore_memory_pool.dll +0 -0
- mindspore/mindspore_ms_backend.dll +0 -0
- mindspore/mindspore_ops.dll +0 -0
- mindspore/mindspore_ops_host.dll +0 -0
- mindspore/mindspore_ops_kernel_common.dll +0 -0
- mindspore/mindspore_profiler.dll +0 -0
- mindspore/mindspore_pyboost.dll +0 -0
- mindspore/mindspore_pynative.dll +0 -0
- mindspore/mindspore_res_manager.dll +0 -0
- mindspore/mindspore_runtime_pipeline.dll +0 -0
- mindspore/mint/__init__.py +6 -46
- mindspore/mint/distributed/__init__.py +5 -0
- mindspore/mint/distributed/distributed.py +429 -23
- mindspore/mint/nn/__init__.py +1 -1
- mindspore/mint/nn/functional.py +53 -6
- mindspore/mint/nn/layer/_functions.py +163 -294
- mindspore/mint/nn/layer/activation.py +8 -6
- mindspore/mint/nn/layer/conv.py +140 -104
- mindspore/mint/nn/layer/normalization.py +11 -25
- mindspore/mint/optim/adam.py +19 -18
- mindspore/mint/optim/adamw.py +14 -8
- mindspore/mint/optim/sgd.py +5 -5
- mindspore/msobj140.dll +0 -0
- mindspore/mspdb140.dll +0 -0
- mindspore/mspdbcore.dll +0 -0
- mindspore/mspdbst.dll +0 -0
- mindspore/mspft140.dll +0 -0
- mindspore/msvcdis140.dll +0 -0
- mindspore/msvcp140_1.dll +0 -0
- mindspore/msvcp140_2.dll +0 -0
- mindspore/msvcp140_atomic_wait.dll +0 -0
- mindspore/msvcp140_codecvt_ids.dll +0 -0
- mindspore/nn/cell.py +491 -623
- mindspore/nn/grad/cell_grad.py +11 -12
- mindspore/nn/layer/activation.py +36 -36
- mindspore/nn/layer/basic.py +74 -77
- mindspore/nn/layer/channel_shuffle.py +4 -4
- mindspore/nn/layer/combined.py +4 -2
- mindspore/nn/layer/conv.py +117 -110
- mindspore/nn/layer/dense.py +9 -7
- mindspore/nn/layer/embedding.py +50 -52
- mindspore/nn/layer/image.py +38 -40
- mindspore/nn/layer/math.py +111 -112
- mindspore/nn/layer/normalization.py +56 -44
- mindspore/nn/layer/pooling.py +58 -63
- mindspore/nn/layer/rnn_cells.py +33 -33
- mindspore/nn/layer/rnns.py +56 -56
- mindspore/nn/layer/thor_layer.py +74 -73
- mindspore/nn/layer/transformer.py +11 -1
- mindspore/nn/learning_rate_schedule.py +20 -20
- mindspore/nn/loss/loss.py +79 -81
- mindspore/nn/optim/adam.py +4 -6
- mindspore/nn/optim/adasum.py +2 -2
- mindspore/nn/optim/asgd.py +2 -0
- mindspore/nn/optim/lamb.py +1 -3
- mindspore/nn/optim/optimizer.py +1 -1
- mindspore/nn/optim/tft_wrapper.py +2 -3
- mindspore/nn/optim/thor.py +2 -2
- mindspore/nn/probability/distribution/_utils/utils.py +2 -2
- mindspore/nn/probability/distribution/exponential.py +2 -1
- mindspore/nn/probability/distribution/poisson.py +2 -1
- mindspore/nn/sparse/sparse.py +3 -3
- mindspore/nn/wrap/cell_wrapper.py +73 -42
- mindspore/nn/wrap/grad_reducer.py +37 -52
- mindspore/nn/wrap/loss_scale.py +72 -74
- mindspore/numpy/array_creations.py +7 -7
- mindspore/numpy/fft.py +1 -1
- mindspore/numpy/math_ops.py +5 -5
- mindspore/numpy/utils_const.py +1 -1
- mindspore/opencv_core452.dll +0 -0
- mindspore/opencv_imgcodecs452.dll +0 -0
- mindspore/opencv_imgproc452.dll +0 -0
- mindspore/ops/_grad_experimental/grad_comm_ops.py +51 -13
- mindspore/ops/_grad_experimental/grad_debug_ops.py +14 -0
- mindspore/ops/_grad_experimental/grad_inner_ops.py +0 -9
- mindspore/ops/_op_impl/cpu/__init__.py +1 -0
- mindspore/{experimental/es/__init__.py → ops/_op_impl/cpu/joinedstr_op.py} +12 -6
- mindspore/ops/_vmap/vmap_array_ops.py +31 -13
- mindspore/ops/_vmap/vmap_nn_ops.py +8 -16
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +54 -13
- mindspore/ops/auto_generate/gen_extend_func.py +27 -145
- mindspore/ops/auto_generate/gen_ops_def.py +1027 -347
- mindspore/ops/auto_generate/gen_ops_prim.py +2341 -1117
- mindspore/ops/auto_generate/pyboost_inner_prim.py +31 -1
- mindspore/ops/composite/__init__.py +10 -0
- mindspore/ops/composite/base.py +9 -5
- mindspore/ops/composite/multitype_ops/__init__.py +12 -1
- mindspore/ops/composite/multitype_ops/_compile_utils.py +133 -109
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -1
- mindspore/ops/composite/multitype_ops/add_impl.py +70 -2
- mindspore/ops/composite/multitype_ops/div_impl.py +49 -0
- mindspore/ops/composite/multitype_ops/floordiv_impl.py +29 -0
- mindspore/ops/composite/multitype_ops/getitem_impl.py +11 -0
- mindspore/ops/composite/multitype_ops/mod_impl.py +5 -3
- mindspore/ops/composite/multitype_ops/mul_impl.py +49 -0
- mindspore/ops/composite/multitype_ops/setitem_impl.py +57 -0
- mindspore/ops/composite/multitype_ops/sub_impl.py +34 -0
- mindspore/ops/composite/multitype_ops/zeros_like_impl.py +14 -0
- mindspore/ops/function/__init__.py +4 -1
- mindspore/ops/function/_add_attr_func.py +11 -6
- mindspore/ops/function/array_func.py +19 -102
- mindspore/ops/function/debug_func.py +8 -5
- mindspore/ops/function/grad/grad_func.py +5 -13
- mindspore/ops/function/math_func.py +77 -572
- mindspore/ops/function/nn_func.py +46 -94
- mindspore/ops/function/other_func.py +4 -1
- mindspore/ops/function/random_func.py +44 -5
- mindspore/ops/function/vmap_func.py +2 -1
- mindspore/ops/functional.py +4 -4
- mindspore/ops/functional_overload.py +594 -18
- mindspore/ops/op_info_register.py +21 -0
- mindspore/ops/operations/__init__.py +16 -11
- mindspore/ops/operations/_custom_ops_utils.py +689 -34
- mindspore/ops/operations/_inner_ops.py +14 -18
- mindspore/ops/operations/_sequence_ops.py +1 -1
- mindspore/ops/operations/array_ops.py +5 -51
- mindspore/ops/operations/comm_ops.py +186 -41
- mindspore/ops/operations/custom_ops.py +303 -177
- mindspore/ops/operations/debug_ops.py +59 -4
- mindspore/ops/operations/image_ops.py +13 -13
- mindspore/ops/operations/manually_defined/ops_def.py +27 -28
- mindspore/ops/operations/math_ops.py +8 -9
- mindspore/ops/operations/nn_ops.py +8 -40
- mindspore/ops/primitive.py +9 -20
- mindspore/ops/tensor_method.py +63 -15
- mindspore/ops_generate/api/cpp_create_prim_instance_helper_generator.py +1 -1
- mindspore/ops_generate/api/functional_map_cpp_generator.py +10 -9
- mindspore/ops_generate/api/functions_cc_generator.py +58 -10
- mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +1 -1
- mindspore/ops_generate/common/base_generator.py +14 -0
- mindspore/ops_generate/common/gen_constants.py +8 -3
- mindspore/ops_generate/common/gen_utils.py +0 -19
- mindspore/ops_generate/common/op_proto.py +11 -4
- mindspore/ops_generate/common/template.py +88 -11
- mindspore/ops_generate/gen_ops.py +1 -1
- mindspore/ops_generate/op_def/lite_ops_cpp_generator.py +4 -4
- mindspore/ops_generate/op_def/ops_def_cc_generator.py +0 -3
- mindspore/ops_generate/op_def/ops_name_h_generator.py +0 -3
- mindspore/ops_generate/op_def/ops_primitive_h_generator.py +0 -4
- mindspore/ops_generate/op_def_py/op_prim_py_generator.py +5 -2
- mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +49 -8
- mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +2 -2
- mindspore/ops_generate/pyboost/gen_pyboost_func.py +31 -16
- mindspore/ops_generate/pyboost/op_template_parser.py +98 -72
- mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +70 -273
- mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +14 -6
- mindspore/ops_generate/pyboost/pyboost_functions_impl_cpp_generator.py +316 -0
- mindspore/ops_generate/pyboost/pyboost_functions_py_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +5 -3
- mindspore/ops_generate/pyboost/pyboost_inner_prim_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_internal_functions_cpp_generator.py +76 -0
- mindspore/ops_generate/pyboost/pyboost_internal_functions_h_generator.py +76 -0
- mindspore/ops_generate/pyboost/pyboost_internal_kernel_info_adapter_generator.py +125 -0
- mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +4 -3
- mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +348 -61
- mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_utils.py +118 -9
- mindspore/ops_generate/tensor_py_cc_generator.py +1 -24
- mindspore/parallel/_auto_parallel_context.py +16 -23
- mindspore/parallel/_cell_wrapper.py +113 -45
- mindspore/parallel/_parallel_serialization.py +4 -3
- mindspore/parallel/_ps_context.py +4 -6
- mindspore/parallel/_tensor.py +167 -12
- mindspore/parallel/_transformer/moe.py +1 -1
- mindspore/parallel/_transformer/transformer.py +17 -12
- mindspore/parallel/_utils.py +5 -11
- mindspore/parallel/auto_parallel.py +35 -14
- mindspore/parallel/checkpoint_convert.py +3 -3
- mindspore/parallel/checkpoint_transform.py +13 -7
- mindspore/parallel/cluster/process_entity/_api.py +88 -49
- mindspore/parallel/cluster/process_entity/_utils.py +95 -7
- mindspore/parallel/cluster/run.py +48 -7
- mindspore/parallel/function/__init__.py +8 -1
- mindspore/parallel/function/reshard_func.py +12 -12
- mindspore/parallel/nn/__init__.py +15 -2
- mindspore/parallel/nn/parallel_cell_wrapper.py +50 -14
- mindspore/parallel/nn/parallel_grad_reducer.py +7 -14
- mindspore/parallel/shard.py +10 -25
- mindspore/parallel/transform_safetensors.py +469 -174
- mindspore/pgodb140.dll +0 -0
- mindspore/pgort140.dll +0 -0
- mindspore/profiler/__init__.py +2 -1
- mindspore/profiler/analysis/parser/timeline_assembly_factory/ascend_timeline_assembler.py +7 -7
- mindspore/profiler/analysis/parser/timeline_assembly_factory/base_timeline_assembler.py +3 -0
- mindspore/profiler/analysis/parser/timeline_assembly_factory/trace_view_container.py +12 -6
- mindspore/profiler/analysis/parser/timeline_creator/cpu_op_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_creator/fwk_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_creator/msprof_timeline_creator.py +4 -4
- mindspore/profiler/analysis/parser/timeline_creator/scope_layer_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_event/fwk_event.py +4 -1
- mindspore/profiler/analysis/parser/timeline_event/timeline_event_pool.py +2 -1
- mindspore/profiler/analysis/task_manager.py +1 -1
- mindspore/profiler/analysis/viewer/ascend_communication_viewer.py +5 -1
- mindspore/profiler/analysis/viewer/ascend_integrate_viewer.py +2 -1
- mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +10 -9
- mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +43 -23
- mindspore/profiler/analysis/viewer/ascend_step_trace_time_viewer.py +3 -2
- mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +9 -5
- mindspore/profiler/analysis/viewer/ms_operator_details_viewer.py +132 -0
- mindspore/profiler/common/constant.py +16 -0
- mindspore/profiler/common/msprof_cmd_tool.py +2 -2
- mindspore/profiler/common/path_manager.py +9 -0
- mindspore/profiler/common/profiler_context.py +50 -29
- mindspore/profiler/common/profiler_info.py +0 -16
- mindspore/profiler/common/profiler_meta_data.py +1 -0
- mindspore/profiler/common/profiler_op_analyse.py +239 -0
- mindspore/profiler/common/profiler_output_path.py +23 -8
- mindspore/profiler/common/profiler_parameters.py +128 -35
- mindspore/profiler/dynamic_profile/__init__.py +0 -0
- mindspore/profiler/dynamic_profile/dynamic_monitor_proxy.py +39 -0
- mindspore/profiler/dynamic_profile/dynamic_profiler_config_context.py +666 -0
- mindspore/profiler/dynamic_profile/dynamic_profiler_utils.py +62 -0
- mindspore/profiler/dynamic_profiler.py +374 -338
- mindspore/profiler/envprofiler.py +42 -12
- mindspore/profiler/experimental_config.py +112 -7
- mindspore/profiler/mstx.py +33 -12
- mindspore/profiler/platform/__init__.py +2 -3
- mindspore/profiler/platform/cpu_profiler.py +10 -4
- mindspore/profiler/platform/npu_profiler.py +30 -20
- mindspore/profiler/profiler.py +218 -154
- mindspore/profiler/profiler_action_controller.py +65 -77
- mindspore/profiler/profiler_interface.py +2 -2
- mindspore/profiler/schedule.py +10 -4
- mindspore/rewrite/common/config.py +1 -0
- mindspore/rewrite/common/namer.py +1 -0
- mindspore/rewrite/common/namespace.py +1 -0
- mindspore/rewrite/node/node.py +31 -11
- mindspore/rewrite/parsers/assign_parser.py +1 -1
- mindspore/rewrite/symbol_tree/symbol_tree.py +2 -2
- mindspore/run_check/_check_version.py +7 -10
- mindspore/runtime/__init__.py +8 -6
- mindspore/runtime/event.py +10 -4
- mindspore/runtime/executor.py +87 -45
- mindspore/runtime/memory.py +31 -32
- mindspore/runtime/thread_bind_core.py +299 -165
- mindspore/safeguard/rewrite_obfuscation.py +12 -13
- mindspore/swresample-4.dll +0 -0
- mindspore/swscale-6.dll +0 -0
- mindspore/tbbmalloc.dll +0 -0
- mindspore/tinyxml2.dll +0 -0
- mindspore/train/_utils.py +17 -7
- mindspore/train/amp.py +43 -23
- mindspore/train/callback/__init__.py +5 -5
- mindspore/train/callback/_callback.py +2 -1
- mindspore/train/callback/_checkpoint.py +4 -14
- mindspore/train/callback/_flops_collector.py +11 -7
- mindspore/train/callback/_landscape.py +0 -1
- mindspore/train/callback/_train_fault_tolerance.py +98 -21
- mindspore/train/data_sink.py +15 -6
- mindspore/train/dataset_helper.py +14 -5
- mindspore/train/model.py +133 -69
- mindspore/train/serialization.py +168 -126
- mindspore/train/summary/summary_record.py +13 -2
- mindspore/train/train_thor/model_thor.py +2 -2
- mindspore/turbojpeg.dll +0 -0
- mindspore/utils/__init__.py +3 -2
- mindspore/utils/dryrun.py +0 -6
- mindspore/utils/runtime_execution_order_check.py +163 -77
- mindspore/utils/sdc_detect.py +68 -0
- mindspore/utils/utils.py +14 -17
- mindspore/vcmeta.dll +0 -0
- mindspore/vcruntime140.dll +0 -0
- mindspore/vcruntime140_1.dll +0 -0
- mindspore/version.py +1 -1
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0.dist-info}/METADATA +5 -4
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0.dist-info}/RECORD +403 -442
- mindspore/_deprecated/jit.py +0 -198
- mindspore/_extends/remote/kernel_build_server_ascend.py +0 -75
- mindspore/communication/_hccl_management.py +0 -297
- mindspore/experimental/es/embedding_service.py +0 -891
- mindspore/experimental/es/embedding_service_layer.py +0 -581
- mindspore/profiler/common/validator/__init__.py +0 -14
- mindspore/profiler/common/validator/validate_path.py +0 -84
- mindspore/profiler/parser/__init__.py +0 -14
- mindspore/profiler/parser/aicpu_data_parser.py +0 -272
- mindspore/profiler/parser/ascend_analysis/__init__.py +0 -14
- mindspore/profiler/parser/ascend_analysis/constant.py +0 -71
- mindspore/profiler/parser/ascend_analysis/file_manager.py +0 -180
- mindspore/profiler/parser/ascend_analysis/function_event.py +0 -185
- mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +0 -136
- mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +0 -131
- mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +0 -104
- mindspore/profiler/parser/ascend_analysis/path_manager.py +0 -313
- mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +0 -123
- mindspore/profiler/parser/ascend_analysis/tlv_decoder.py +0 -86
- mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +0 -75
- mindspore/profiler/parser/ascend_cluster_generator.py +0 -116
- mindspore/profiler/parser/ascend_communicate_generator.py +0 -314
- mindspore/profiler/parser/ascend_flops_generator.py +0 -116
- mindspore/profiler/parser/ascend_fpbp_generator.py +0 -82
- mindspore/profiler/parser/ascend_hccl_generator.py +0 -271
- mindspore/profiler/parser/ascend_integrate_generator.py +0 -42
- mindspore/profiler/parser/ascend_memory_generator.py +0 -185
- mindspore/profiler/parser/ascend_msprof_exporter.py +0 -282
- mindspore/profiler/parser/ascend_msprof_generator.py +0 -187
- mindspore/profiler/parser/ascend_op_generator.py +0 -334
- mindspore/profiler/parser/ascend_steptrace_generator.py +0 -94
- mindspore/profiler/parser/ascend_timeline_generator.py +0 -545
- mindspore/profiler/parser/base_timeline_generator.py +0 -483
- mindspore/profiler/parser/container.py +0 -229
- mindspore/profiler/parser/cpu_gpu_timeline_generator.py +0 -697
- mindspore/profiler/parser/flops_parser.py +0 -531
- mindspore/profiler/parser/framework_enum.py +0 -111
- mindspore/profiler/parser/framework_parser.py +0 -464
- mindspore/profiler/parser/framework_struct.py +0 -61
- mindspore/profiler/parser/gpu_analysis/__init__.py +0 -14
- mindspore/profiler/parser/gpu_analysis/function_event.py +0 -44
- mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +0 -89
- mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +0 -72
- mindspore/profiler/parser/hccl_parser.py +0 -573
- mindspore/profiler/parser/hwts_log_parser.py +0 -122
- mindspore/profiler/parser/integrator.py +0 -526
- mindspore/profiler/parser/memory_usage_parser.py +0 -277
- mindspore/profiler/parser/minddata_analyzer.py +0 -800
- mindspore/profiler/parser/minddata_parser.py +0 -186
- mindspore/profiler/parser/minddata_pipeline_parser.py +0 -299
- mindspore/profiler/parser/op_intermediate_parser.py +0 -149
- mindspore/profiler/parser/optime_parser.py +0 -250
- mindspore/profiler/parser/profiler_info.py +0 -213
- mindspore/profiler/parser/step_trace_parser.py +0 -666
- mindspore/utils/hooks.py +0 -81
- /mindspore/common/{_auto_dynamic.py → dynamic_shape/_auto_dynamic.py} +0 -0
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0.dist-info}/WHEEL +0 -0
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0.dist-info}/entry_points.txt +0 -0
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0.dist-info}/top_level.txt +0 -0
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
# Copyright 2020 Huawei Technologies Co., Ltd
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
# ============================================================================
|
|
15
|
-
"""The parser for hwts log file."""
|
|
16
|
-
import os
|
|
17
|
-
import struct
|
|
18
|
-
from mindspore.profiler.common.util import fwrite_format, get_file_join_name
|
|
19
|
-
from mindspore import log as logger
|
|
20
|
-
from mindspore.profiler.common.validator.validate_path import \
|
|
21
|
-
validate_and_normalize_path
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
class HWTSLogParser:
|
|
25
|
-
"""
|
|
26
|
-
The Parser for hwts log files.
|
|
27
|
-
|
|
28
|
-
Args:
|
|
29
|
-
input_path (str): The profiling job path. Such as: '/var/log/npu/profiling/JOBAIFGJEJFEDCBAEADIFJAAAAAAAAAA".
|
|
30
|
-
output_filename (str): The output data path and name. Such as: './output_format_data_hwts_0.txt'.
|
|
31
|
-
"""
|
|
32
|
-
|
|
33
|
-
GRAPH_MODE_MAX_TASKID = 65000
|
|
34
|
-
_source_file_target_old = 'hwts.log.data.45.dev.profiler_default_tag'
|
|
35
|
-
_source_file_target = 'hwts.data.'
|
|
36
|
-
_dst_file_title = 'title:45 HWTS data'
|
|
37
|
-
_dst_file_column_title = 'Type cnt Core_ID Block_ID Task_ID Cycle_counter Stream_ID'
|
|
38
|
-
|
|
39
|
-
def __init__(self, input_path, output_filename, dynamic_status):
|
|
40
|
-
self._input_path = input_path
|
|
41
|
-
self._output_filename = output_filename
|
|
42
|
-
self._source_flie_name = self._get_source_file()
|
|
43
|
-
self._dynamic_status = dynamic_status
|
|
44
|
-
|
|
45
|
-
def execute(self):
|
|
46
|
-
"""
|
|
47
|
-
Execute the parser, get result data, and write it to the output file.
|
|
48
|
-
|
|
49
|
-
Returns:
|
|
50
|
-
bool, whether succeed to analyse hwts log.
|
|
51
|
-
"""
|
|
52
|
-
|
|
53
|
-
content_format = ['QIIIIIIIIIIII', 'QIIQIIIIIIII', 'IIIIQIIIIIIII']
|
|
54
|
-
log_type = ['Start of task', 'End of task', 'Start of block', 'End of block', 'Block PMU']
|
|
55
|
-
result_data = ""
|
|
56
|
-
flip_times = 0
|
|
57
|
-
last_task_stream_map = {}
|
|
58
|
-
task_id_threshold = 65536
|
|
59
|
-
|
|
60
|
-
self._source_flie_name = validate_and_normalize_path(self._source_flie_name)
|
|
61
|
-
with open(self._source_flie_name, 'rb') as hwts_data:
|
|
62
|
-
while True:
|
|
63
|
-
line = hwts_data.read(64)
|
|
64
|
-
if not line:
|
|
65
|
-
break
|
|
66
|
-
if not line.strip():
|
|
67
|
-
continue
|
|
68
|
-
if len(line) < 64:
|
|
69
|
-
logger.error("Length of hwts data is less than 64, it is %s", len(line))
|
|
70
|
-
continue
|
|
71
|
-
byte_first_four = struct.unpack('BBHHH', line[0:8])
|
|
72
|
-
byte_first = bin(byte_first_four[0]).replace('0b', '').zfill(8)
|
|
73
|
-
ms_type, is_warn_res0_ov = byte_first[-3:], byte_first[4]
|
|
74
|
-
cnt, core_id = int(byte_first[0:4], 2), byte_first_four[1]
|
|
75
|
-
blk_id, task_id = byte_first_four[3], int(byte_first_four[4])
|
|
76
|
-
if ms_type in ['000', '001', '010']: # log type 0,1,2
|
|
77
|
-
result = struct.unpack(content_format[0], line[8:])
|
|
78
|
-
syscnt = result[0]
|
|
79
|
-
stream_id = result[1]
|
|
80
|
-
elif ms_type == '011': # log type 3
|
|
81
|
-
result = struct.unpack(content_format[1], line[8:])
|
|
82
|
-
syscnt = result[0]
|
|
83
|
-
stream_id = result[1]
|
|
84
|
-
elif ms_type == '100': # log type 4
|
|
85
|
-
result = struct.unpack(content_format[2], line[8:])
|
|
86
|
-
stream_id = result[2]
|
|
87
|
-
syscnt = None
|
|
88
|
-
if is_warn_res0_ov == '0':
|
|
89
|
-
syscnt = result[4]
|
|
90
|
-
else:
|
|
91
|
-
logger.info("Profiling: invalid hwts log record type %s", ms_type)
|
|
92
|
-
continue
|
|
93
|
-
|
|
94
|
-
if HWTSLogParser.GRAPH_MODE_MAX_TASKID < last_task_stream_map.get(stream_id, task_id) \
|
|
95
|
-
and task_id < last_task_stream_map.get(stream_id, task_id):
|
|
96
|
-
flip_times += 1
|
|
97
|
-
task_id_str = ("%s_%s" % (str(stream_id), str(task_id + flip_times * task_id_threshold)))
|
|
98
|
-
result_data += ("%-14s %-4s %-8s %-9s %-8s %-15s %s\n" % (log_type[int(ms_type, 2)], cnt, core_id,
|
|
99
|
-
blk_id, task_id_str, syscnt, stream_id))
|
|
100
|
-
last_task_stream_map[stream_id] = task_id
|
|
101
|
-
|
|
102
|
-
fwrite_format(self._output_filename, data_source=self._dst_file_title, is_start=True)
|
|
103
|
-
fwrite_format(self._output_filename, data_source=self._dst_file_column_title)
|
|
104
|
-
fwrite_format(self._output_filename, data_source=result_data)
|
|
105
|
-
return True
|
|
106
|
-
|
|
107
|
-
def _get_source_file(self):
|
|
108
|
-
"""Get hwts log file name, which was created by ada service."""
|
|
109
|
-
|
|
110
|
-
file_name = get_file_join_name(self._input_path, self._source_file_target)
|
|
111
|
-
if not file_name:
|
|
112
|
-
file_name = get_file_join_name(self._input_path, self._source_file_target_old)
|
|
113
|
-
if not file_name:
|
|
114
|
-
data_path = os.path.join(self._input_path, "data")
|
|
115
|
-
file_name = get_file_join_name(data_path, self._source_file_target)
|
|
116
|
-
if not file_name:
|
|
117
|
-
file_name = get_file_join_name(data_path, self._source_file_target_old)
|
|
118
|
-
if not file_name:
|
|
119
|
-
msg = "Fail to find hwts log file, under profiling directory"
|
|
120
|
-
raise RuntimeError(msg)
|
|
121
|
-
|
|
122
|
-
return file_name
|
|
@@ -1,526 +0,0 @@
|
|
|
1
|
-
# Copyright 2020-2022 Huawei Technologies Co., Ltd
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
# you may not use this file except in compliance with the License.
|
|
5
|
-
# You may obtain a copy of the License at
|
|
6
|
-
#
|
|
7
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
#
|
|
9
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
# See the License for the specific language governing permissions and
|
|
13
|
-
# limitations under the License.
|
|
14
|
-
# ============================================================================
|
|
15
|
-
"""The integrator for integrating parsed profiling files."""
|
|
16
|
-
import csv
|
|
17
|
-
import json
|
|
18
|
-
import os
|
|
19
|
-
import stat
|
|
20
|
-
from decimal import Decimal
|
|
21
|
-
from enum import Enum
|
|
22
|
-
import sys
|
|
23
|
-
from mindspore import log as logger
|
|
24
|
-
from mindspore.profiler.common.exceptions.exceptions import ProfilerRawFileException
|
|
25
|
-
from mindspore.profiler.common.util import query_latest_trace_time_file, to_int, to_millisecond
|
|
26
|
-
from mindspore.profiler.common.validator.validate_path import validate_and_normalize_path
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class Integrator:
|
|
30
|
-
"""
|
|
31
|
-
The integrator for integrating parsed profiling files.
|
|
32
|
-
|
|
33
|
-
Args:
|
|
34
|
-
profiling_dir (str): The directory where the parsed profiling files are
|
|
35
|
-
located.
|
|
36
|
-
device_id (str): The device ID.
|
|
37
|
-
"""
|
|
38
|
-
_file_name_aicore_detail_time = 'output_op_compute_time_{}.txt'
|
|
39
|
-
_file_name_aicpu_time = 'output_data_preprocess_aicpu_{}.txt'
|
|
40
|
-
_file_name_framework = 'framework_raw_{}.csv'
|
|
41
|
-
_header_aicore_type = ['op_type', 'total_time', 'execution_frequency', 'percent']
|
|
42
|
-
_header_aicore_detail = ['full_op_name', 'execution_time', 'execution_frequency']
|
|
43
|
-
_header_aicpu = [
|
|
44
|
-
'serial_number', 'op_type', 'total_time', 'dispatch_time',
|
|
45
|
-
'execution_time', 'run_start', 'run_end'
|
|
46
|
-
]
|
|
47
|
-
|
|
48
|
-
_file_name_aicore_type_time = 'aicore_intermediate_{}_type.csv'
|
|
49
|
-
_file_name_aicore_detail_info = 'aicore_intermediate_{}_detail.csv'
|
|
50
|
-
_col_names_detail = ['op_name', 'op_type', 'avg_execution_time', 'subgraph', 'full_op_name', 'op_info']
|
|
51
|
-
_none_filter_condition_key = ['is_display_detail', 'is_display_full_op_name']
|
|
52
|
-
_none_sort_col_names = ['op_info']
|
|
53
|
-
_aicore_data = []
|
|
54
|
-
_aicore_detail_data = []
|
|
55
|
-
_aicore_trace_data = []
|
|
56
|
-
|
|
57
|
-
def __init__(self, profiling_dir, device_id):
|
|
58
|
-
csv.field_size_limit(sys.maxsize)
|
|
59
|
-
self._profiling_dir = profiling_dir
|
|
60
|
-
self._device_id = device_id
|
|
61
|
-
self._op_time_cache = {}
|
|
62
|
-
self._total_time = Decimal('0.0')
|
|
63
|
-
self._column = ""
|
|
64
|
-
self._result = []
|
|
65
|
-
|
|
66
|
-
@staticmethod
|
|
67
|
-
def _is_match_condition(exp_key, exp_value, actual_value):
|
|
68
|
-
"""
|
|
69
|
-
Check whether the actual value meets the expect condition.
|
|
70
|
-
|
|
71
|
-
Args:
|
|
72
|
-
exp_key (str): Expect key of the condition.
|
|
73
|
-
exp_value (str): Expect value.
|
|
74
|
-
actual_value (str): Actual value.
|
|
75
|
-
|
|
76
|
-
Returns:
|
|
77
|
-
bool, `True` if the actual meets the expect condition, else `False`.
|
|
78
|
-
"""
|
|
79
|
-
if exp_key == 'in':
|
|
80
|
-
if actual_value not in exp_value:
|
|
81
|
-
return False
|
|
82
|
-
elif exp_key == 'not_in':
|
|
83
|
-
if actual_value in exp_value:
|
|
84
|
-
return False
|
|
85
|
-
elif exp_key == 'partial_match_str_in':
|
|
86
|
-
for partial_match_str in exp_value:
|
|
87
|
-
if partial_match_str in actual_value:
|
|
88
|
-
return True
|
|
89
|
-
return False
|
|
90
|
-
else:
|
|
91
|
-
return False
|
|
92
|
-
|
|
93
|
-
return True
|
|
94
|
-
|
|
95
|
-
def integrate(self):
|
|
96
|
-
"""Integrate the parsed profiling files."""
|
|
97
|
-
self._parse_aicore_detail_time()
|
|
98
|
-
self._parse_aicore_type_time()
|
|
99
|
-
self._parse_aicpu_time()
|
|
100
|
-
|
|
101
|
-
def get_aicore_data(self):
|
|
102
|
-
"""Get ai core data."""
|
|
103
|
-
self._aicore_data_load()
|
|
104
|
-
return self._aicore_data
|
|
105
|
-
|
|
106
|
-
def get_aicore_detail_data(self):
|
|
107
|
-
"""Get ai core detail data."""
|
|
108
|
-
self._aicore_detail_data_load()
|
|
109
|
-
return self._aicore_detail_data
|
|
110
|
-
|
|
111
|
-
def get_aicore_trace_data(self):
|
|
112
|
-
"""Get ai core trace data."""
|
|
113
|
-
self._aicore_trace_data_load()
|
|
114
|
-
return self._aicore_trace_data
|
|
115
|
-
|
|
116
|
-
def query_for_all_reduce(self):
|
|
117
|
-
"""Query all reduce data."""
|
|
118
|
-
return self._query_for_all_reduce()
|
|
119
|
-
|
|
120
|
-
def query_and_sort_by_op_type(self, filter_condition, op_type_order):
|
|
121
|
-
"""Query and sort by op type."""
|
|
122
|
-
return self._query_and_sort_by_op_type(filter_condition, op_type_order)
|
|
123
|
-
|
|
124
|
-
def _parse_aicore_type_time(self):
|
|
125
|
-
"""Parse the parsed AICORE operator type file."""
|
|
126
|
-
if self._total_time == 0:
|
|
127
|
-
logger.info("AICORE data does not exist.")
|
|
128
|
-
return
|
|
129
|
-
|
|
130
|
-
framework_file = os.path.join(
|
|
131
|
-
self._profiling_dir,
|
|
132
|
-
self._file_name_framework.format(self._device_id)
|
|
133
|
-
)
|
|
134
|
-
framework_file = validate_and_normalize_path(framework_file)
|
|
135
|
-
if not os.path.isfile(framework_file):
|
|
136
|
-
return
|
|
137
|
-
|
|
138
|
-
op_name_type_cache = {}
|
|
139
|
-
with open(framework_file, 'r') as src_file:
|
|
140
|
-
csv_reader = csv.reader(src_file)
|
|
141
|
-
_ = next(csv_reader)
|
|
142
|
-
for row in csv_reader:
|
|
143
|
-
op_name_type_cache[row[3]] = row[5]
|
|
144
|
-
|
|
145
|
-
op_type_time_cache = {}
|
|
146
|
-
total_time = 0
|
|
147
|
-
for full_op_name, op_info in self._op_time_cache.items():
|
|
148
|
-
total_time += op_info[0] * op_info[1]
|
|
149
|
-
op_type = op_name_type_cache.get(full_op_name)
|
|
150
|
-
op_type_time = op_type_time_cache.get(op_type)
|
|
151
|
-
if not op_type_time:
|
|
152
|
-
op_type_time = [op_info[0] * op_info[1], op_info[1]]
|
|
153
|
-
op_type_time_cache[op_type] = op_type_time
|
|
154
|
-
else:
|
|
155
|
-
op_type_time[0] += op_info[0] * op_info[1]
|
|
156
|
-
op_type_time[1] += op_info[1]
|
|
157
|
-
op_type_file_name = 'aicore_intermediate_' + self._device_id + '_type.csv'
|
|
158
|
-
op_type_file_path = os.path.join(self._profiling_dir, op_type_file_name)
|
|
159
|
-
with os.fdopen(os.open(op_type_file_path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600), 'w') as type_file:
|
|
160
|
-
csv_writer = csv.writer(type_file)
|
|
161
|
-
csv_writer.writerow(self._header_aicore_type)
|
|
162
|
-
|
|
163
|
-
for op_type, op_type_time_info in op_type_time_cache.items():
|
|
164
|
-
if total_time != 0:
|
|
165
|
-
type_info = [
|
|
166
|
-
op_type, op_type_time_info[0], op_type_time_info[1],
|
|
167
|
-
round((op_type_time_info[0] / total_time) * 100, 2)
|
|
168
|
-
]
|
|
169
|
-
csv_writer.writerow(type_info)
|
|
170
|
-
os.chmod(op_type_file_path, stat.S_IREAD | stat.S_IWRITE)
|
|
171
|
-
|
|
172
|
-
def _parse_aicore_detail_time(self):
|
|
173
|
-
"""Parse the parsed AICORE operator time file."""
|
|
174
|
-
aicore_detail_file = os.path.join(
|
|
175
|
-
self._profiling_dir,
|
|
176
|
-
self._file_name_aicore_detail_time.format(self._device_id)
|
|
177
|
-
)
|
|
178
|
-
aicore_detail_file = validate_and_normalize_path(aicore_detail_file)
|
|
179
|
-
if not os.path.isfile(aicore_detail_file):
|
|
180
|
-
return
|
|
181
|
-
|
|
182
|
-
op_detail_file_name = 'aicore_intermediate_' + self._device_id + '_detail.csv'
|
|
183
|
-
op_detail_file_path = os.path.join(
|
|
184
|
-
self._profiling_dir, op_detail_file_name
|
|
185
|
-
)
|
|
186
|
-
with open(aicore_detail_file, 'r') as src_file:
|
|
187
|
-
row = src_file.readline()
|
|
188
|
-
if row.startswith('op_name'):
|
|
189
|
-
_ = src_file.readline()
|
|
190
|
-
elif row.startswith('====='):
|
|
191
|
-
_ = src_file.readline()
|
|
192
|
-
_ = src_file.readline()
|
|
193
|
-
else:
|
|
194
|
-
return
|
|
195
|
-
with os.fdopen(os.open(op_detail_file_path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600),
|
|
196
|
-
'w') as detail_file:
|
|
197
|
-
csv_writer = csv.writer(detail_file)
|
|
198
|
-
csv_writer.writerow(self._header_aicore_detail)
|
|
199
|
-
|
|
200
|
-
while True:
|
|
201
|
-
row = src_file.readline()
|
|
202
|
-
if not row:
|
|
203
|
-
break
|
|
204
|
-
|
|
205
|
-
op_infos = row.split()
|
|
206
|
-
if op_infos[0] == 'total':
|
|
207
|
-
self._total_time = Decimal(op_infos[2])
|
|
208
|
-
continue
|
|
209
|
-
self._op_time_cache[op_infos[0]] = [Decimal(op_infos[1]), int(op_infos[3])]
|
|
210
|
-
csv_writer.writerow([op_infos[0], op_infos[1], op_infos[3]])
|
|
211
|
-
os.chmod(op_detail_file_path, stat.S_IREAD | stat.S_IWRITE)
|
|
212
|
-
|
|
213
|
-
def _parse_aicpu_time(self):
|
|
214
|
-
"""Parse the parsed AICPU operator time file."""
|
|
215
|
-
aicpu_file = os.path.join(
|
|
216
|
-
self._profiling_dir,
|
|
217
|
-
self._file_name_aicpu_time.format(self._device_id)
|
|
218
|
-
)
|
|
219
|
-
aicpu_file = validate_and_normalize_path(aicpu_file)
|
|
220
|
-
if not os.path.isfile(aicpu_file):
|
|
221
|
-
return
|
|
222
|
-
|
|
223
|
-
save_file_name = 'aicpu_intermediate_' + self._device_id + '.csv'
|
|
224
|
-
save_file_path = os.path.join(self._profiling_dir, save_file_name)
|
|
225
|
-
with open(aicpu_file, 'r') as src_file:
|
|
226
|
-
row = src_file.readline()
|
|
227
|
-
if not row.startswith('serial_number'):
|
|
228
|
-
return
|
|
229
|
-
with os.fdopen(os.open(save_file_path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600), 'w') as save_file:
|
|
230
|
-
csv_writer = csv.writer(save_file)
|
|
231
|
-
csv_writer.writerow(self._header_aicpu)
|
|
232
|
-
|
|
233
|
-
while True:
|
|
234
|
-
row = src_file.readline()
|
|
235
|
-
if not row:
|
|
236
|
-
break
|
|
237
|
-
infos = row.split()
|
|
238
|
-
if infos[0] == 'AI':
|
|
239
|
-
continue
|
|
240
|
-
csv_writer.writerow(infos)
|
|
241
|
-
os.chmod(save_file_path, stat.S_IREAD | stat.S_IWRITE)
|
|
242
|
-
|
|
243
|
-
def _aicore_data_load(self):
|
|
244
|
-
"""Load data according to the parsed AICORE operator types file."""
|
|
245
|
-
op_type_file_path = os.path.join(
|
|
246
|
-
self._profiling_dir,
|
|
247
|
-
self._file_name_aicore_type_time.format(self._device_id)
|
|
248
|
-
)
|
|
249
|
-
op_type_file_path = validate_and_normalize_path(op_type_file_path)
|
|
250
|
-
if not os.path.isfile(op_type_file_path):
|
|
251
|
-
logger.warning('The file <%s> does not exist.', op_type_file_path)
|
|
252
|
-
return
|
|
253
|
-
|
|
254
|
-
with open(op_type_file_path, 'r') as file:
|
|
255
|
-
csv_reader = csv.reader(file)
|
|
256
|
-
_ = next(csv_reader)
|
|
257
|
-
for info in csv_reader:
|
|
258
|
-
self._aicore_data.append([info[0], float(info[1]), int(info[2]), float(info[3])])
|
|
259
|
-
|
|
260
|
-
def _aicore_detail_data_load(self):
|
|
261
|
-
"""Load data according to the parsed AICORE operator file."""
|
|
262
|
-
op_detail_file_path = os.path.join(
|
|
263
|
-
self._profiling_dir,
|
|
264
|
-
self._file_name_aicore_detail_info.format(self._device_id)
|
|
265
|
-
)
|
|
266
|
-
framework_file_path = os.path.join(
|
|
267
|
-
self._profiling_dir,
|
|
268
|
-
self._file_name_framework.format(self._device_id)
|
|
269
|
-
)
|
|
270
|
-
op_detail_file_path = validate_and_normalize_path(op_detail_file_path)
|
|
271
|
-
framework_file_path = validate_and_normalize_path(framework_file_path)
|
|
272
|
-
if not os.path.isfile(op_detail_file_path):
|
|
273
|
-
logger.warning('The file <%s> does not exist.', op_detail_file_path)
|
|
274
|
-
return
|
|
275
|
-
if not os.path.isfile(framework_file_path):
|
|
276
|
-
logger.warning('The file <%s> does not exist.', framework_file_path)
|
|
277
|
-
return
|
|
278
|
-
|
|
279
|
-
framework_infos = dict()
|
|
280
|
-
with open(framework_file_path, 'r') as file:
|
|
281
|
-
csv_reader = csv.reader(file)
|
|
282
|
-
_ = next(csv_reader)
|
|
283
|
-
for info in csv_reader:
|
|
284
|
-
framework_infos[info[3]] = [
|
|
285
|
-
info[3], info[5], info[6], info[7], json.loads(info[8]) if info[8] else None
|
|
286
|
-
]
|
|
287
|
-
|
|
288
|
-
with open(op_detail_file_path, 'r') as file:
|
|
289
|
-
csv_reader = csv.reader(file)
|
|
290
|
-
_ = next(csv_reader)
|
|
291
|
-
for info in csv_reader:
|
|
292
|
-
framework_info = framework_infos.get(info[0])
|
|
293
|
-
if not framework_info:
|
|
294
|
-
continue
|
|
295
|
-
self._aicore_detail_data.append(
|
|
296
|
-
[
|
|
297
|
-
framework_info[1], framework_info[2], float(info[1]),
|
|
298
|
-
framework_info[3], framework_info[0], framework_info[4]
|
|
299
|
-
]
|
|
300
|
-
)
|
|
301
|
-
del framework_infos
|
|
302
|
-
|
|
303
|
-
def _aicore_trace_data_load(self):
|
|
304
|
-
"""Load data according to the parsed AICORE operator types file."""
|
|
305
|
-
file_path = query_latest_trace_time_file(self._profiling_dir, int(self._device_id))
|
|
306
|
-
if not file_path:
|
|
307
|
-
logger.warning("Failed to find parsed trace time file.")
|
|
308
|
-
return
|
|
309
|
-
file_path = validate_and_normalize_path(file_path)
|
|
310
|
-
with open(file_path, 'r') as handle:
|
|
311
|
-
csv_reader = csv.reader(handle)
|
|
312
|
-
self._column = next(csv_reader)
|
|
313
|
-
self._aicore_trace_data = list(csv_reader)
|
|
314
|
-
self._size = len(self._aicore_trace_data) - 1
|
|
315
|
-
self._load_point_info()
|
|
316
|
-
|
|
317
|
-
def _load_point_info(self):
|
|
318
|
-
"""Load point info."""
|
|
319
|
-
file_path = os.path.join(self._profiling_dir, 'step_trace_point_info.json')
|
|
320
|
-
file_path = validate_and_normalize_path(file_path)
|
|
321
|
-
if os.path.isfile(file_path):
|
|
322
|
-
with open(file_path, 'r', encoding='utf-8') as file:
|
|
323
|
-
try:
|
|
324
|
-
self._point_info = json.load(file)
|
|
325
|
-
except (json.JSONDecodeError, TypeError) as err:
|
|
326
|
-
logger.warning(err)
|
|
327
|
-
raise ProfilerRawFileException('Fail to parse point info file.') from err
|
|
328
|
-
|
|
329
|
-
def _query_for_all_reduce(self):
|
|
330
|
-
"""
|
|
331
|
-
Query for all reduce info.
|
|
332
|
-
|
|
333
|
-
Returns:
|
|
334
|
-
list[dict], reduce information. Each item is the reduce info for one step.
|
|
335
|
-
The reduce info is format like:
|
|
336
|
-
{stream_id: List[Tuple(start_point, end_point, duration, field_name)]}.
|
|
337
|
-
"""
|
|
338
|
-
self._aicore_trace_data_load()
|
|
339
|
-
reduce_infos = []
|
|
340
|
-
for row_info in self._aicore_trace_data[:-1]:
|
|
341
|
-
row_info_dict = self._get_info_dict_from_row_data(row_info, 'systime')
|
|
342
|
-
reduce_info = self._sort_reduce_by_time(row_info_dict)
|
|
343
|
-
if reduce_info:
|
|
344
|
-
reduce_infos.extend(reduce_info)
|
|
345
|
-
reduce_infos.sort(key=lambda x: float(x[2]))
|
|
346
|
-
return reduce_infos
|
|
347
|
-
|
|
348
|
-
def _get_info_dict_from_row_data(self, row_info, time_type):
|
|
349
|
-
"""
|
|
350
|
-
Get step info in dict format.
|
|
351
|
-
|
|
352
|
-
Args:
|
|
353
|
-
row_info (list[str]): Step info, the value is corresponding to `__column__`.
|
|
354
|
-
time_type (str): The value type. `systime` keeps the original value.
|
|
355
|
-
`realtime` transforms the value in millisecond. Default: `realtime`.
|
|
356
|
-
|
|
357
|
-
Returns:
|
|
358
|
-
dict, step trace information. The key is in `__column__`.
|
|
359
|
-
"""
|
|
360
|
-
row_info_dict = {}
|
|
361
|
-
for key, value in zip(self._column, row_info):
|
|
362
|
-
if key == 'step_num':
|
|
363
|
-
continue
|
|
364
|
-
value = to_int(value, key)
|
|
365
|
-
row_info_dict[key] = to_millisecond(value) if time_type == 'realtime' else value
|
|
366
|
-
return row_info_dict
|
|
367
|
-
|
|
368
|
-
def _sort_reduce_by_time(self, row_info_dict):
|
|
369
|
-
"""
|
|
370
|
-
Sort reduce info by time.
|
|
371
|
-
|
|
372
|
-
Args:
|
|
373
|
-
row_info_dict (dict): Step trace information.
|
|
374
|
-
|
|
375
|
-
Returns:
|
|
376
|
-
list, including the all reduce info sorted by start time only.
|
|
377
|
-
[
|
|
378
|
-
[reduce_field, stream_id, reduce_start, reduce_duration],
|
|
379
|
-
[...],
|
|
380
|
-
[...]
|
|
381
|
-
]
|
|
382
|
-
"""
|
|
383
|
-
factor = 1e5 # convert time unit from 10ns to 1ms
|
|
384
|
-
reduce_pid = 10000
|
|
385
|
-
reduce_info = []
|
|
386
|
-
reduce_fields = [
|
|
387
|
-
field_name for field_name in self._column
|
|
388
|
-
if field_name.startswith('stream_') and not field_name.endswith('point')
|
|
389
|
-
]
|
|
390
|
-
for reduce_field in reduce_fields:
|
|
391
|
-
reduce_start = row_info_dict.get(reduce_field + '_start_point')
|
|
392
|
-
reduce_start = reduce_start / factor \
|
|
393
|
-
if reduce_start else 0
|
|
394
|
-
reduce_duration = row_info_dict.get(reduce_field)
|
|
395
|
-
reduce_duration = reduce_duration / factor if reduce_duration else 0
|
|
396
|
-
if not (reduce_start and reduce_duration):
|
|
397
|
-
logger.info("Reduce event missing value.")
|
|
398
|
-
continue
|
|
399
|
-
cur_stream_id = reduce_field.split('_', 3)[1]
|
|
400
|
-
if reduce_field.split('_', 2)[1] == 'ops':
|
|
401
|
-
cur_stream_id = reduce_field.split('_', 3)[2]
|
|
402
|
-
reduce_meta = [
|
|
403
|
-
reduce_field, int(cur_stream_id), reduce_start,
|
|
404
|
-
reduce_duration, reduce_pid
|
|
405
|
-
]
|
|
406
|
-
reduce_info.append(reduce_meta)
|
|
407
|
-
|
|
408
|
-
return reduce_info
|
|
409
|
-
|
|
410
|
-
def _query_and_sort_by_op_type(self, filter_condition, op_type_order: list):
|
|
411
|
-
"""
|
|
412
|
-
Query the AICORE operator detail information by `filter_condition`,
|
|
413
|
-
and sort by `op_type_order` and execution time.
|
|
414
|
-
|
|
415
|
-
Args:
|
|
416
|
-
filter_condition (dict): The filter condition.
|
|
417
|
-
op_type_order (list[str]): The name of the operator type in order.
|
|
418
|
-
|
|
419
|
-
Returns:
|
|
420
|
-
dict, The results are filtered and sorted.
|
|
421
|
-
"""
|
|
422
|
-
self._aicore_detail_data_load()
|
|
423
|
-
if filter_condition is None:
|
|
424
|
-
filter_condition = {}
|
|
425
|
-
self._filter(filter_condition)
|
|
426
|
-
|
|
427
|
-
type_detail_cache = {}
|
|
428
|
-
for detail_info in self._result:
|
|
429
|
-
op_type = detail_info[1]
|
|
430
|
-
if op_type not in op_type_order:
|
|
431
|
-
continue
|
|
432
|
-
infos = type_detail_cache.get(op_type)
|
|
433
|
-
if infos:
|
|
434
|
-
infos.append(detail_info)
|
|
435
|
-
else:
|
|
436
|
-
type_detail_cache[op_type] = [detail_info]
|
|
437
|
-
|
|
438
|
-
result = []
|
|
439
|
-
for op_type in op_type_order:
|
|
440
|
-
detail_infos = type_detail_cache.get(op_type)
|
|
441
|
-
if detail_infos is None:
|
|
442
|
-
continue
|
|
443
|
-
detail_infos.sort(key=lambda item: item[2], reverse=True)
|
|
444
|
-
result.extend(detail_infos)
|
|
445
|
-
|
|
446
|
-
return {
|
|
447
|
-
'col_name_detail': self._display_col_names_detail,
|
|
448
|
-
'object': result
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
def _filter(self, filter_condition):
|
|
452
|
-
"""
|
|
453
|
-
Filter the profiling data according to the filter condition.
|
|
454
|
-
|
|
455
|
-
Args:
|
|
456
|
-
filter_condition (dict): The filter condition.
|
|
457
|
-
"""
|
|
458
|
-
|
|
459
|
-
def _inner_filter(item: list):
|
|
460
|
-
return self._default_filter(item, filter_condition)
|
|
461
|
-
|
|
462
|
-
def _inner_map(item: list):
|
|
463
|
-
inner_item = item[0:4]
|
|
464
|
-
if is_display_full_op_name:
|
|
465
|
-
inner_item.append(item[4])
|
|
466
|
-
if is_display_detail:
|
|
467
|
-
inner_item.append(item[5])
|
|
468
|
-
return inner_item
|
|
469
|
-
|
|
470
|
-
is_display_detail = filter_condition.get('is_display_detail', True)
|
|
471
|
-
is_display_full_op_name = filter_condition.get(
|
|
472
|
-
'is_display_full_op_name', True
|
|
473
|
-
)
|
|
474
|
-
self._set_display_col_name(is_display_detail, is_display_full_op_name)
|
|
475
|
-
if is_display_detail and is_display_full_op_name:
|
|
476
|
-
self._result = list(filter(_inner_filter, self._aicore_detail_data))
|
|
477
|
-
else:
|
|
478
|
-
self._result = list(
|
|
479
|
-
map(_inner_map, filter(_inner_filter, self._aicore_detail_data))
|
|
480
|
-
)
|
|
481
|
-
|
|
482
|
-
def _default_filter(self, item, condition):
|
|
483
|
-
"""
|
|
484
|
-
The default filter method.
|
|
485
|
-
|
|
486
|
-
Args:
|
|
487
|
-
item (list[Union[str, float, int]]): A piece of data to be filtered.
|
|
488
|
-
condition (dict): The filter condition.
|
|
489
|
-
|
|
490
|
-
Returns:
|
|
491
|
-
bool, `True` if the item is satisfied.
|
|
492
|
-
"""
|
|
493
|
-
for condition_key, condition_value in condition.items():
|
|
494
|
-
if condition_key in self._none_filter_condition_key:
|
|
495
|
-
continue
|
|
496
|
-
if condition_key in self._col_names_detail:
|
|
497
|
-
index = self._col_names_detail.index(condition_key)
|
|
498
|
-
actual_value = item[index]
|
|
499
|
-
for exp_key, exp_value in condition_value.items():
|
|
500
|
-
if not self._is_match_condition(
|
|
501
|
-
exp_key, exp_value, actual_value):
|
|
502
|
-
return False
|
|
503
|
-
return True
|
|
504
|
-
|
|
505
|
-
def _set_display_col_name(self, is_display_detail, is_display_full_op_name):
|
|
506
|
-
"""
|
|
507
|
-
Set the display column name according to the filter condition.
|
|
508
|
-
|
|
509
|
-
Args:
|
|
510
|
-
is_display_detail (bool): Whether to display the detailed operator
|
|
511
|
-
information.
|
|
512
|
-
is_display_full_op_name (bool): Whether to display the operator full
|
|
513
|
-
name.
|
|
514
|
-
"""
|
|
515
|
-
self._display_col_names_detail = self._col_names_detail[0:4]
|
|
516
|
-
if is_display_full_op_name:
|
|
517
|
-
self._display_col_names_detail.append(self._col_names_detail[4])
|
|
518
|
-
if is_display_detail:
|
|
519
|
-
self._display_col_names_detail.append(self._col_names_detail[5])
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
class DeviceTarget(Enum):
|
|
523
|
-
"""The device target enum."""
|
|
524
|
-
CPU = 'cpu'
|
|
525
|
-
GPU = 'gpu'
|
|
526
|
-
ASCEND = 'ascend'
|