mindspore 2.6.0__cp311-cp311-win_amd64.whl → 2.7.0rc1__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 +1 -1
- 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 +40 -9
- mindspore/{_deprecated → _extends/optimize}/__init__.py +9 -3
- mindspore/_extends/optimize/cell_utils.py +96 -0
- mindspore/_extends/parse/__init__.py +2 -2
- mindspore/_extends/parse/compile_config.py +44 -22
- mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +1 -1
- mindspore/_extends/parse/parser.py +36 -61
- mindspore/_extends/parse/resources.py +39 -0
- mindspore/_extends/parse/standard_method.py +32 -13
- mindspore/_extends/parse/trope.py +8 -1
- mindspore/_extends/pijit/__init__.py +1 -2
- mindspore/amp.py +4 -4
- 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 +27 -2
- 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 +76 -15
- mindspore/common/api.py +193 -112
- mindspore/common/dtype.py +21 -11
- mindspore/common/dump.py +10 -15
- mindspore/common/generator.py +2 -3
- mindspore/common/hook_handle.py +11 -2
- mindspore/common/jit_config.py +1 -1
- mindspore/common/jit_trace.py +84 -105
- mindspore/common/parameter.py +26 -12
- mindspore/common/recompute.py +3 -3
- mindspore/common/sparse_tensor.py +0 -3
- mindspore/common/symbol.py +0 -1
- mindspore/common/tensor.py +48 -83
- mindspore/communication/_comm_helper.py +46 -4
- mindspore/communication/management.py +79 -7
- mindspore/context.py +38 -23
- mindspore/dataset/core/config.py +3 -3
- mindspore/dataset/engine/datasets.py +20 -7
- mindspore/dataset/engine/datasets_user_defined.py +32 -2
- 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/py_transforms.py +7 -3
- mindspore/dataset/transforms/transforms.py +7 -3
- mindspore/dataset/vision/validators.py +1 -0
- mindspore/device_context/ascend/device.py +1 -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 -5
- 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 +37 -1
- mindspore/include/api/delegate.h +10 -0
- mindspore/include/api/model.h +3 -0
- mindspore/include/api/types.h +2 -2
- mindspore/include/c_api/model_c.h +0 -58
- mindspore/include/c_api/tensor_c.h +0 -26
- mindspore/include/dataset/vision_ascend.h +1 -1
- mindspore/jpeg62.dll +0 -0
- mindspore/mindrecord/tools/cifar10.py +60 -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 +1 -0
- mindspore/mint/distributed/distributed.py +208 -5
- mindspore/mint/nn/__init__.py +1 -1
- mindspore/mint/nn/functional.py +53 -6
- mindspore/mint/nn/layer/_functions.py +164 -294
- mindspore/mint/nn/layer/activation.py +8 -6
- mindspore/mint/nn/layer/conv.py +122 -98
- mindspore/mint/nn/layer/normalization.py +8 -22
- 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 +325 -499
- mindspore/nn/grad/cell_grad.py +11 -12
- mindspore/nn/layer/activation.py +32 -34
- mindspore/nn/layer/basic.py +67 -64
- 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 +37 -39
- 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 +1 -1
- mindspore/nn/optim/adasum.py +2 -2
- mindspore/nn/optim/optimizer.py +1 -1
- mindspore/nn/optim/thor.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 +34 -37
- mindspore/nn/wrap/grad_reducer.py +37 -37
- mindspore/nn/wrap/loss_scale.py +72 -74
- mindspore/numpy/array_creations.py +5 -5
- mindspore/numpy/fft.py +1 -1
- mindspore/numpy/math_ops.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/_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 +17 -8
- mindspore/ops/auto_generate/gen_extend_func.py +1 -51
- mindspore/ops/auto_generate/gen_ops_def.py +463 -257
- mindspore/ops/auto_generate/gen_ops_prim.py +1127 -885
- mindspore/ops/auto_generate/pyboost_inner_prim.py +31 -1
- mindspore/ops/composite/__init__.py +10 -0
- mindspore/ops/composite/base.py +8 -4
- mindspore/ops/composite/multitype_ops/__init__.py +12 -1
- mindspore/ops/composite/multitype_ops/_compile_utils.py +132 -108
- 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 +3 -1
- mindspore/ops/function/_add_attr_func.py +11 -6
- mindspore/ops/function/array_func.py +7 -94
- mindspore/ops/function/debug_func.py +4 -3
- mindspore/ops/function/grad/grad_func.py +1 -1
- mindspore/ops/function/math_func.py +21 -367
- mindspore/ops/function/nn_func.py +26 -41
- mindspore/ops/function/other_func.py +4 -1
- mindspore/ops/function/random_func.py +31 -4
- mindspore/ops/functional.py +0 -2
- mindspore/ops/functional_overload.py +463 -6
- 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 +3 -6
- mindspore/ops/operations/_sequence_ops.py +1 -1
- mindspore/ops/operations/comm_ops.py +185 -26
- mindspore/ops/operations/custom_ops.py +235 -172
- mindspore/ops/operations/debug_ops.py +55 -4
- mindspore/ops/operations/image_ops.py +13 -13
- mindspore/ops/operations/manually_defined/ops_def.py +15 -16
- mindspore/ops/operations/math_ops.py +3 -4
- mindspore/ops/operations/nn_ops.py +5 -6
- mindspore/ops/primitive.py +6 -10
- mindspore/ops/tensor_method.py +36 -4
- 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 -0
- 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 +4 -2
- mindspore/parallel/_cell_wrapper.py +106 -40
- mindspore/parallel/_parallel_serialization.py +1 -1
- 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 +13 -8
- mindspore/parallel/auto_parallel.py +12 -5
- mindspore/parallel/checkpoint_convert.py +3 -3
- mindspore/parallel/checkpoint_transform.py +3 -1
- mindspore/parallel/cluster/process_entity/_api.py +84 -48
- mindspore/parallel/cluster/process_entity/_utils.py +95 -7
- mindspore/parallel/cluster/run.py +43 -4
- mindspore/parallel/function/__init__.py +8 -1
- mindspore/parallel/function/reshard_func.py +1 -1
- mindspore/parallel/nn/__init__.py +15 -2
- mindspore/parallel/nn/parallel_cell_wrapper.py +9 -10
- mindspore/parallel/nn/parallel_grad_reducer.py +7 -6
- mindspore/parallel/shard.py +2 -2
- mindspore/parallel/transform_safetensors.py +462 -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_op_memory_viewer.py +42 -22
- 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/profiler_context.py +25 -27
- mindspore/profiler/common/profiler_info.py +0 -16
- mindspore/profiler/common/profiler_op_analyse.py +235 -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 +305 -314
- mindspore/profiler/envprofiler.py +12 -7
- mindspore/profiler/experimental_config.py +96 -6
- mindspore/profiler/mstx.py +33 -12
- mindspore/profiler/platform/__init__.py +2 -3
- mindspore/profiler/platform/npu_profiler.py +29 -19
- mindspore/profiler/profiler.py +35 -19
- mindspore/profiler/profiler_action_controller.py +64 -76
- 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 +1 -1
- mindspore/run_check/_check_version.py +7 -10
- mindspore/runtime/__init__.py +5 -5
- mindspore/runtime/event.py +10 -4
- mindspore/runtime/executor.py +60 -45
- mindspore/runtime/memory.py +21 -30
- mindspore/runtime/thread_bind_core.py +298 -164
- 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 +6 -2
- mindspore/train/amp.py +43 -20
- mindspore/train/callback/__init__.py +5 -5
- mindspore/train/callback/_checkpoint.py +3 -6
- mindspore/train/callback/_flops_collector.py +1 -1
- mindspore/train/callback/_landscape.py +0 -1
- mindspore/train/callback/_train_fault_tolerance.py +71 -13
- mindspore/train/data_sink.py +11 -2
- mindspore/train/dataset_helper.py +9 -0
- mindspore/train/model.py +51 -33
- mindspore/train/serialization.py +133 -111
- mindspore/train/summary/summary_record.py +13 -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 +6 -9
- 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.0rc1.dist-info}/METADATA +5 -4
- {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/RECORD +352 -390
- mindspore/_deprecated/jit.py +0 -198
- mindspore/experimental/es/__init__.py +0 -22
- mindspore/experimental/es/embedding_service.py +0 -891
- mindspore/experimental/es/embedding_service_layer.py +0 -581
- 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-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/WHEEL +0 -0
- {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/entry_points.txt +0 -0
- {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/top_level.txt +0 -0
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
# Copyright 2023 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
|
-
"""Profiler path manager"""
|
|
16
|
-
import os
|
|
17
|
-
import re
|
|
18
|
-
import shutil
|
|
19
|
-
import warnings
|
|
20
|
-
|
|
21
|
-
from mindspore import log as logger
|
|
22
|
-
from mindspore.profiler.parser.ascend_analysis.constant import Constant
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
__all__ = ['PathManager']
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class PathManager:
|
|
29
|
-
"""
|
|
30
|
-
Path common operations manager
|
|
31
|
-
"""
|
|
32
|
-
MAX_PATH_LENGTH = 4096
|
|
33
|
-
MAX_FILE_NAME_LENGTH = 255
|
|
34
|
-
DATA_FILE_AUTHORITY = 0o640
|
|
35
|
-
DATA_DIR_AUTHORITY = 0o750
|
|
36
|
-
|
|
37
|
-
@classmethod
|
|
38
|
-
def check_input_directory_path(cls, path: str):
|
|
39
|
-
"""
|
|
40
|
-
Function Description:
|
|
41
|
-
check whether the path is valid, some businesses can accept a path that does not exist,
|
|
42
|
-
so the function do not verify whether the path exists
|
|
43
|
-
Parameter:
|
|
44
|
-
path: the path to check, whether the incoming path is absolute or relative depends on the business
|
|
45
|
-
Exception Description:
|
|
46
|
-
when invalid data throw exception
|
|
47
|
-
"""
|
|
48
|
-
cls._input_path_common_check(path)
|
|
49
|
-
|
|
50
|
-
if os.path.isfile(path):
|
|
51
|
-
msg = "Invalid input path is a file path: {path}"
|
|
52
|
-
raise RuntimeError(msg)
|
|
53
|
-
|
|
54
|
-
@classmethod
|
|
55
|
-
def check_input_file_path(cls, path: str):
|
|
56
|
-
"""
|
|
57
|
-
Function Description:
|
|
58
|
-
check whether the file path is valid, some businesses can accept a path that does not exist,
|
|
59
|
-
so the function do not verify whether the path exists
|
|
60
|
-
Parameter:
|
|
61
|
-
path: the file path to check, whether the incoming path is absolute or relative depends on the business
|
|
62
|
-
Exception Description:
|
|
63
|
-
when invalid data throw exception
|
|
64
|
-
"""
|
|
65
|
-
cls._input_path_common_check(path)
|
|
66
|
-
|
|
67
|
-
if os.path.isdir(path):
|
|
68
|
-
msg = "Invalid input path is a directory path: {path}"
|
|
69
|
-
raise RuntimeError(msg)
|
|
70
|
-
|
|
71
|
-
@classmethod
|
|
72
|
-
def copy_file(cls, src_path: str, dst_path: str):
|
|
73
|
-
"""
|
|
74
|
-
Function Description:
|
|
75
|
-
copy file safety
|
|
76
|
-
Parameter:
|
|
77
|
-
src_path: file source path
|
|
78
|
-
dst_path: file destination path
|
|
79
|
-
Exception Description:
|
|
80
|
-
when src_path is link throw exception
|
|
81
|
-
"""
|
|
82
|
-
if not os.path.exists(src_path):
|
|
83
|
-
logger.warning("The source file does not exist: %s", src_path)
|
|
84
|
-
return
|
|
85
|
-
|
|
86
|
-
cls.check_input_file_path(src_path)
|
|
87
|
-
dst_dir = os.path.dirname(dst_path)
|
|
88
|
-
cls.check_directory_path_writeable(dst_dir)
|
|
89
|
-
|
|
90
|
-
try:
|
|
91
|
-
shutil.copy2(src_path, dst_path)
|
|
92
|
-
except Exception as err:
|
|
93
|
-
msg = f"Failed to copy path: {src_path}"
|
|
94
|
-
raise RuntimeError(msg) from err
|
|
95
|
-
|
|
96
|
-
@classmethod
|
|
97
|
-
def check_path_owner_consistent(cls, path: str):
|
|
98
|
-
"""
|
|
99
|
-
Function Description:
|
|
100
|
-
check whether the path belong to process owner
|
|
101
|
-
Parameter:
|
|
102
|
-
path: the path to check
|
|
103
|
-
Exception Description:
|
|
104
|
-
when invalid path, prompt the user
|
|
105
|
-
"""
|
|
106
|
-
|
|
107
|
-
if not os.path.exists(path):
|
|
108
|
-
msg = f"The path does not exist: {path}"
|
|
109
|
-
raise RuntimeError(msg)
|
|
110
|
-
if os.stat(path).st_uid != os.getuid():
|
|
111
|
-
warnings.warn(f"Warning: The {path} owner does not match the current user.")
|
|
112
|
-
|
|
113
|
-
@classmethod
|
|
114
|
-
def check_directory_path_writeable(cls, path):
|
|
115
|
-
"""
|
|
116
|
-
Function Description:
|
|
117
|
-
check whether the path is writable
|
|
118
|
-
Parameter:
|
|
119
|
-
path: the path to check
|
|
120
|
-
Exception Description:
|
|
121
|
-
when invalid data throw exception
|
|
122
|
-
"""
|
|
123
|
-
cls.check_path_owner_consistent(path)
|
|
124
|
-
if os.path.islink(path):
|
|
125
|
-
msg = f"Invalid path is a soft chain: {path}"
|
|
126
|
-
raise RuntimeError(msg)
|
|
127
|
-
if not os.access(path, os.W_OK):
|
|
128
|
-
msg = f"The path permission check failed: {path}"
|
|
129
|
-
raise RuntimeError(msg)
|
|
130
|
-
|
|
131
|
-
@classmethod
|
|
132
|
-
def check_directory_path_readable(cls, path):
|
|
133
|
-
"""
|
|
134
|
-
Function Description:
|
|
135
|
-
check whether the path is writable
|
|
136
|
-
Parameter:
|
|
137
|
-
path: the path to check
|
|
138
|
-
Exception Description:
|
|
139
|
-
when invalid data throw exception
|
|
140
|
-
"""
|
|
141
|
-
cls.check_path_owner_consistent(path)
|
|
142
|
-
if os.path.islink(path):
|
|
143
|
-
msg = f"Invalid path is a soft chain: {path}"
|
|
144
|
-
raise RuntimeError(msg)
|
|
145
|
-
if not os.access(path, os.R_OK):
|
|
146
|
-
msg = f"The path permission check failed: {path}"
|
|
147
|
-
raise RuntimeError(msg)
|
|
148
|
-
|
|
149
|
-
@classmethod
|
|
150
|
-
def remove_path_safety(cls, path: str):
|
|
151
|
-
"""
|
|
152
|
-
Function Description:
|
|
153
|
-
remove path safety
|
|
154
|
-
Parameter:
|
|
155
|
-
path: the path to remove
|
|
156
|
-
Exception Description:
|
|
157
|
-
when invalid data throw exception
|
|
158
|
-
"""
|
|
159
|
-
msg = f"Failed to remove path: {path}"
|
|
160
|
-
if os.path.islink(path):
|
|
161
|
-
raise RuntimeError(msg)
|
|
162
|
-
if not os.path.exists(path):
|
|
163
|
-
return
|
|
164
|
-
try:
|
|
165
|
-
shutil.rmtree(path)
|
|
166
|
-
except FileNotFoundError:
|
|
167
|
-
return
|
|
168
|
-
except Exception as err:
|
|
169
|
-
raise RuntimeError(msg) from err
|
|
170
|
-
|
|
171
|
-
@classmethod
|
|
172
|
-
def remove_file_safety(cls, file: str):
|
|
173
|
-
"""
|
|
174
|
-
Function Description:
|
|
175
|
-
remove file safety
|
|
176
|
-
Parameter:
|
|
177
|
-
path: the file to remove
|
|
178
|
-
Exception Description:
|
|
179
|
-
when invalid data throw exception
|
|
180
|
-
"""
|
|
181
|
-
msg = f"Failed to remove file: {file}"
|
|
182
|
-
if os.path.islink(file):
|
|
183
|
-
raise RuntimeError(msg)
|
|
184
|
-
if not os.path.exists(file):
|
|
185
|
-
return
|
|
186
|
-
try:
|
|
187
|
-
os.remove(file)
|
|
188
|
-
except FileExistsError:
|
|
189
|
-
return
|
|
190
|
-
except Exception as err:
|
|
191
|
-
raise RuntimeError(msg) from err
|
|
192
|
-
|
|
193
|
-
@classmethod
|
|
194
|
-
def make_dir_safety(cls, path: str):
|
|
195
|
-
"""
|
|
196
|
-
Function Description:
|
|
197
|
-
make directory safety
|
|
198
|
-
Parameter:
|
|
199
|
-
path: the directory to remove
|
|
200
|
-
Exception Description:
|
|
201
|
-
when invalid data throw exception
|
|
202
|
-
"""
|
|
203
|
-
msg = f"Failed to make directory: {path}"
|
|
204
|
-
if os.path.islink(path):
|
|
205
|
-
raise RuntimeError(msg)
|
|
206
|
-
if os.path.exists(path):
|
|
207
|
-
return
|
|
208
|
-
try:
|
|
209
|
-
os.makedirs(path, mode=cls.DATA_DIR_AUTHORITY, exist_ok=True)
|
|
210
|
-
except Exception as err:
|
|
211
|
-
raise RuntimeError(msg) from err
|
|
212
|
-
|
|
213
|
-
@classmethod
|
|
214
|
-
def create_file_safety(cls, path: str):
|
|
215
|
-
"""
|
|
216
|
-
Function Description:
|
|
217
|
-
create file safety
|
|
218
|
-
Parameter:
|
|
219
|
-
path: the file to remove
|
|
220
|
-
Exception Description:
|
|
221
|
-
when invalid data throw exception
|
|
222
|
-
"""
|
|
223
|
-
msg = f"Failed to create file: {path}"
|
|
224
|
-
if os.path.islink(path):
|
|
225
|
-
raise RuntimeError(msg)
|
|
226
|
-
if os.path.exists(path):
|
|
227
|
-
return
|
|
228
|
-
try:
|
|
229
|
-
os.close(os.open(path, os.O_WRONLY | os.O_CREAT, cls.DATA_FILE_AUTHORITY))
|
|
230
|
-
except Exception as err:
|
|
231
|
-
raise RuntimeError(msg) from err
|
|
232
|
-
|
|
233
|
-
@classmethod
|
|
234
|
-
def _input_path_common_check(cls, path: str):
|
|
235
|
-
"""
|
|
236
|
-
Function Description:
|
|
237
|
-
input path check common function
|
|
238
|
-
Parameter:
|
|
239
|
-
path: the file path to check
|
|
240
|
-
Exception Description:
|
|
241
|
-
when invalid data throw exception
|
|
242
|
-
"""
|
|
243
|
-
if len(path) > cls.MAX_PATH_LENGTH:
|
|
244
|
-
raise RuntimeError("Length of input path exceeds the limit.")
|
|
245
|
-
|
|
246
|
-
if os.path.islink(path):
|
|
247
|
-
msg = f"Invalid input path is a soft chain: {path}"
|
|
248
|
-
raise RuntimeError(msg)
|
|
249
|
-
|
|
250
|
-
pattern = r'(\.|/|_|-|\s|[~0-9a-zA-Z])+'
|
|
251
|
-
if not re.fullmatch(pattern, path):
|
|
252
|
-
msg = f"Invalid input path: {path}"
|
|
253
|
-
raise RuntimeError(msg)
|
|
254
|
-
|
|
255
|
-
path_split_list = path.split("/")
|
|
256
|
-
for name in path_split_list:
|
|
257
|
-
if len(name) > cls.MAX_FILE_NAME_LENGTH:
|
|
258
|
-
raise RuntimeError("Length of input path exceeds the limit.")
|
|
259
|
-
|
|
260
|
-
@classmethod
|
|
261
|
-
def get_profiler_parent_path_list(cls, input_path: str):
|
|
262
|
-
"""
|
|
263
|
-
Function Description:
|
|
264
|
-
get valid profiler parent path list from input_path
|
|
265
|
-
Parameter:
|
|
266
|
-
input_path: The directory path from which to extract profiler parent paths.
|
|
267
|
-
Return:
|
|
268
|
-
A list containing the input path or its subdirectories that are valid profiler parents.
|
|
269
|
-
"""
|
|
270
|
-
profiler_path = os.path.join(input_path, Constant.PROFILER_DIR)
|
|
271
|
-
if os.path.isdir(profiler_path) and (cls.get_fwk_path(profiler_path) or cls.get_cann_path(profiler_path)):
|
|
272
|
-
return [input_path]
|
|
273
|
-
sub_dirs = os.listdir(os.path.realpath(input_path))
|
|
274
|
-
profiler_parent_path_list = []
|
|
275
|
-
for sub_dir in sub_dirs:
|
|
276
|
-
sub_path = os.path.join(input_path, sub_dir, Constant.PROFILER_DIR)
|
|
277
|
-
if not os.path.isdir(sub_path):
|
|
278
|
-
continue
|
|
279
|
-
if cls.get_fwk_path(sub_path) or cls.get_cann_path(sub_path):
|
|
280
|
-
profiler_parent_path_list.append(os.path.join(input_path, sub_dir))
|
|
281
|
-
return profiler_parent_path_list
|
|
282
|
-
|
|
283
|
-
@classmethod
|
|
284
|
-
def get_fwk_path(cls, input_path: str):
|
|
285
|
-
"""
|
|
286
|
-
Function Description:
|
|
287
|
-
get valid framework path from input_path
|
|
288
|
-
Parameter:
|
|
289
|
-
input_path: the directory path to check whether exist valid FRAMEWORK path
|
|
290
|
-
Return:
|
|
291
|
-
The path to the FRAMEWORK directory if found, otherwise an empty string.
|
|
292
|
-
"""
|
|
293
|
-
fwk_path = os.path.join(input_path, Constant.FRAMEWORK_DIR)
|
|
294
|
-
if os.path.isdir(fwk_path):
|
|
295
|
-
return fwk_path
|
|
296
|
-
return ""
|
|
297
|
-
|
|
298
|
-
@classmethod
|
|
299
|
-
def get_cann_path(cls, input_path: str):
|
|
300
|
-
"""
|
|
301
|
-
Function Description:
|
|
302
|
-
get valid PROF_XXX path from input_path
|
|
303
|
-
Parameter:
|
|
304
|
-
input_path: the directory path to check valid PROF_XXX path
|
|
305
|
-
Return:
|
|
306
|
-
The path to the PROF_XXX directory if it matches the pattern and exists, otherwise an empty string.
|
|
307
|
-
"""
|
|
308
|
-
sub_dirs = os.listdir(os.path.realpath(input_path))
|
|
309
|
-
for sub_dir in sub_dirs:
|
|
310
|
-
sub_path = os.path.join(input_path, sub_dir)
|
|
311
|
-
if os.path.isdir(sub_path) and re.match(r"^PROF_\d+_\d+_[0-9a-zA-Z]+", sub_dir):
|
|
312
|
-
return sub_path
|
|
313
|
-
return ""
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
# Copyright 2023 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
|
-
"""Profiler host information parser"""
|
|
16
|
-
import os
|
|
17
|
-
import json
|
|
18
|
-
from decimal import Decimal
|
|
19
|
-
from subprocess import CalledProcessError, TimeoutExpired
|
|
20
|
-
from subprocess import Popen, PIPE
|
|
21
|
-
from configparser import ConfigParser
|
|
22
|
-
|
|
23
|
-
from mindspore import log as logger
|
|
24
|
-
from mindspore.profiler.common.validator.validate_path import validate_and_normalize_path
|
|
25
|
-
from mindspore.profiler.parser.ascend_analysis.constant import Constant
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class ProfilerInfoParser:
|
|
29
|
-
"""Parse files that record information, such as profiler_info.json"""
|
|
30
|
-
|
|
31
|
-
_freq = 100.0
|
|
32
|
-
_msprof_cmd = "msprof"
|
|
33
|
-
_time_out = 1
|
|
34
|
-
# profiler information related files
|
|
35
|
-
_source_prof_path = None
|
|
36
|
-
_loaded_frequency = False
|
|
37
|
-
_rank_id = 0
|
|
38
|
-
_clock_monotonic_raw = 0
|
|
39
|
-
_cntvct = 0
|
|
40
|
-
_collectionTimeBegin = 0
|
|
41
|
-
_clockMonotonicRaw = 0
|
|
42
|
-
_get_localtime_diff = 0
|
|
43
|
-
|
|
44
|
-
@classmethod
|
|
45
|
-
def init_source_path(cls, source_path: str):
|
|
46
|
-
"""initialize the path of PROF_* directory."""
|
|
47
|
-
source_path = validate_and_normalize_path(source_path)
|
|
48
|
-
prof_path = os.path.dirname(source_path)
|
|
49
|
-
dir_name = os.path.basename(source_path)
|
|
50
|
-
if not dir_name.startswith("device") or not os.path.exists(source_path):
|
|
51
|
-
raise RuntimeError("Input source path is invalid!")
|
|
52
|
-
cls._source_prof_path = prof_path
|
|
53
|
-
|
|
54
|
-
@classmethod
|
|
55
|
-
def init_rank_id(cls, rank_id: int):
|
|
56
|
-
"""initialize the rank id."""
|
|
57
|
-
cls._rank_id = rank_id
|
|
58
|
-
|
|
59
|
-
@classmethod
|
|
60
|
-
def get_local_time(cls, syscnt: int) -> Decimal:
|
|
61
|
-
"""Convert syscnt to local time."""
|
|
62
|
-
if not cls._loaded_frequency:
|
|
63
|
-
outs, _ = cls.__run_cmd(['which', cls._msprof_cmd])
|
|
64
|
-
if not outs:
|
|
65
|
-
raise FileNotFoundError("Failed to find msprof command!")
|
|
66
|
-
msprof_path = os.path.realpath(outs.strip())
|
|
67
|
-
sup_path = msprof_path.split('tools')[0]
|
|
68
|
-
script_path = os.path.join(sup_path, 'tools/profiler/profiler_tool/analysis/interface/get_msprof_info.py')
|
|
69
|
-
py_cmd = ['python', script_path, '-dir', os.path.join(cls._source_prof_path, 'host')]
|
|
70
|
-
outs, _ = cls.__run_cmd(py_cmd)
|
|
71
|
-
if not outs:
|
|
72
|
-
raise RuntimeError("Failed to get msprof information!")
|
|
73
|
-
result = json.loads(outs)
|
|
74
|
-
cpu_info = result.get('data', {}).get('host_info', {}).get('cpu_info', [{}])[0]
|
|
75
|
-
try:
|
|
76
|
-
cls._freq = float(cpu_info.get("Frequency", cls._freq))
|
|
77
|
-
except ValueError:
|
|
78
|
-
pass
|
|
79
|
-
cls._get_msprof_timestamp(cls._source_prof_path)
|
|
80
|
-
cls._loaded_frequency = True
|
|
81
|
-
start_ns = cls.__get_timestamp(syscnt)
|
|
82
|
-
return Decimal(start_ns).quantize(Decimal('0.000')) * Decimal(Constant.NS_TO_US).quantize(Decimal('0.000'))
|
|
83
|
-
|
|
84
|
-
@classmethod
|
|
85
|
-
def _get_msprof_timestamp(cls, source_path):
|
|
86
|
-
"""get msprof timestamp info"""
|
|
87
|
-
start_log = ConfigParser()
|
|
88
|
-
start_log.read(os.path.join(source_path, "host", "host_start.log"))
|
|
89
|
-
cls._clock_monotonic_raw = int(start_log.get("Host", "clock_monotonic_raw"))
|
|
90
|
-
cls._cntvct = int(start_log.get("Host", "cntvct"))
|
|
91
|
-
|
|
92
|
-
with open(os.path.join(source_path, "host", "start_info"), "r") as f:
|
|
93
|
-
info_dict = json.load(f)
|
|
94
|
-
cls._collectionTimeBegin = int(info_dict.get("collectionTimeBegin", 0)) # us
|
|
95
|
-
cls._clockMonotonicRaw = int(info_dict.get("clockMonotonicRaw", 0))
|
|
96
|
-
us_to_ns = 1000
|
|
97
|
-
cls._get_localtime_diff = cls._clock_monotonic_raw + (cls._collectionTimeBegin * us_to_ns -
|
|
98
|
-
cls._clockMonotonicRaw)
|
|
99
|
-
|
|
100
|
-
@classmethod
|
|
101
|
-
def __run_cmd(cls, cmd):
|
|
102
|
-
"""run shell command"""
|
|
103
|
-
try:
|
|
104
|
-
with Popen(cmd, stdout=PIPE, stderr=PIPE, text=True) as proc:
|
|
105
|
-
outs, errs = proc.communicate(timeout=cls._time_out)
|
|
106
|
-
except (FileNotFoundError, PermissionError, CalledProcessError) as exc:
|
|
107
|
-
raise RuntimeError(exc) from exc
|
|
108
|
-
except TimeoutExpired as err:
|
|
109
|
-
proc.kill()
|
|
110
|
-
msg = "The possible cause is that too much data is collected " \
|
|
111
|
-
"and the export time is too long."
|
|
112
|
-
logger.error(msg)
|
|
113
|
-
raise TimeoutError(msg) from err
|
|
114
|
-
logger.info(outs)
|
|
115
|
-
return outs, errs
|
|
116
|
-
|
|
117
|
-
@classmethod
|
|
118
|
-
def __get_timestamp(cls, syscnt: int, time_fmt: int = 1000):
|
|
119
|
-
"""Convert syscnt to time stamp."""
|
|
120
|
-
ratio = time_fmt / cls._freq
|
|
121
|
-
# The unit of timestamp is ns
|
|
122
|
-
timestamp = round((syscnt - cls._cntvct) * ratio) + cls._get_localtime_diff
|
|
123
|
-
return timestamp
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
# Copyright 2023 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
|
-
"""TLV format file decoder"""
|
|
16
|
-
|
|
17
|
-
import struct
|
|
18
|
-
from typing import List, Dict, Union
|
|
19
|
-
|
|
20
|
-
from mindspore import log as logger
|
|
21
|
-
|
|
22
|
-
from mindspore.profiler.parser.ascend_analysis.constant import Constant
|
|
23
|
-
from mindspore.profiler.parser.ascend_analysis.function_event import MindSporeOpEvent
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class TLVDecoder:
|
|
27
|
-
"""
|
|
28
|
-
The class of TLV format data decoder.
|
|
29
|
-
|
|
30
|
-
Args:
|
|
31
|
-
all_bytes(bytes): all the bytes data of tlv format binary file.
|
|
32
|
-
event_class(MindSporeOpEvent): class of events to decode.
|
|
33
|
-
fix_data_struct_size(int): a constant value.
|
|
34
|
-
|
|
35
|
-
Return:
|
|
36
|
-
List[MindSporeOpEvent]: event list of input event class.
|
|
37
|
-
"""
|
|
38
|
-
_type_len = 2
|
|
39
|
-
_length_len = 4
|
|
40
|
-
|
|
41
|
-
@classmethod
|
|
42
|
-
def decode(cls, all_bytes: bytes, event_class: MindSporeOpEvent, fix_data_struct_size: int):
|
|
43
|
-
"""Decode all the data."""
|
|
44
|
-
result_data = []
|
|
45
|
-
records = cls.tlv_list_decode(all_bytes)
|
|
46
|
-
for record in records:
|
|
47
|
-
if fix_data_struct_size > len(record):
|
|
48
|
-
logger.warning("The collected data has been lost")
|
|
49
|
-
continue
|
|
50
|
-
fix_data_bytes = record[0: fix_data_struct_size]
|
|
51
|
-
tlv_fields = cls.tlv_list_decode(record[fix_data_struct_size:], is_field=True)
|
|
52
|
-
tlv_fields[Constant.FIX_SIZE_BYTES] = fix_data_bytes
|
|
53
|
-
result_data.append(event_class(tlv_fields))
|
|
54
|
-
return result_data
|
|
55
|
-
|
|
56
|
-
@classmethod
|
|
57
|
-
def tlv_list_decode(cls, tlv_bytes: bytes, is_field: bool = False) -> Union[Dict, List]:
|
|
58
|
-
"""Decode TLV format data."""
|
|
59
|
-
result_data = {} if is_field else []
|
|
60
|
-
index = 0
|
|
61
|
-
all_bytes_len = len(tlv_bytes)
|
|
62
|
-
while index < all_bytes_len:
|
|
63
|
-
if index + cls._type_len > all_bytes_len:
|
|
64
|
-
logger.warning("The collected data has been lost")
|
|
65
|
-
break
|
|
66
|
-
type_id = struct.unpack("<H", tlv_bytes[index: index + cls._type_len])[0]
|
|
67
|
-
index += cls._type_len
|
|
68
|
-
if index + cls._length_len > all_bytes_len:
|
|
69
|
-
logger.warning("The collected data has been lost")
|
|
70
|
-
break
|
|
71
|
-
value_len = struct.unpack("<I", tlv_bytes[index: index + cls._length_len])[0]
|
|
72
|
-
index += cls._length_len
|
|
73
|
-
if index + value_len > all_bytes_len:
|
|
74
|
-
logger.warning("The collected data has been lost")
|
|
75
|
-
break
|
|
76
|
-
value = tlv_bytes[index: index + value_len]
|
|
77
|
-
index += value_len
|
|
78
|
-
if is_field:
|
|
79
|
-
try:
|
|
80
|
-
result_data[type_id] = bytes.decode(value)
|
|
81
|
-
except UnicodeDecodeError:
|
|
82
|
-
logger.warning(f"The collected data can't decode by bytes.decode: {value}")
|
|
83
|
-
result_data[type_id] = 'N/A'
|
|
84
|
-
else:
|
|
85
|
-
result_data.append(value)
|
|
86
|
-
return result_data
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
# Copyright 2023 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
|
-
"""Json trace event manager"""
|
|
16
|
-
|
|
17
|
-
from typing import Dict, List
|
|
18
|
-
|
|
19
|
-
from mindspore.profiler.parser.ascend_analysis.constant import Constant
|
|
20
|
-
from mindspore.profiler.parser.ascend_analysis.function_event import BaseEvent
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class TraceEventManager:
|
|
24
|
-
"""Chrome trace format json object manager."""
|
|
25
|
-
|
|
26
|
-
@classmethod
|
|
27
|
-
def create_x_event(cls, event: BaseEvent, cat: str) -> Dict:
|
|
28
|
-
"""Create a X event."""
|
|
29
|
-
x_event = {
|
|
30
|
-
"ph": "X", "name": event.name, "pid": event.pid, "tid": event.tid,
|
|
31
|
-
"ts": str(event.ts), "dur": str(event.dur), "cat": cat, "args": event.args
|
|
32
|
-
}
|
|
33
|
-
return x_event
|
|
34
|
-
|
|
35
|
-
@classmethod
|
|
36
|
-
def create_i_event(cls, event: BaseEvent) -> Dict:
|
|
37
|
-
"""Create a i event."""
|
|
38
|
-
event = {"name": event.name, "ph": "i", "ts": str(event.ts),
|
|
39
|
-
"pid": event.pid, "tid": event.tid, "args": event.args}
|
|
40
|
-
return event
|
|
41
|
-
|
|
42
|
-
@classmethod
|
|
43
|
-
def create_m_event(cls, pid: int, tid_list: set, process_index: int) -> List:
|
|
44
|
-
"""Create some metadata event."""
|
|
45
|
-
# framework sidee trace information display format: MindSpore(pid pid_value): CPU
|
|
46
|
-
event_list = [
|
|
47
|
-
# process information
|
|
48
|
-
{"ph": "M", "name": Constant.PROCESS_NAME, "pid": pid, "tid": 0, "args": {"name": "MindSpore"}},
|
|
49
|
-
{"ph": "M", "name": Constant.PROCESS_LABEL, "pid": pid, "tid": 0, "args": {"labels": "CPU"}},
|
|
50
|
-
{"ph": "M", "name": Constant.PROCESS_SORT, "pid": pid, "tid": 0, "args": {"sort_index": process_index}},
|
|
51
|
-
]
|
|
52
|
-
for tid in tid_list:
|
|
53
|
-
sort_index = tid
|
|
54
|
-
event_list.extend(
|
|
55
|
-
[{"ph": "M", "name": Constant.THREAD_NAME, "pid": pid, "tid": tid, "args": {"name": f"Thread {tid}"}},
|
|
56
|
-
{"ph": "M", "name": Constant.THREAD_SORT, "pid": pid, "tid": tid, "args": {"sort_index": sort_index}}])
|
|
57
|
-
return event_list
|
|
58
|
-
|
|
59
|
-
@classmethod
|
|
60
|
-
def create_mindspore_to_npu_flow(cls, start_event: BaseEvent, end_event: BaseEvent) -> List:
|
|
61
|
-
"""Create flow events link mindspore operator and npu kernel."""
|
|
62
|
-
flow_id = str(end_event.ts)
|
|
63
|
-
return [{"ph": "s", "bp": "e", "name": "mindspore_to_npu", "id": flow_id, "pid": start_event.pid,
|
|
64
|
-
"tid": start_event.tid, "ts": str(start_event.ts), "cat": "async_npu"},
|
|
65
|
-
{"ph": "f", "bp": "e", "name": "mindspore_to_npu", "id": flow_id, "pid": end_event.pid,
|
|
66
|
-
"tid": end_event.tid, "ts": str(end_event.ts), "cat": "async_npu"}]
|
|
67
|
-
|
|
68
|
-
@classmethod
|
|
69
|
-
def create_mindspore_to_self_flow(cls, start_event: BaseEvent, end_event: BaseEvent) -> List:
|
|
70
|
-
"""Create flow events link mindspore operator and npu kernel."""
|
|
71
|
-
flow_id = start_event.flow_id
|
|
72
|
-
return [{"ph": "s", "bp": "e", "name": "mindspore_to_self", "id": flow_id, "pid": start_event.pid,
|
|
73
|
-
"tid": start_event.tid, "ts": str(start_event.ts), "cat": "async_mindspore"},
|
|
74
|
-
{"ph": "f", "bp": "e", "name": "mindspore_to_self", "id": flow_id, "pid": end_event.pid,
|
|
75
|
-
"tid": end_event.tid, "ts": str(end_event.ts), "cat": "async_mindspore"}]
|