mindspore 2.6.0__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 +64 -83
- mindspore/_extends/parse/resources.py +39 -0
- mindspore/_extends/parse/standard_method.py +47 -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 +177 -52
- mindspore/common/_utils.py +9 -1
- mindspore/common/api.py +338 -208
- 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 +2 -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 +84 -133
- mindspore/communication/_comm_helper.py +46 -4
- mindspore/communication/management.py +79 -7
- mindspore/context.py +47 -38
- 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 +69 -23
- 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 +5 -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 +1 -0
- 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 +4 -44
- mindspore/mint/distributed/__init__.py +5 -0
- mindspore/mint/distributed/distributed.py +425 -19
- 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 +125 -101
- 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 +488 -620
- 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 +86 -85
- 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 +2 -4
- mindspore/nn/optim/adasum.py +2 -2
- 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 +1 -1
- 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 +6 -13
- mindspore/ops/_vmap/vmap_nn_ops.py +8 -16
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +29 -10
- mindspore/ops/auto_generate/gen_extend_func.py +5 -55
- mindspore/ops/auto_generate/gen_ops_def.py +753 -273
- mindspore/ops/auto_generate/gen_ops_prim.py +1687 -958
- 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 +132 -108
- 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 +17 -100
- mindspore/ops/function/debug_func.py +8 -5
- mindspore/ops/function/grad/grad_func.py +5 -13
- mindspore/ops/function/math_func.py +65 -399
- mindspore/ops/function/nn_func.py +44 -61
- mindspore/ops/function/other_func.py +4 -1
- mindspore/ops/function/random_func.py +31 -4
- mindspore/ops/functional.py +2 -3
- mindspore/ops/functional_overload.py +486 -18
- mindspore/ops/op_info_register.py +21 -0
- mindspore/ops/operations/__init__.py +5 -2
- mindspore/ops/operations/_custom_ops_utils.py +675 -8
- mindspore/ops/operations/_inner_ops.py +14 -18
- mindspore/ops/operations/_sequence_ops.py +1 -1
- mindspore/ops/operations/array_ops.py +4 -50
- mindspore/ops/operations/comm_ops.py +186 -41
- mindspore/ops/operations/custom_ops.py +244 -175
- mindspore/ops/operations/debug_ops.py +55 -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 +6 -7
- mindspore/ops/primitive.py +9 -20
- mindspore/ops/tensor_method.py +52 -11
- 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 +7 -2
- 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_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 +9 -17
- mindspore/parallel/_cell_wrapper.py +106 -40
- 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 +33 -12
- mindspore/parallel/checkpoint_convert.py +3 -3
- mindspore/parallel/checkpoint_transform.py +5 -1
- 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 +7 -6
- 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 +9 -23
- mindspore/parallel/transform_safetensors.py +468 -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 +3 -0
- 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 +22 -30
- 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 +9 -5
- 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 +72 -18
- mindspore/train/data_sink.py +15 -6
- mindspore/train/dataset_helper.py +14 -5
- mindspore/train/model.py +49 -47
- 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 +162 -78
- 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.0.dist-info → mindspore-2.7.0.dist-info}/METADATA +5 -4
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/RECORD +400 -439
- 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.0.dist-info → mindspore-2.7.0.dist-info}/WHEEL +0 -0
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/entry_points.txt +0 -0
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/top_level.txt +0 -0
|
@@ -1,186 +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
|
-
"""Minddata aicpu parser."""
|
|
16
|
-
import os
|
|
17
|
-
import glob
|
|
18
|
-
import csv
|
|
19
|
-
|
|
20
|
-
from mindspore.profiler.common.util import get_file_join_name, fwrite_format
|
|
21
|
-
from mindspore import log as logger
|
|
22
|
-
from mindspore.profiler.common.validator.validate_path import \
|
|
23
|
-
validate_and_normalize_path
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class MinddataParser:
|
|
27
|
-
"""Minddata Aicpu Parser."""
|
|
28
|
-
|
|
29
|
-
@staticmethod
|
|
30
|
-
def parse_step_minddata_aicpu_data(one_step, result):
|
|
31
|
-
"""
|
|
32
|
-
Parse step mind_data ai_cpu data.
|
|
33
|
-
|
|
34
|
-
Args:
|
|
35
|
-
one_step (str): The mind_data step info text, it is one of two structures.
|
|
36
|
-
|
|
37
|
-
Type queue: node_name,queue_size,run_start,run_end
|
|
38
|
-
Type run: node_name,run_start,run_end,queue_size
|
|
39
|
-
|
|
40
|
-
result ([[node_name, node_start, node_end, queue_size]]): Step info list.
|
|
41
|
-
"""
|
|
42
|
-
|
|
43
|
-
if not one_step:
|
|
44
|
-
return
|
|
45
|
-
node_info = one_step.split(", ")
|
|
46
|
-
node_name, node_start, node_end, queue_size = "", 0, 0, 0
|
|
47
|
-
if node_info:
|
|
48
|
-
node_name = node_info[0].replace("Node:", "")
|
|
49
|
-
|
|
50
|
-
if len(node_info) > 3:
|
|
51
|
-
if "queue" in node_info[1]:
|
|
52
|
-
queue_size = node_info[1].replace("queue size:", "")
|
|
53
|
-
node_start = node_info[2].replace("Run start:", "")
|
|
54
|
-
node_end = node_info[3].replace("Run end:", "")
|
|
55
|
-
elif "Run" in node_info[1]:
|
|
56
|
-
queue_size = node_info[3].replace("queue size:", "")
|
|
57
|
-
node_start = node_info[1].replace("Run start:", "")
|
|
58
|
-
node_end = node_info[2].replace("Run end:", "")
|
|
59
|
-
queue_size = int(queue_size) if queue_size.isdigit() else queue_size
|
|
60
|
-
node_start = int(node_start) if node_start.isdigit() else node_start
|
|
61
|
-
node_end = int(node_end) if node_end.isdigit() else node_end
|
|
62
|
-
|
|
63
|
-
one_step_list = [node_name, node_start, node_end, queue_size]
|
|
64
|
-
result.append(one_step_list)
|
|
65
|
-
|
|
66
|
-
@staticmethod
|
|
67
|
-
def parse_minddata_aicpu_data(minddata_aicpu_source_path):
|
|
68
|
-
"""
|
|
69
|
-
Parse minddata get_next info which contains queue size and execute time.
|
|
70
|
-
|
|
71
|
-
Args:
|
|
72
|
-
minddata_aicpu_source_path (str): the source file path.
|
|
73
|
-
|
|
74
|
-
Returns:
|
|
75
|
-
list[Union[str, float]], the converted data.
|
|
76
|
-
"""
|
|
77
|
-
result = list()
|
|
78
|
-
try:
|
|
79
|
-
minddata_aicpu_source_path = validate_and_normalize_path(minddata_aicpu_source_path)
|
|
80
|
-
with open(minddata_aicpu_source_path) as source_data_file:
|
|
81
|
-
source_data = source_data_file.read()
|
|
82
|
-
step_data = source_data.split("\x00")
|
|
83
|
-
for one_step in step_data:
|
|
84
|
-
MinddataParser.parse_step_minddata_aicpu_data(one_step, result)
|
|
85
|
-
except OSError:
|
|
86
|
-
logger.error("Open get_next profiling file error.")
|
|
87
|
-
|
|
88
|
-
return result
|
|
89
|
-
|
|
90
|
-
@staticmethod
|
|
91
|
-
def execute(source_path, output_path, job_id, device_id):
|
|
92
|
-
"""
|
|
93
|
-
Execute the parser.
|
|
94
|
-
|
|
95
|
-
Args:
|
|
96
|
-
source_path (str): the source file path, eg: profiler.
|
|
97
|
-
output_path (str): the output file path, eg: profiler.
|
|
98
|
-
job_id (str): the job id, eg: PROF_XXX/device_*
|
|
99
|
-
device_id (str): the device id.
|
|
100
|
-
"""
|
|
101
|
-
if MinddataParser._is_legacy_aicpu_data(source_path, job_id):
|
|
102
|
-
logger.warning("The aicpu data is legacy, which will be deprecated in the future, please update your "
|
|
103
|
-
"CANN and driver version.")
|
|
104
|
-
MinddataParser._execute_legacy(os.path.join(source_path, job_id), output_path, device_id)
|
|
105
|
-
return
|
|
106
|
-
|
|
107
|
-
MinddataParser._execute(source_path, output_path, job_id, device_id)
|
|
108
|
-
|
|
109
|
-
@staticmethod
|
|
110
|
-
def _is_legacy_aicpu_data(source_path, job_id) -> bool:
|
|
111
|
-
"""
|
|
112
|
-
Check whether the aicpu data is legacy.
|
|
113
|
-
|
|
114
|
-
Args:
|
|
115
|
-
source_path (str): the source file path, eg: profiler.
|
|
116
|
-
job_id (str): the job id, eg: PROF_XXX/device_*
|
|
117
|
-
Returns:
|
|
118
|
-
bool, True if the aicpu data is legacy, False otherwise.
|
|
119
|
-
"""
|
|
120
|
-
legacy_files = glob.glob(os.path.join(source_path, job_id, "data", "DATA_PREPROCESS.*"))
|
|
121
|
-
return len(legacy_files) > 0
|
|
122
|
-
|
|
123
|
-
@staticmethod
|
|
124
|
-
def _execute(source_path, output_path, job_id, device_id):
|
|
125
|
-
"""
|
|
126
|
-
Execute the parser when using newest CANN and driver version.
|
|
127
|
-
|
|
128
|
-
Args:
|
|
129
|
-
source_path (str): the source file path, eg: profiler.
|
|
130
|
-
output_path (str): the output file path, eg: profiler.
|
|
131
|
-
job_id (str): the job id, eg: PROF_XXX/device_*
|
|
132
|
-
device_id (str): the device id.
|
|
133
|
-
"""
|
|
134
|
-
minddata_aicpu_data = []
|
|
135
|
-
prof_path = job_id.split("/")[0]
|
|
136
|
-
if not prof_path:
|
|
137
|
-
logger.error("The job_id is invalid: %s", job_id)
|
|
138
|
-
return
|
|
139
|
-
|
|
140
|
-
prof_output_path = os.path.join(source_path, prof_path, "mindstudio_profiler_output")
|
|
141
|
-
aicpu_file = glob.glob(os.path.join(prof_output_path, "aicpu_mi_*.csv"))
|
|
142
|
-
if not aicpu_file:
|
|
143
|
-
return
|
|
144
|
-
|
|
145
|
-
# aicpu_file len is 1
|
|
146
|
-
for file_path in aicpu_file:
|
|
147
|
-
file_path = validate_and_normalize_path(file_path)
|
|
148
|
-
with open(file_path, "r", newline='') as f:
|
|
149
|
-
reader = csv.reader(f)
|
|
150
|
-
minddata_aicpu_data = [[line[1], line[2][:-2], line[3][:-2], line[4]] for line in reader]
|
|
151
|
-
|
|
152
|
-
if minddata_aicpu_data:
|
|
153
|
-
minddata_aicpu_output_path = os.path.join(output_path, "minddata_aicpu_" + str(device_id) + ".txt")
|
|
154
|
-
fwrite_format(minddata_aicpu_output_path, minddata_aicpu_data[1:], is_start=True)
|
|
155
|
-
logger.info("Minddata aicpu data has been saved to %s", minddata_aicpu_output_path)
|
|
156
|
-
|
|
157
|
-
@staticmethod
|
|
158
|
-
def _execute_legacy(source_path, output_path, device_id):
|
|
159
|
-
"""
|
|
160
|
-
Execute the parser when using legacy CANN and driver version.
|
|
161
|
-
|
|
162
|
-
Args:
|
|
163
|
-
source_path (str): the source file path, eg: profiler/PROF_XXX/device_*.
|
|
164
|
-
output_path (str): the output file path, eg: profiler.
|
|
165
|
-
device_id (str): the device id.
|
|
166
|
-
"""
|
|
167
|
-
col_names = ["node_name", "start_time", "end_time", "queue_size"]
|
|
168
|
-
source_path = validate_and_normalize_path(source_path)
|
|
169
|
-
minddata_aicpu_source_path = get_file_join_name(
|
|
170
|
-
input_path=source_path, file_name='DATA_PREPROCESS.AICPUMI')
|
|
171
|
-
if not minddata_aicpu_source_path:
|
|
172
|
-
minddata_aicpu_source_path = get_file_join_name(
|
|
173
|
-
input_path=source_path, file_name='DATA_PREPROCESS.dev.AICPUMI')
|
|
174
|
-
if not minddata_aicpu_source_path:
|
|
175
|
-
minddata_aicpu_source_path = get_file_join_name(
|
|
176
|
-
input_path=os.path.join(source_path, "data"), file_name='DATA_PREPROCESS.AICPUMI')
|
|
177
|
-
if not minddata_aicpu_source_path:
|
|
178
|
-
minddata_aicpu_source_path = get_file_join_name(
|
|
179
|
-
input_path=os.path.join(source_path, "data"), file_name='DATA_PREPROCESS.dev.AICPUMI')
|
|
180
|
-
if not minddata_aicpu_source_path:
|
|
181
|
-
return
|
|
182
|
-
minddata_aicpu_output_path = os.path.join(output_path, "minddata_aicpu_" + str(device_id) + ".txt")
|
|
183
|
-
minddata_aicpu_data = MinddataParser.parse_minddata_aicpu_data(minddata_aicpu_source_path)
|
|
184
|
-
if minddata_aicpu_data:
|
|
185
|
-
fwrite_format(minddata_aicpu_output_path, " ".join(col_names), is_start=True)
|
|
186
|
-
fwrite_format(minddata_aicpu_output_path, minddata_aicpu_data, is_start=True)
|
|
@@ -1,299 +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
|
-
"""Thr parser for parsing minddata pipeline files."""
|
|
16
|
-
import csv
|
|
17
|
-
import json
|
|
18
|
-
import os
|
|
19
|
-
import stat
|
|
20
|
-
from queue import Queue
|
|
21
|
-
|
|
22
|
-
from mindspore.profiler.common.exceptions.exceptions import \
|
|
23
|
-
ProfilerPathErrorException, ProfilerRawFileException, \
|
|
24
|
-
ProfilerDirNotFoundException
|
|
25
|
-
from mindspore import log as logger
|
|
26
|
-
from mindspore.profiler.common.validator.validate_path import \
|
|
27
|
-
validate_and_normalize_path
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class MinddataPipelineParser:
|
|
31
|
-
"""
|
|
32
|
-
Thr parser for parsing minddata pipeline files.
|
|
33
|
-
|
|
34
|
-
Args:
|
|
35
|
-
source_dir (str): The minddata pipeline source dir.
|
|
36
|
-
device_id (str): The device ID.
|
|
37
|
-
output_path (str): The directory of the parsed file. Default: `./`.
|
|
38
|
-
|
|
39
|
-
Raises:
|
|
40
|
-
ProfilerPathErrorException: If the minddata pipeline file path or
|
|
41
|
-
the output path is invalid.
|
|
42
|
-
"""
|
|
43
|
-
_raw_pipeline_file_name = 'pipeline_profiling_{}.json'
|
|
44
|
-
_parsed_pipeline_file_name = 'minddata_pipeline_raw_{}.csv'
|
|
45
|
-
_col_names = [
|
|
46
|
-
'op_id', 'op_type', 'num_workers', 'output_queue_size',
|
|
47
|
-
'output_queue_average_size', 'output_queue_length',
|
|
48
|
-
'output_queue_usage_rate', 'sample_interval', 'parent_id', 'children_id'
|
|
49
|
-
]
|
|
50
|
-
|
|
51
|
-
def __init__(self, source_dir, device_id, output_path='./'):
|
|
52
|
-
self._device_id = device_id
|
|
53
|
-
self._pipeline_path = self._get_pipeline_path(source_dir)
|
|
54
|
-
self._save_path = self._get_save_path(output_path)
|
|
55
|
-
|
|
56
|
-
@property
|
|
57
|
-
def save_path(self):
|
|
58
|
-
"""
|
|
59
|
-
The property of save path.
|
|
60
|
-
|
|
61
|
-
Returns:
|
|
62
|
-
str, the save path.
|
|
63
|
-
"""
|
|
64
|
-
return self._save_path
|
|
65
|
-
|
|
66
|
-
def parse(self):
|
|
67
|
-
"""
|
|
68
|
-
Parse the minddata pipeline files.
|
|
69
|
-
|
|
70
|
-
Raises:
|
|
71
|
-
ProfilerRawFileException: If fails to parse the raw file of
|
|
72
|
-
minddata pipeline or the file is empty.
|
|
73
|
-
"""
|
|
74
|
-
if not self._pipeline_path:
|
|
75
|
-
return
|
|
76
|
-
with open(self._pipeline_path, 'r') as file:
|
|
77
|
-
try:
|
|
78
|
-
pipeline_info = json.load(file)
|
|
79
|
-
except (json.JSONDecodeError, TypeError) as err:
|
|
80
|
-
logger.warning(err)
|
|
81
|
-
raise ProfilerRawFileException(
|
|
82
|
-
'Fail to parse minddata pipeline file.'
|
|
83
|
-
) from err
|
|
84
|
-
if not pipeline_info:
|
|
85
|
-
logger.warning('The minddata pipeline file is empty.')
|
|
86
|
-
raise ProfilerRawFileException(
|
|
87
|
-
'The minddata pipeline file is empty.'
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
self._parse_and_save(pipeline_info)
|
|
91
|
-
|
|
92
|
-
def _get_pipeline_path(self, source_dir):
|
|
93
|
-
"""
|
|
94
|
-
Get the minddata pipeline file path.
|
|
95
|
-
|
|
96
|
-
Args:
|
|
97
|
-
source_dir (str): The minddata pipeline source dir.
|
|
98
|
-
|
|
99
|
-
Returns:
|
|
100
|
-
str, the minddata pipeline file path.
|
|
101
|
-
"""
|
|
102
|
-
pipeline_path = os.path.join(
|
|
103
|
-
source_dir,
|
|
104
|
-
self._raw_pipeline_file_name.format(self._device_id)
|
|
105
|
-
)
|
|
106
|
-
|
|
107
|
-
try:
|
|
108
|
-
pipeline_path = validate_and_normalize_path(pipeline_path)
|
|
109
|
-
except RuntimeError as err:
|
|
110
|
-
logger.warning('Minddata pipeline file is invalid.')
|
|
111
|
-
raise ProfilerPathErrorException('Minddata pipeline file is invalid.') from err
|
|
112
|
-
if not os.path.isfile(pipeline_path):
|
|
113
|
-
logger.warning(
|
|
114
|
-
'The minddata pipeline file <%s> not found.', pipeline_path
|
|
115
|
-
)
|
|
116
|
-
pipeline_path = ""
|
|
117
|
-
|
|
118
|
-
return pipeline_path
|
|
119
|
-
|
|
120
|
-
def _get_save_path(self, output_path):
|
|
121
|
-
"""
|
|
122
|
-
Get the save path.
|
|
123
|
-
|
|
124
|
-
Args:
|
|
125
|
-
output_path (str): The output dir.
|
|
126
|
-
|
|
127
|
-
Returns:
|
|
128
|
-
str, the save path.
|
|
129
|
-
"""
|
|
130
|
-
try:
|
|
131
|
-
output_dir = validate_and_normalize_path(output_path)
|
|
132
|
-
except RuntimeError as err:
|
|
133
|
-
logger.warning('Output path is invalid.')
|
|
134
|
-
raise ProfilerPathErrorException('Output path is invalid.') from err
|
|
135
|
-
if not os.path.isdir(output_dir):
|
|
136
|
-
logger.warning('The output dir <%s> not found.', output_dir)
|
|
137
|
-
raise ProfilerDirNotFoundException(output_dir)
|
|
138
|
-
return os.path.join(
|
|
139
|
-
output_dir, self._parsed_pipeline_file_name.format(self._device_id)
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
def _parse_and_save(self, pipeline_info):
|
|
143
|
-
"""
|
|
144
|
-
Parse and save the parsed minddata pipeline file.
|
|
145
|
-
|
|
146
|
-
Args:
|
|
147
|
-
pipeline_info (dict): The pipeline info reads from the raw file of
|
|
148
|
-
the minddata pipeline.
|
|
149
|
-
|
|
150
|
-
Raises:
|
|
151
|
-
ProfilerRawFileException: If the format of minddata pipeline raw
|
|
152
|
-
file is wrong.
|
|
153
|
-
"""
|
|
154
|
-
sample_interval = pipeline_info.get('sampling_interval')
|
|
155
|
-
op_info = pipeline_info.get('op_info')
|
|
156
|
-
if sample_interval is None or not op_info:
|
|
157
|
-
raise ProfilerRawFileException(
|
|
158
|
-
'The format of minddata pipeline raw file is wrong.'
|
|
159
|
-
)
|
|
160
|
-
|
|
161
|
-
op_id_info_cache = {}
|
|
162
|
-
for item in op_info:
|
|
163
|
-
if not item:
|
|
164
|
-
raise ProfilerRawFileException(
|
|
165
|
-
'The content of minddata pipeline raw file is wrong.'
|
|
166
|
-
)
|
|
167
|
-
op_id_info_cache[item.get('op_id')] = item
|
|
168
|
-
|
|
169
|
-
with os.fdopen(os.open(self._save_path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600), 'w') as save_file:
|
|
170
|
-
csv_writer = csv.writer(save_file)
|
|
171
|
-
csv_writer.writerow(self._col_names)
|
|
172
|
-
self._parse_and_save_op_info(
|
|
173
|
-
csv_writer, op_id_info_cache, sample_interval
|
|
174
|
-
)
|
|
175
|
-
os.chmod(self._save_path, stat.S_IREAD | stat.S_IWRITE)
|
|
176
|
-
|
|
177
|
-
def _parse_and_save_op_info(self, csv_writer, op_id_info_cache,
|
|
178
|
-
sample_interval):
|
|
179
|
-
"""
|
|
180
|
-
Parse and save the minddata pipeline operator information.
|
|
181
|
-
|
|
182
|
-
Args:
|
|
183
|
-
csv_writer (csv.writer): The csv writer.
|
|
184
|
-
op_id_info_cache (dict): The operator id and information cache.
|
|
185
|
-
sample_interval (int): The sample interval.
|
|
186
|
-
|
|
187
|
-
Raises:
|
|
188
|
-
ProfilerRawFileException: If the operator that id is 0 does not exist.
|
|
189
|
-
"""
|
|
190
|
-
queue = Queue()
|
|
191
|
-
root_node = op_id_info_cache.get(0)
|
|
192
|
-
if not root_node:
|
|
193
|
-
raise ProfilerRawFileException(
|
|
194
|
-
'The format of minddata pipeline raw file is wrong, '
|
|
195
|
-
'the operator that id is 0 does not exist.'
|
|
196
|
-
)
|
|
197
|
-
root_node['parent_id'] = None
|
|
198
|
-
queue.put_nowait(root_node)
|
|
199
|
-
|
|
200
|
-
while not queue.empty():
|
|
201
|
-
node = queue.get_nowait()
|
|
202
|
-
self._update_child_node(node, op_id_info_cache)
|
|
203
|
-
csv_writer.writerow(self._get_op_info(node, sample_interval))
|
|
204
|
-
|
|
205
|
-
op_id = node.get('op_id')
|
|
206
|
-
children_ids = node.get('children')
|
|
207
|
-
if not children_ids:
|
|
208
|
-
continue
|
|
209
|
-
for child_op_id in children_ids:
|
|
210
|
-
sub_node = op_id_info_cache.get(child_op_id)
|
|
211
|
-
sub_node['parent_id'] = op_id
|
|
212
|
-
queue.put_nowait(sub_node)
|
|
213
|
-
|
|
214
|
-
def _update_child_node(self, node, op_id_info_cache):
|
|
215
|
-
"""
|
|
216
|
-
Updates the child node information of the operator.
|
|
217
|
-
|
|
218
|
-
Args:
|
|
219
|
-
node (dict): The node represents an operator.
|
|
220
|
-
op_id_info_cache (dict): The operator id and information cache.
|
|
221
|
-
"""
|
|
222
|
-
child_op_ids = node.get('children')
|
|
223
|
-
if not child_op_ids:
|
|
224
|
-
return
|
|
225
|
-
|
|
226
|
-
queue = Queue()
|
|
227
|
-
self._cp_list_item_to_queue(child_op_ids, queue)
|
|
228
|
-
|
|
229
|
-
new_child_op_ids = []
|
|
230
|
-
while not queue.empty():
|
|
231
|
-
child_op_id = queue.get_nowait()
|
|
232
|
-
child_node = op_id_info_cache.get(child_op_id)
|
|
233
|
-
if child_node is None:
|
|
234
|
-
continue
|
|
235
|
-
metrics = child_node.get('metrics')
|
|
236
|
-
if not metrics or not metrics.get('output_queue'):
|
|
237
|
-
op_ids = child_node.get('children')
|
|
238
|
-
if op_ids:
|
|
239
|
-
self._cp_list_item_to_queue(op_ids, queue)
|
|
240
|
-
else:
|
|
241
|
-
new_child_op_ids.append(child_op_id)
|
|
242
|
-
|
|
243
|
-
node['children'] = new_child_op_ids
|
|
244
|
-
|
|
245
|
-
def _get_op_info(self, op_node, sample_interval):
|
|
246
|
-
"""
|
|
247
|
-
Get the operator information.
|
|
248
|
-
|
|
249
|
-
Args:
|
|
250
|
-
op_node (dict): The node represents an operator.
|
|
251
|
-
sample_interval (int): The sample interval.
|
|
252
|
-
|
|
253
|
-
Returns:
|
|
254
|
-
list[str, int, float], the operator information.
|
|
255
|
-
"""
|
|
256
|
-
queue_size = None
|
|
257
|
-
queue_average_size = None
|
|
258
|
-
queue_length = None
|
|
259
|
-
queue_usage_rate = None
|
|
260
|
-
metrics = op_node.get('metrics')
|
|
261
|
-
if metrics:
|
|
262
|
-
output_queue = metrics.get('output_queue')
|
|
263
|
-
if output_queue:
|
|
264
|
-
queue_size = output_queue.get('size')
|
|
265
|
-
if queue_size is None:
|
|
266
|
-
raise ValueError("The queue can not be None.")
|
|
267
|
-
if queue_size:
|
|
268
|
-
queue_average_size = sum(queue_size) / len(queue_size)
|
|
269
|
-
queue_length = output_queue.get('length')
|
|
270
|
-
if queue_length == 0:
|
|
271
|
-
raise ValueError("The length of queue can not be 0.")
|
|
272
|
-
if queue_average_size is not None:
|
|
273
|
-
queue_usage_rate = queue_average_size / queue_length
|
|
274
|
-
|
|
275
|
-
children_id = op_node.get('children')
|
|
276
|
-
op_info = [
|
|
277
|
-
op_node.get('op_id'),
|
|
278
|
-
op_node.get('op_type'),
|
|
279
|
-
op_node.get('num_workers'),
|
|
280
|
-
queue_size,
|
|
281
|
-
queue_average_size,
|
|
282
|
-
queue_length,
|
|
283
|
-
queue_usage_rate,
|
|
284
|
-
sample_interval,
|
|
285
|
-
op_node.get('parent_id'),
|
|
286
|
-
children_id if children_id else None
|
|
287
|
-
]
|
|
288
|
-
return op_info
|
|
289
|
-
|
|
290
|
-
def _cp_list_item_to_queue(self, inner_list, queue):
|
|
291
|
-
"""
|
|
292
|
-
Copy the contents of a list to a queue.
|
|
293
|
-
|
|
294
|
-
Args:
|
|
295
|
-
inner_list (list): The list.
|
|
296
|
-
queue (Queue): The target queue.
|
|
297
|
-
"""
|
|
298
|
-
for item in inner_list:
|
|
299
|
-
queue.put_nowait(item)
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
# Copyright 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
|
-
"""Op intermediate files parser."""
|
|
16
|
-
import csv
|
|
17
|
-
import os
|
|
18
|
-
import stat
|
|
19
|
-
from mindspore.profiler.common.exceptions.exceptions import ProfilerFileNotFoundException, \
|
|
20
|
-
ProfilerIOException
|
|
21
|
-
from mindspore import log as logger
|
|
22
|
-
from mindspore.profiler.common.validator.validate_path import validate_and_normalize_path
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class OPIntermediateParser:
|
|
26
|
-
"""
|
|
27
|
-
Op intermediate files parser.
|
|
28
|
-
|
|
29
|
-
Args:
|
|
30
|
-
profiling_dir (str): The directory where the parsed profiling files are
|
|
31
|
-
located.
|
|
32
|
-
rank_id (str): The rank ID.
|
|
33
|
-
"""
|
|
34
|
-
|
|
35
|
-
_output_timeline_data_file_path = 'output_timeline_data_{}.txt'
|
|
36
|
-
_file_name_op_intermediate_type = 'pynative_op_intermediate_{}_type.csv'
|
|
37
|
-
_file_name_op_intermediate_detail = 'pynative_op_intermediate_{}_detail.csv'
|
|
38
|
-
|
|
39
|
-
_op_intermediate_type_header = ['op_type', 'execution_time', 'execution_frequency', 'percent']
|
|
40
|
-
_op_intermediate_op_header = ['full_op_name', 'execution_time']
|
|
41
|
-
|
|
42
|
-
_ms_decimal_digits = 6
|
|
43
|
-
_percent_decimal_digits = 2
|
|
44
|
-
|
|
45
|
-
def __init__(self, profiling_dir, rank_id):
|
|
46
|
-
self._profiling_dir = profiling_dir
|
|
47
|
-
self._rank_id = rank_id
|
|
48
|
-
|
|
49
|
-
def get_timeline_data(self, all_reduce_names=None):
|
|
50
|
-
"""
|
|
51
|
-
Load timeline data from file.
|
|
52
|
-
|
|
53
|
-
Args:
|
|
54
|
-
all_reduce_names (list): The communication operator list.
|
|
55
|
-
"""
|
|
56
|
-
all_reduce_names = all_reduce_names or []
|
|
57
|
-
file_path = os.path.join(
|
|
58
|
-
self._profiling_dir,
|
|
59
|
-
self._output_timeline_data_file_path.format(self._rank_id)
|
|
60
|
-
)
|
|
61
|
-
file_path = validate_and_normalize_path(file_path)
|
|
62
|
-
if not os.path.exists(file_path):
|
|
63
|
-
logger.critical("Failed to find parsed timeline file.")
|
|
64
|
-
raise ProfilerFileNotFoundException('parsed timeline file')
|
|
65
|
-
|
|
66
|
-
timeline_list = []
|
|
67
|
-
try:
|
|
68
|
-
with open(file_path, 'r') as f_obj:
|
|
69
|
-
for line in f_obj:
|
|
70
|
-
# line: op_name, stream_id, start_time(ms), duration(ms)
|
|
71
|
-
line_list = line.strip('\n').split(',')
|
|
72
|
-
# filter out communication operators
|
|
73
|
-
if line_list[0] == 'op_name' or line_list[0] in all_reduce_names:
|
|
74
|
-
continue
|
|
75
|
-
timeline_list.append(line_list)
|
|
76
|
-
except (IOError, OSError) as err:
|
|
77
|
-
logger.critical('Error occurred when read timeline intermediate file: %s', err)
|
|
78
|
-
raise ProfilerIOException() from err
|
|
79
|
-
finally:
|
|
80
|
-
pass
|
|
81
|
-
|
|
82
|
-
return timeline_list
|
|
83
|
-
|
|
84
|
-
def parser_pynative_op_intermediate_detail(self):
|
|
85
|
-
"""Parse pynative op intermediate detail."""
|
|
86
|
-
timeline_list = self.get_timeline_data(None)
|
|
87
|
-
# key:op name, value:[op count, total op execution time]
|
|
88
|
-
op_intermediate_detail = {}
|
|
89
|
-
for timeline in timeline_list:
|
|
90
|
-
op_name = timeline[0].split('/')[-1]
|
|
91
|
-
|
|
92
|
-
detail = op_intermediate_detail.get(op_name)
|
|
93
|
-
if not detail:
|
|
94
|
-
detail = [0, 0]
|
|
95
|
-
op_intermediate_detail[op_name] = detail
|
|
96
|
-
detail[0] = detail[0] + 1
|
|
97
|
-
detail[1] = detail[1] + float(timeline[3])
|
|
98
|
-
|
|
99
|
-
op_op_file_path = os.path.join(self._profiling_dir,
|
|
100
|
-
self._file_name_op_intermediate_detail.format(self._rank_id))
|
|
101
|
-
with os.fdopen(os.open(op_op_file_path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600), 'w') as op_file:
|
|
102
|
-
csv_writer = csv.writer(op_file)
|
|
103
|
-
csv_writer.writerow(self._op_intermediate_op_header)
|
|
104
|
-
|
|
105
|
-
for op_name, op_name_time_info in op_intermediate_detail.items():
|
|
106
|
-
op_info = [
|
|
107
|
-
op_name, round(op_name_time_info[1] / op_name_time_info[0], self._ms_decimal_digits)
|
|
108
|
-
]
|
|
109
|
-
csv_writer.writerow(op_info)
|
|
110
|
-
os.chmod(op_op_file_path, stat.S_IREAD | stat.S_IWRITE)
|
|
111
|
-
|
|
112
|
-
def parser_pynative_op_type(self):
|
|
113
|
-
"""Parse pynative op intermediate type."""
|
|
114
|
-
timeline_list = self.get_timeline_data(None)
|
|
115
|
-
# key:op type, value:[op count, total op execution time, op execution time percent]
|
|
116
|
-
op_type_list = {}
|
|
117
|
-
for timeline in timeline_list:
|
|
118
|
-
type_name = timeline[0].split('/')[-1].split('-')[0]
|
|
119
|
-
op_type = op_type_list.get(type_name)
|
|
120
|
-
if not op_type:
|
|
121
|
-
op_type = [0, 0, 0]
|
|
122
|
-
op_type_list[type_name] = op_type
|
|
123
|
-
op_type[0] = op_type[0] + 1
|
|
124
|
-
op_type[1] = op_type[1] + float(timeline[3])
|
|
125
|
-
|
|
126
|
-
sum_avg_time = 0
|
|
127
|
-
for _, op_type in op_type_list.items():
|
|
128
|
-
op_type[1] = op_type[1] / op_type[0]
|
|
129
|
-
sum_avg_time = sum_avg_time + op_type[1]
|
|
130
|
-
|
|
131
|
-
if sum_avg_time <= 0:
|
|
132
|
-
logger.error("Operator time must be greater than 0.")
|
|
133
|
-
return
|
|
134
|
-
for _, op_type in op_type_list.items():
|
|
135
|
-
op_type[2] = op_type[1] / sum_avg_time
|
|
136
|
-
|
|
137
|
-
op_type_file_path = os.path.join(self._profiling_dir,
|
|
138
|
-
self._file_name_op_intermediate_type.format(self._rank_id))
|
|
139
|
-
with os.fdopen(os.open(op_type_file_path, os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600), 'w') as type_file:
|
|
140
|
-
csv_writer = csv.writer(type_file)
|
|
141
|
-
csv_writer.writerow(self._op_intermediate_type_header)
|
|
142
|
-
|
|
143
|
-
for op_type, op_type_time_info in op_type_list.items():
|
|
144
|
-
type_info = [
|
|
145
|
-
op_type, op_type_time_info[1], op_type_time_info[0],
|
|
146
|
-
round((op_type_time_info[1] / sum_avg_time) * 100, self._percent_decimal_digits)
|
|
147
|
-
]
|
|
148
|
-
csv_writer.writerow(type_info)
|
|
149
|
-
os.chmod(op_type_file_path, stat.S_IREAD | stat.S_IWRITE)
|