mindspore 2.6.0rc1__cp311-cp311-win_amd64.whl → 2.7.0__cp311-cp311-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mindspore might be problematic. Click here for more details.
- mindspore/.commit_id +1 -1
- mindspore/Microsoft.VisualStudio.Telemetry.dll +0 -0
- mindspore/Newtonsoft.Json.dll +0 -0
- mindspore/__init__.py +2 -2
- mindspore/_c_dataengine.cp311-win_amd64.pyd +0 -0
- mindspore/_c_expression.cp311-win_amd64.pyd +0 -0
- mindspore/_c_mindrecord.cp311-win_amd64.pyd +0 -0
- mindspore/_checkparam.py +42 -11
- mindspore/_extends/builtin_operations.py +3 -3
- mindspore/{_deprecated → _extends/optimize}/__init__.py +9 -3
- mindspore/_extends/optimize/cell_utils.py +96 -0
- mindspore/_extends/parallel_compile/akg_compiler/custom.py +1109 -0
- mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +1 -1
- mindspore/_extends/parse/__init__.py +3 -3
- mindspore/_extends/parse/compile_config.py +44 -22
- mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +1 -2
- mindspore/_extends/parse/parser.py +65 -84
- mindspore/_extends/parse/resources.py +39 -0
- mindspore/_extends/parse/standard_method.py +58 -14
- mindspore/_extends/parse/trope.py +8 -1
- mindspore/_extends/pijit/__init__.py +1 -2
- mindspore/_extends/pijit/pijit_func_white_list.py +2 -5
- mindspore/amp.py +4 -22
- mindspore/atlprov.dll +0 -0
- mindspore/avcodec-59.dll +0 -0
- mindspore/avdevice-59.dll +0 -0
- mindspore/avfilter-8.dll +0 -0
- mindspore/avformat-59.dll +0 -0
- mindspore/avutil-57.dll +0 -0
- mindspore/boost/adasum.py +1 -1
- mindspore/boost/boost_cell_wrapper.py +4 -4
- mindspore/c1.dll +0 -0
- mindspore/c1xx.dll +0 -0
- mindspore/c2.dll +0 -0
- mindspore/common/__init__.py +43 -12
- mindspore/common/_grad_function.py +2 -1
- mindspore/common/_pijit_context.py +28 -7
- mindspore/common/_stub_tensor.py +1 -209
- mindspore/common/_tensor_cpp_method.py +1 -1
- mindspore/common/_tensor_docs.py +178 -53
- mindspore/common/_utils.py +9 -1
- mindspore/common/api.py +377 -203
- mindspore/common/dtype.py +108 -57
- mindspore/common/dump.py +11 -16
- mindspore/common/dynamic_shape/__init__.py +0 -0
- mindspore/common/{auto_dynamic_shape.py → dynamic_shape/auto_dynamic_shape.py} +17 -23
- mindspore/common/dynamic_shape/enable_dynamic.py +197 -0
- mindspore/common/file_system.py +59 -9
- mindspore/common/generator.py +5 -3
- mindspore/common/hook_handle.py +33 -5
- mindspore/common/jit_config.py +1 -1
- mindspore/common/jit_trace.py +84 -105
- mindspore/common/np_dtype.py +3 -3
- mindspore/common/parameter.py +27 -29
- mindspore/common/recompute.py +5 -7
- mindspore/common/sparse_tensor.py +0 -3
- mindspore/common/symbol.py +0 -1
- mindspore/common/tensor.py +117 -131
- mindspore/communication/_comm_helper.py +46 -4
- mindspore/communication/management.py +79 -7
- mindspore/context.py +67 -55
- mindspore/dataset/__init__.py +1 -1
- mindspore/dataset/audio/transforms.py +1 -1
- mindspore/dataset/core/config.py +38 -4
- mindspore/dataset/engine/datasets.py +350 -322
- mindspore/dataset/engine/datasets_user_defined.py +70 -24
- mindspore/dataset/engine/iterators.py +2 -2
- mindspore/dataset/engine/obs/config_loader.py +2 -2
- mindspore/dataset/engine/obs/obs_mindrecord_dataset.py +8 -0
- mindspore/dataset/transforms/c_transforms.py +2 -2
- mindspore/dataset/transforms/py_transforms.py +7 -3
- mindspore/dataset/transforms/transforms.py +10 -6
- mindspore/dataset/vision/__init__.py +1 -1
- mindspore/dataset/vision/py_transforms.py +8 -8
- mindspore/dataset/vision/transforms.py +17 -5
- mindspore/dataset/vision/utils.py +632 -21
- mindspore/dataset/vision/validators.py +1 -0
- mindspore/device_context/ascend/device.py +1 -1
- mindspore/device_context/ascend/op_tuning.py +35 -1
- mindspore/device_context/gpu/__init__.py +2 -2
- mindspore/device_context/gpu/device.py +1 -1
- mindspore/device_context/gpu/op_precision.py +4 -2
- mindspore/device_context/gpu/op_tuning.py +6 -3
- mindspore/device_manager.py +16 -9
- mindspore/dnnl.dll +0 -0
- mindspore/dpcmi.dll +0 -0
- mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +3 -4
- mindspore/experimental/llm_boost/atb/boost_base.py +2 -3
- mindspore/experimental/optim/adadelta.py +13 -20
- mindspore/experimental/optim/adagrad.py +15 -22
- mindspore/experimental/optim/adam.py +17 -24
- mindspore/experimental/optim/adamax.py +14 -22
- mindspore/experimental/optim/adamw.py +28 -34
- mindspore/experimental/optim/asgd.py +15 -25
- mindspore/experimental/optim/lr_scheduler.py +27 -45
- mindspore/experimental/optim/nadam.py +14 -24
- mindspore/experimental/optim/optimizer.py +13 -23
- mindspore/experimental/optim/radam.py +18 -24
- mindspore/experimental/optim/rmsprop.py +14 -25
- mindspore/experimental/optim/rprop.py +15 -26
- mindspore/experimental/optim/sgd.py +9 -19
- mindspore/hal/__init__.py +4 -4
- mindspore/hal/contiguous_tensors_handle.py +2 -2
- mindspore/hal/memory.py +27 -7
- mindspore/include/api/cell.h +65 -5
- mindspore/include/api/cfg.h +24 -7
- mindspore/include/api/context.h +1 -0
- mindspore/include/api/delegate.h +10 -2
- mindspore/include/api/dual_abi_helper.h +100 -19
- mindspore/include/api/graph.h +14 -1
- mindspore/include/api/kernel.h +16 -3
- mindspore/include/api/kernel_api.h +9 -1
- mindspore/include/api/metrics/accuracy.h +9 -0
- mindspore/include/api/model.h +8 -1
- mindspore/include/api/model_group.h +4 -0
- mindspore/include/api/model_parallel_runner.h +2 -0
- mindspore/include/api/status.h +48 -10
- mindspore/include/api/types.h +8 -3
- mindspore/include/c_api/model_c.h +0 -58
- mindspore/include/c_api/tensor_c.h +0 -26
- mindspore/include/dataset/constants.h +9 -0
- mindspore/include/dataset/vision_ascend.h +1 -1
- mindspore/jpeg62.dll +0 -0
- mindspore/mindrecord/tools/cifar10.py +61 -11
- mindspore/mindrecord/tools/cifar10_to_mr.py +5 -0
- mindspore/mindspore_backend_common.dll +0 -0
- mindspore/mindspore_backend_manager.dll +0 -0
- mindspore/mindspore_common.dll +0 -0
- mindspore/mindspore_core.dll +0 -0
- mindspore/mindspore_cpu_res_manager.dll +0 -0
- mindspore/mindspore_dump.dll +0 -0
- mindspore/mindspore_frontend.dll +0 -0
- mindspore/mindspore_glog.dll +0 -0
- mindspore/mindspore_memory_pool.dll +0 -0
- mindspore/mindspore_ms_backend.dll +0 -0
- mindspore/mindspore_ops.dll +0 -0
- mindspore/mindspore_ops_host.dll +0 -0
- mindspore/mindspore_ops_kernel_common.dll +0 -0
- mindspore/mindspore_profiler.dll +0 -0
- mindspore/mindspore_pyboost.dll +0 -0
- mindspore/mindspore_pynative.dll +0 -0
- mindspore/mindspore_res_manager.dll +0 -0
- mindspore/mindspore_runtime_pipeline.dll +0 -0
- mindspore/mint/__init__.py +6 -46
- mindspore/mint/distributed/__init__.py +5 -0
- mindspore/mint/distributed/distributed.py +429 -23
- mindspore/mint/nn/__init__.py +1 -1
- mindspore/mint/nn/functional.py +53 -6
- mindspore/mint/nn/layer/_functions.py +163 -294
- mindspore/mint/nn/layer/activation.py +8 -6
- mindspore/mint/nn/layer/conv.py +140 -104
- mindspore/mint/nn/layer/normalization.py +11 -25
- mindspore/mint/optim/adam.py +19 -18
- mindspore/mint/optim/adamw.py +14 -8
- mindspore/mint/optim/sgd.py +5 -5
- mindspore/msobj140.dll +0 -0
- mindspore/mspdb140.dll +0 -0
- mindspore/mspdbcore.dll +0 -0
- mindspore/mspdbst.dll +0 -0
- mindspore/mspft140.dll +0 -0
- mindspore/msvcdis140.dll +0 -0
- mindspore/msvcp140_1.dll +0 -0
- mindspore/msvcp140_2.dll +0 -0
- mindspore/msvcp140_atomic_wait.dll +0 -0
- mindspore/msvcp140_codecvt_ids.dll +0 -0
- mindspore/nn/cell.py +491 -623
- mindspore/nn/grad/cell_grad.py +11 -12
- mindspore/nn/layer/activation.py +36 -36
- mindspore/nn/layer/basic.py +74 -77
- mindspore/nn/layer/channel_shuffle.py +4 -4
- mindspore/nn/layer/combined.py +4 -2
- mindspore/nn/layer/conv.py +117 -110
- mindspore/nn/layer/dense.py +9 -7
- mindspore/nn/layer/embedding.py +50 -52
- mindspore/nn/layer/image.py +38 -40
- mindspore/nn/layer/math.py +111 -112
- mindspore/nn/layer/normalization.py +56 -44
- mindspore/nn/layer/pooling.py +58 -63
- mindspore/nn/layer/rnn_cells.py +33 -33
- mindspore/nn/layer/rnns.py +56 -56
- mindspore/nn/layer/thor_layer.py +74 -73
- mindspore/nn/layer/transformer.py +11 -1
- mindspore/nn/learning_rate_schedule.py +20 -20
- mindspore/nn/loss/loss.py +79 -81
- mindspore/nn/optim/adam.py +4 -6
- mindspore/nn/optim/adasum.py +2 -2
- mindspore/nn/optim/asgd.py +2 -0
- mindspore/nn/optim/lamb.py +1 -3
- mindspore/nn/optim/optimizer.py +1 -1
- mindspore/nn/optim/tft_wrapper.py +2 -3
- mindspore/nn/optim/thor.py +2 -2
- mindspore/nn/probability/distribution/_utils/utils.py +2 -2
- mindspore/nn/probability/distribution/exponential.py +2 -1
- mindspore/nn/probability/distribution/poisson.py +2 -1
- mindspore/nn/sparse/sparse.py +3 -3
- mindspore/nn/wrap/cell_wrapper.py +73 -42
- mindspore/nn/wrap/grad_reducer.py +37 -52
- mindspore/nn/wrap/loss_scale.py +72 -74
- mindspore/numpy/array_creations.py +7 -7
- mindspore/numpy/fft.py +1 -1
- mindspore/numpy/math_ops.py +5 -5
- mindspore/numpy/utils_const.py +1 -1
- mindspore/opencv_core452.dll +0 -0
- mindspore/opencv_imgcodecs452.dll +0 -0
- mindspore/opencv_imgproc452.dll +0 -0
- mindspore/ops/_grad_experimental/grad_comm_ops.py +51 -13
- mindspore/ops/_grad_experimental/grad_debug_ops.py +14 -0
- mindspore/ops/_grad_experimental/grad_inner_ops.py +0 -9
- mindspore/ops/_op_impl/cpu/__init__.py +1 -0
- mindspore/{experimental/es/__init__.py → ops/_op_impl/cpu/joinedstr_op.py} +12 -6
- mindspore/ops/_vmap/vmap_array_ops.py +31 -13
- mindspore/ops/_vmap/vmap_nn_ops.py +8 -16
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +54 -13
- mindspore/ops/auto_generate/gen_extend_func.py +27 -145
- mindspore/ops/auto_generate/gen_ops_def.py +1027 -347
- mindspore/ops/auto_generate/gen_ops_prim.py +2341 -1117
- mindspore/ops/auto_generate/pyboost_inner_prim.py +31 -1
- mindspore/ops/composite/__init__.py +10 -0
- mindspore/ops/composite/base.py +9 -5
- mindspore/ops/composite/multitype_ops/__init__.py +12 -1
- mindspore/ops/composite/multitype_ops/_compile_utils.py +133 -109
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -1
- mindspore/ops/composite/multitype_ops/add_impl.py +70 -2
- mindspore/ops/composite/multitype_ops/div_impl.py +49 -0
- mindspore/ops/composite/multitype_ops/floordiv_impl.py +29 -0
- mindspore/ops/composite/multitype_ops/getitem_impl.py +11 -0
- mindspore/ops/composite/multitype_ops/mod_impl.py +5 -3
- mindspore/ops/composite/multitype_ops/mul_impl.py +49 -0
- mindspore/ops/composite/multitype_ops/setitem_impl.py +57 -0
- mindspore/ops/composite/multitype_ops/sub_impl.py +34 -0
- mindspore/ops/composite/multitype_ops/zeros_like_impl.py +14 -0
- mindspore/ops/function/__init__.py +4 -1
- mindspore/ops/function/_add_attr_func.py +11 -6
- mindspore/ops/function/array_func.py +19 -102
- mindspore/ops/function/debug_func.py +8 -5
- mindspore/ops/function/grad/grad_func.py +5 -13
- mindspore/ops/function/math_func.py +77 -572
- mindspore/ops/function/nn_func.py +46 -94
- mindspore/ops/function/other_func.py +4 -1
- mindspore/ops/function/random_func.py +44 -5
- mindspore/ops/function/vmap_func.py +2 -1
- mindspore/ops/functional.py +4 -4
- mindspore/ops/functional_overload.py +594 -18
- mindspore/ops/op_info_register.py +21 -0
- mindspore/ops/operations/__init__.py +16 -11
- mindspore/ops/operations/_custom_ops_utils.py +689 -34
- mindspore/ops/operations/_inner_ops.py +14 -18
- mindspore/ops/operations/_sequence_ops.py +1 -1
- mindspore/ops/operations/array_ops.py +5 -51
- mindspore/ops/operations/comm_ops.py +186 -41
- mindspore/ops/operations/custom_ops.py +303 -177
- mindspore/ops/operations/debug_ops.py +59 -4
- mindspore/ops/operations/image_ops.py +13 -13
- mindspore/ops/operations/manually_defined/ops_def.py +27 -28
- mindspore/ops/operations/math_ops.py +8 -9
- mindspore/ops/operations/nn_ops.py +8 -40
- mindspore/ops/primitive.py +9 -20
- mindspore/ops/tensor_method.py +63 -15
- mindspore/ops_generate/api/cpp_create_prim_instance_helper_generator.py +1 -1
- mindspore/ops_generate/api/functional_map_cpp_generator.py +10 -9
- mindspore/ops_generate/api/functions_cc_generator.py +58 -10
- mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +1 -1
- mindspore/ops_generate/common/base_generator.py +14 -0
- mindspore/ops_generate/common/gen_constants.py +8 -3
- mindspore/ops_generate/common/gen_utils.py +0 -19
- mindspore/ops_generate/common/op_proto.py +11 -4
- mindspore/ops_generate/common/template.py +88 -11
- mindspore/ops_generate/gen_ops.py +1 -1
- mindspore/ops_generate/op_def/lite_ops_cpp_generator.py +4 -4
- mindspore/ops_generate/op_def/ops_def_cc_generator.py +0 -3
- mindspore/ops_generate/op_def/ops_name_h_generator.py +0 -3
- mindspore/ops_generate/op_def/ops_primitive_h_generator.py +0 -4
- mindspore/ops_generate/op_def_py/op_prim_py_generator.py +5 -2
- mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +49 -8
- mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +2 -2
- mindspore/ops_generate/pyboost/gen_pyboost_func.py +31 -16
- mindspore/ops_generate/pyboost/op_template_parser.py +98 -72
- mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +70 -273
- mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +14 -6
- mindspore/ops_generate/pyboost/pyboost_functions_impl_cpp_generator.py +316 -0
- mindspore/ops_generate/pyboost/pyboost_functions_py_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +5 -3
- mindspore/ops_generate/pyboost/pyboost_inner_prim_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_internal_functions_cpp_generator.py +76 -0
- mindspore/ops_generate/pyboost/pyboost_internal_functions_h_generator.py +76 -0
- mindspore/ops_generate/pyboost/pyboost_internal_kernel_info_adapter_generator.py +125 -0
- mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +4 -3
- mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +348 -61
- mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_utils.py +118 -9
- mindspore/ops_generate/tensor_py_cc_generator.py +1 -24
- mindspore/parallel/_auto_parallel_context.py +16 -23
- mindspore/parallel/_cell_wrapper.py +113 -45
- mindspore/parallel/_parallel_serialization.py +4 -3
- mindspore/parallel/_ps_context.py +4 -6
- mindspore/parallel/_tensor.py +167 -12
- mindspore/parallel/_transformer/moe.py +1 -1
- mindspore/parallel/_transformer/transformer.py +17 -12
- mindspore/parallel/_utils.py +5 -11
- mindspore/parallel/auto_parallel.py +35 -14
- mindspore/parallel/checkpoint_convert.py +3 -3
- mindspore/parallel/checkpoint_transform.py +13 -7
- mindspore/parallel/cluster/process_entity/_api.py +88 -49
- mindspore/parallel/cluster/process_entity/_utils.py +95 -7
- mindspore/parallel/cluster/run.py +48 -7
- mindspore/parallel/function/__init__.py +8 -1
- mindspore/parallel/function/reshard_func.py +12 -12
- mindspore/parallel/nn/__init__.py +15 -2
- mindspore/parallel/nn/parallel_cell_wrapper.py +50 -14
- mindspore/parallel/nn/parallel_grad_reducer.py +7 -14
- mindspore/parallel/shard.py +10 -25
- mindspore/parallel/transform_safetensors.py +469 -174
- mindspore/pgodb140.dll +0 -0
- mindspore/pgort140.dll +0 -0
- mindspore/profiler/__init__.py +2 -1
- mindspore/profiler/analysis/parser/timeline_assembly_factory/ascend_timeline_assembler.py +7 -7
- mindspore/profiler/analysis/parser/timeline_assembly_factory/base_timeline_assembler.py +3 -0
- mindspore/profiler/analysis/parser/timeline_assembly_factory/trace_view_container.py +12 -6
- mindspore/profiler/analysis/parser/timeline_creator/cpu_op_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_creator/fwk_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_creator/msprof_timeline_creator.py +4 -4
- mindspore/profiler/analysis/parser/timeline_creator/scope_layer_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_event/fwk_event.py +4 -1
- mindspore/profiler/analysis/parser/timeline_event/timeline_event_pool.py +2 -1
- mindspore/profiler/analysis/task_manager.py +1 -1
- mindspore/profiler/analysis/viewer/ascend_communication_viewer.py +5 -1
- mindspore/profiler/analysis/viewer/ascend_integrate_viewer.py +2 -1
- mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +10 -9
- mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +43 -23
- mindspore/profiler/analysis/viewer/ascend_step_trace_time_viewer.py +3 -2
- mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +9 -5
- mindspore/profiler/analysis/viewer/ms_operator_details_viewer.py +132 -0
- mindspore/profiler/common/constant.py +16 -0
- mindspore/profiler/common/msprof_cmd_tool.py +2 -2
- mindspore/profiler/common/path_manager.py +9 -0
- mindspore/profiler/common/profiler_context.py +50 -29
- mindspore/profiler/common/profiler_info.py +0 -16
- mindspore/profiler/common/profiler_meta_data.py +1 -0
- mindspore/profiler/common/profiler_op_analyse.py +239 -0
- mindspore/profiler/common/profiler_output_path.py +23 -8
- mindspore/profiler/common/profiler_parameters.py +128 -35
- mindspore/profiler/dynamic_profile/__init__.py +0 -0
- mindspore/profiler/dynamic_profile/dynamic_monitor_proxy.py +39 -0
- mindspore/profiler/dynamic_profile/dynamic_profiler_config_context.py +666 -0
- mindspore/profiler/dynamic_profile/dynamic_profiler_utils.py +62 -0
- mindspore/profiler/dynamic_profiler.py +374 -338
- mindspore/profiler/envprofiler.py +42 -12
- mindspore/profiler/experimental_config.py +112 -7
- mindspore/profiler/mstx.py +33 -12
- mindspore/profiler/platform/__init__.py +2 -3
- mindspore/profiler/platform/cpu_profiler.py +10 -4
- mindspore/profiler/platform/npu_profiler.py +30 -20
- mindspore/profiler/profiler.py +218 -154
- mindspore/profiler/profiler_action_controller.py +65 -77
- mindspore/profiler/profiler_interface.py +2 -2
- mindspore/profiler/schedule.py +10 -4
- mindspore/rewrite/common/config.py +1 -0
- mindspore/rewrite/common/namer.py +1 -0
- mindspore/rewrite/common/namespace.py +1 -0
- mindspore/rewrite/node/node.py +31 -11
- mindspore/rewrite/parsers/assign_parser.py +1 -1
- mindspore/rewrite/symbol_tree/symbol_tree.py +2 -2
- mindspore/run_check/_check_version.py +7 -10
- mindspore/runtime/__init__.py +8 -6
- mindspore/runtime/event.py +10 -4
- mindspore/runtime/executor.py +87 -45
- mindspore/runtime/memory.py +31 -32
- mindspore/runtime/thread_bind_core.py +299 -165
- mindspore/safeguard/rewrite_obfuscation.py +12 -13
- mindspore/swresample-4.dll +0 -0
- mindspore/swscale-6.dll +0 -0
- mindspore/tbbmalloc.dll +0 -0
- mindspore/tinyxml2.dll +0 -0
- mindspore/train/_utils.py +17 -7
- mindspore/train/amp.py +43 -23
- mindspore/train/callback/__init__.py +5 -5
- mindspore/train/callback/_callback.py +2 -1
- mindspore/train/callback/_checkpoint.py +4 -14
- mindspore/train/callback/_flops_collector.py +11 -7
- mindspore/train/callback/_landscape.py +0 -1
- mindspore/train/callback/_train_fault_tolerance.py +98 -21
- mindspore/train/data_sink.py +15 -6
- mindspore/train/dataset_helper.py +14 -5
- mindspore/train/model.py +133 -69
- mindspore/train/serialization.py +168 -126
- mindspore/train/summary/summary_record.py +13 -2
- mindspore/train/train_thor/model_thor.py +2 -2
- mindspore/turbojpeg.dll +0 -0
- mindspore/utils/__init__.py +3 -2
- mindspore/utils/dryrun.py +0 -6
- mindspore/utils/runtime_execution_order_check.py +163 -77
- mindspore/utils/sdc_detect.py +68 -0
- mindspore/utils/utils.py +14 -17
- mindspore/vcmeta.dll +0 -0
- mindspore/vcruntime140.dll +0 -0
- mindspore/vcruntime140_1.dll +0 -0
- mindspore/version.py +1 -1
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0.dist-info}/METADATA +5 -4
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0.dist-info}/RECORD +403 -442
- mindspore/_deprecated/jit.py +0 -198
- mindspore/_extends/remote/kernel_build_server_ascend.py +0 -75
- mindspore/communication/_hccl_management.py +0 -297
- mindspore/experimental/es/embedding_service.py +0 -891
- mindspore/experimental/es/embedding_service_layer.py +0 -581
- mindspore/profiler/common/validator/__init__.py +0 -14
- mindspore/profiler/common/validator/validate_path.py +0 -84
- mindspore/profiler/parser/__init__.py +0 -14
- mindspore/profiler/parser/aicpu_data_parser.py +0 -272
- mindspore/profiler/parser/ascend_analysis/__init__.py +0 -14
- mindspore/profiler/parser/ascend_analysis/constant.py +0 -71
- mindspore/profiler/parser/ascend_analysis/file_manager.py +0 -180
- mindspore/profiler/parser/ascend_analysis/function_event.py +0 -185
- mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +0 -136
- mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +0 -131
- mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +0 -104
- mindspore/profiler/parser/ascend_analysis/path_manager.py +0 -313
- mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +0 -123
- mindspore/profiler/parser/ascend_analysis/tlv_decoder.py +0 -86
- mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +0 -75
- mindspore/profiler/parser/ascend_cluster_generator.py +0 -116
- mindspore/profiler/parser/ascend_communicate_generator.py +0 -314
- mindspore/profiler/parser/ascend_flops_generator.py +0 -116
- mindspore/profiler/parser/ascend_fpbp_generator.py +0 -82
- mindspore/profiler/parser/ascend_hccl_generator.py +0 -271
- mindspore/profiler/parser/ascend_integrate_generator.py +0 -42
- mindspore/profiler/parser/ascend_memory_generator.py +0 -185
- mindspore/profiler/parser/ascend_msprof_exporter.py +0 -282
- mindspore/profiler/parser/ascend_msprof_generator.py +0 -187
- mindspore/profiler/parser/ascend_op_generator.py +0 -334
- mindspore/profiler/parser/ascend_steptrace_generator.py +0 -94
- mindspore/profiler/parser/ascend_timeline_generator.py +0 -545
- mindspore/profiler/parser/base_timeline_generator.py +0 -483
- mindspore/profiler/parser/container.py +0 -229
- mindspore/profiler/parser/cpu_gpu_timeline_generator.py +0 -697
- mindspore/profiler/parser/flops_parser.py +0 -531
- mindspore/profiler/parser/framework_enum.py +0 -111
- mindspore/profiler/parser/framework_parser.py +0 -464
- mindspore/profiler/parser/framework_struct.py +0 -61
- mindspore/profiler/parser/gpu_analysis/__init__.py +0 -14
- mindspore/profiler/parser/gpu_analysis/function_event.py +0 -44
- mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +0 -89
- mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +0 -72
- mindspore/profiler/parser/hccl_parser.py +0 -573
- mindspore/profiler/parser/hwts_log_parser.py +0 -122
- mindspore/profiler/parser/integrator.py +0 -526
- mindspore/profiler/parser/memory_usage_parser.py +0 -277
- mindspore/profiler/parser/minddata_analyzer.py +0 -800
- mindspore/profiler/parser/minddata_parser.py +0 -186
- mindspore/profiler/parser/minddata_pipeline_parser.py +0 -299
- mindspore/profiler/parser/op_intermediate_parser.py +0 -149
- mindspore/profiler/parser/optime_parser.py +0 -250
- mindspore/profiler/parser/profiler_info.py +0 -213
- mindspore/profiler/parser/step_trace_parser.py +0 -666
- mindspore/utils/hooks.py +0 -81
- /mindspore/common/{_auto_dynamic.py → dynamic_shape/_auto_dynamic.py} +0 -0
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0.dist-info}/WHEEL +0 -0
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0.dist-info}/entry_points.txt +0 -0
- {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0.dist-info}/top_level.txt +0 -0
|
@@ -1,14 +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
|
-
# ============================================================================
|
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
# Copyright 2020-2021 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
|
-
"""
|
|
16
|
-
The parser for AI CPU preprocess data.
|
|
17
|
-
"""
|
|
18
|
-
import os
|
|
19
|
-
import stat
|
|
20
|
-
from collections import namedtuple
|
|
21
|
-
import struct
|
|
22
|
-
|
|
23
|
-
from mindspore.profiler.common.util import fwrite_format, get_file_join_name
|
|
24
|
-
from mindspore import log as logger
|
|
25
|
-
from mindspore.profiler.common.struct_type import StructType
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class DataPreProcessParser:
|
|
29
|
-
"""
|
|
30
|
-
The Parser for AI CPU preprocess data.
|
|
31
|
-
|
|
32
|
-
Args:
|
|
33
|
-
input_path(str): The profiling job path.
|
|
34
|
-
output_filename(str): The output data path and name.
|
|
35
|
-
|
|
36
|
-
"""
|
|
37
|
-
AI_CPU_STRUCT = dict(
|
|
38
|
-
magic_number=StructType.UINT16,
|
|
39
|
-
data_tag=StructType.UINT16,
|
|
40
|
-
stream_id=StructType.UINT16,
|
|
41
|
-
task_id=StructType.UINT16,
|
|
42
|
-
run_start=StructType.UINT64,
|
|
43
|
-
run_start_counter=StructType.UINT64,
|
|
44
|
-
|
|
45
|
-
compute_start=StructType.UINT64,
|
|
46
|
-
memcpy_start=StructType.UINT64,
|
|
47
|
-
memcpy_end=StructType.UINT64,
|
|
48
|
-
run_end=StructType.UINT64,
|
|
49
|
-
run_end_counter=StructType.UINT64,
|
|
50
|
-
thread=StructType.UINT32,
|
|
51
|
-
|
|
52
|
-
device=StructType.UINT32,
|
|
53
|
-
submit_tick=StructType.UINT64,
|
|
54
|
-
schedule_tick=StructType.UINT64,
|
|
55
|
-
tick_before_run=StructType.UINT64,
|
|
56
|
-
tick_after_fun=StructType.UINT64,
|
|
57
|
-
kernel_type=StructType.UINT32,
|
|
58
|
-
|
|
59
|
-
dispatch_time=StructType.UINT32,
|
|
60
|
-
total_time=StructType.UINT32,
|
|
61
|
-
FFTS_thread_id=StructType.UINT16,
|
|
62
|
-
version=StructType.UINT8
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
AiCpuStruct = namedtuple(
|
|
66
|
-
'AiCpuStruct', ['magic_number', 'data_tag', 'stream_id', 'task_id', 'run_start', 'run_start_counter',
|
|
67
|
-
'compute_start', 'memcpy_start', 'memcpy_end', 'run_end', 'run_end_counter', 'thread',
|
|
68
|
-
'device', 'submit_tick', 'schedule_tick', 'tick_before_run', 'tick_after_fun', 'kernel_type',
|
|
69
|
-
'dispatch_time', 'total_time', 'FFTS_thread_id', 'version']
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
_source_file_target_old = 'DATA_PREPROCESS.dev.AICPU.'
|
|
73
|
-
_source_file_target = 'DATA_PREPROCESS.AICPU.'
|
|
74
|
-
_dst_file_title = 'title:DATA_PREPROCESS AICPU'
|
|
75
|
-
_dst_file_column_title = [
|
|
76
|
-
'serial_number', 'node_type_name', 'total_time(ms)',
|
|
77
|
-
'dispatch_time(ms)', 'execution_time(ms)', 'run_start',
|
|
78
|
-
'run_end'
|
|
79
|
-
]
|
|
80
|
-
_ms_unit = 1000
|
|
81
|
-
_us_unit = 100 # Convert 10ns to 1us.
|
|
82
|
-
_task_id_threshold = 65536
|
|
83
|
-
|
|
84
|
-
def __init__(self, input_path, output_filename, op_task_dict):
|
|
85
|
-
self._input_path = input_path
|
|
86
|
-
self._output_filename = output_filename
|
|
87
|
-
self._source_file_name = self._get_source_file()
|
|
88
|
-
self._ms_kernel_flag = 3
|
|
89
|
-
self._other_kernel_flag = 6
|
|
90
|
-
self._ms_kernel_run_end_index = 2
|
|
91
|
-
self._other_kernel_run_end_index = 5
|
|
92
|
-
self._dispatch_time_index = 5
|
|
93
|
-
self._total_time_index = 6
|
|
94
|
-
self._result_list = []
|
|
95
|
-
self._min_cycle_counter = float('inf')
|
|
96
|
-
self._ai_cpu_len = 128
|
|
97
|
-
self._op_task_dict = op_task_dict
|
|
98
|
-
|
|
99
|
-
@property
|
|
100
|
-
def min_cycle_counter(self):
|
|
101
|
-
"""Get minimum cycle counter in AI CPU."""
|
|
102
|
-
return self._min_cycle_counter
|
|
103
|
-
|
|
104
|
-
def execute(self):
|
|
105
|
-
"""Execute the parser, get result data, and write it to the output file."""
|
|
106
|
-
|
|
107
|
-
if not os.path.exists(self._source_file_name):
|
|
108
|
-
logger.info("Did not find the aicpu profiling source file")
|
|
109
|
-
return
|
|
110
|
-
|
|
111
|
-
with open(self._source_file_name, 'rb') as ai_cpu_data:
|
|
112
|
-
content = ai_cpu_data.read()
|
|
113
|
-
if content[0:2].hex().upper() == "5A5A":
|
|
114
|
-
ai_cpu_total_time_summary, result_list = self.parser_binary_file(content)
|
|
115
|
-
else:
|
|
116
|
-
ai_cpu_total_time_summary, result_list = self.parser_txt_file(content)
|
|
117
|
-
|
|
118
|
-
os.chmod(self._source_file_name, stat.S_IREAD)
|
|
119
|
-
|
|
120
|
-
if result_list:
|
|
121
|
-
ai_cpu_total_time = format(ai_cpu_total_time_summary, '.6f')
|
|
122
|
-
result_list.append(["AI CPU Total Time(ms):", ai_cpu_total_time])
|
|
123
|
-
fwrite_format(self._output_filename, " ".join(self._dst_file_column_title), is_start=True, is_print=True)
|
|
124
|
-
fwrite_format(self._output_filename, result_list, is_print=True)
|
|
125
|
-
|
|
126
|
-
# For timeline display.
|
|
127
|
-
self._result_list = result_list
|
|
128
|
-
|
|
129
|
-
def parser_binary_file(self, content):
|
|
130
|
-
"""Parse binary format file."""
|
|
131
|
-
result_list = list()
|
|
132
|
-
ai_cpu_total_time_summary = 0
|
|
133
|
-
# Node serial number.
|
|
134
|
-
serial_number = 1
|
|
135
|
-
|
|
136
|
-
i = 0
|
|
137
|
-
ai_cpu_format = StructType.format(DataPreProcessParser.AI_CPU_STRUCT.values())
|
|
138
|
-
ai_cpu_size = StructType.sizeof(DataPreProcessParser.AI_CPU_STRUCT.values())
|
|
139
|
-
while i < len(content):
|
|
140
|
-
ai_cpu_data = struct.unpack(ai_cpu_format, content[i:i + ai_cpu_size])
|
|
141
|
-
ai_cpu = DataPreProcessParser.AiCpuStruct(*ai_cpu_data)
|
|
142
|
-
if ai_cpu.task_id < self._task_id_threshold:
|
|
143
|
-
node_type_name = f'{ai_cpu.stream_id}_{ai_cpu.task_id}'
|
|
144
|
-
if self._op_task_dict and node_type_name in self._op_task_dict:
|
|
145
|
-
node_type_name = self._op_task_dict[node_type_name].split('/')[-1]
|
|
146
|
-
else:
|
|
147
|
-
logger.warning("[profiler] the op name of %s cannot be found.", node_type_name)
|
|
148
|
-
exe_time = (float(ai_cpu.run_end) - float(ai_cpu.run_start)) / self._ms_unit
|
|
149
|
-
total_time = ai_cpu.total_time / self._ms_unit
|
|
150
|
-
result_list.append([serial_number, node_type_name, total_time, ai_cpu.dispatch_time / self._ms_unit,
|
|
151
|
-
exe_time, ai_cpu.run_start_counter / self._us_unit,
|
|
152
|
-
ai_cpu.run_end_counter / self._us_unit])
|
|
153
|
-
|
|
154
|
-
ai_cpu_total_time_summary += total_time
|
|
155
|
-
# Increase node serial number.
|
|
156
|
-
serial_number += 1
|
|
157
|
-
|
|
158
|
-
i = i + self._ai_cpu_len
|
|
159
|
-
|
|
160
|
-
return ai_cpu_total_time_summary, result_list
|
|
161
|
-
|
|
162
|
-
def parser_txt_file(self, content):
|
|
163
|
-
"""Parse txt format file."""
|
|
164
|
-
ai_cpu_str = str(content.replace(b'\n\x00', b' ___ ').replace(b'\x00', b' ___ '))[2:-1]
|
|
165
|
-
ai_cpu_lines = ai_cpu_str.split(" ___ ")
|
|
166
|
-
result_list = list()
|
|
167
|
-
ai_cpu_total_time_summary = 0
|
|
168
|
-
# Node serial number.
|
|
169
|
-
serial_number = 1
|
|
170
|
-
for i in range(len(ai_cpu_lines) - 1):
|
|
171
|
-
node_line = ai_cpu_lines[i]
|
|
172
|
-
thread_line = ai_cpu_lines[i + 1]
|
|
173
|
-
if "Node" in node_line and "Thread" in thread_line:
|
|
174
|
-
# Get the node data from node_line
|
|
175
|
-
result = self._get_kernel_result(
|
|
176
|
-
serial_number,
|
|
177
|
-
node_line.split(','),
|
|
178
|
-
thread_line.split(',')
|
|
179
|
-
)
|
|
180
|
-
|
|
181
|
-
if result is None:
|
|
182
|
-
continue
|
|
183
|
-
|
|
184
|
-
result_list.append(result)
|
|
185
|
-
# Calculate the total time.
|
|
186
|
-
total_time = result[2]
|
|
187
|
-
ai_cpu_total_time_summary += total_time
|
|
188
|
-
# Increase node serial number.
|
|
189
|
-
serial_number += 1
|
|
190
|
-
elif "Node" in node_line and "Thread" not in thread_line:
|
|
191
|
-
node_type_name = node_line.split(',')[0].split(':')[-1]
|
|
192
|
-
logger.warning("The node type:%s cannot find thread data", node_type_name)
|
|
193
|
-
return ai_cpu_total_time_summary, result_list
|
|
194
|
-
|
|
195
|
-
def query_aicpu_data(self):
|
|
196
|
-
"""
|
|
197
|
-
Get execution time of AI CPU operator.
|
|
198
|
-
|
|
199
|
-
Returns:
|
|
200
|
-
a dict, the metadata of AI CPU operator execution time.
|
|
201
|
-
"""
|
|
202
|
-
stream_id = 0 # Default stream id for AI CPU.
|
|
203
|
-
pid = 9000 # Default pid for AI CPU.
|
|
204
|
-
total_time = 0
|
|
205
|
-
min_cycle_counter = float('inf')
|
|
206
|
-
aicpu_info = []
|
|
207
|
-
op_count_list = []
|
|
208
|
-
for aicpu_item in self._result_list:
|
|
209
|
-
if "AI CPU Total Time(ms):" in aicpu_item:
|
|
210
|
-
total_time = aicpu_item[-1]
|
|
211
|
-
continue
|
|
212
|
-
|
|
213
|
-
op_name = aicpu_item[1]
|
|
214
|
-
start_time = float(aicpu_item[5]) / self._ms_unit
|
|
215
|
-
min_cycle_counter = min(min_cycle_counter, start_time)
|
|
216
|
-
duration = aicpu_item[4]
|
|
217
|
-
aicpu_info.append([op_name, stream_id, start_time, duration, pid])
|
|
218
|
-
|
|
219
|
-
# Record the number of operator types.
|
|
220
|
-
if op_name not in op_count_list:
|
|
221
|
-
op_count_list.append(op_name)
|
|
222
|
-
|
|
223
|
-
self._min_cycle_counter = min_cycle_counter
|
|
224
|
-
aicpu_dict = {
|
|
225
|
-
'info': aicpu_info,
|
|
226
|
-
'total_time': float(total_time),
|
|
227
|
-
'op_exe_times': len(aicpu_info),
|
|
228
|
-
'num_of_ops': len(op_count_list),
|
|
229
|
-
'num_of_streams': 1
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
return aicpu_dict
|
|
233
|
-
|
|
234
|
-
def _get_source_file(self):
|
|
235
|
-
"""Get log file name, which was created by ada service."""
|
|
236
|
-
file_name = get_file_join_name(self._input_path, self._source_file_target)
|
|
237
|
-
if not file_name:
|
|
238
|
-
file_name = get_file_join_name(self._input_path, self._source_file_target_old)
|
|
239
|
-
if not file_name:
|
|
240
|
-
data_path = os.path.join(self._input_path, "data")
|
|
241
|
-
file_name = get_file_join_name(data_path, self._source_file_target)
|
|
242
|
-
if not file_name:
|
|
243
|
-
file_name = get_file_join_name(data_path, self._source_file_target_old)
|
|
244
|
-
return file_name
|
|
245
|
-
|
|
246
|
-
def _get_kernel_result(self, number, node_list, thread_list):
|
|
247
|
-
"""Get the profiling data form different aicpu kernel"""
|
|
248
|
-
try:
|
|
249
|
-
if len(node_list) == self._ms_kernel_flag:
|
|
250
|
-
node_type_name = node_list[0].split(':')[-1]
|
|
251
|
-
run_end_index = self._ms_kernel_run_end_index
|
|
252
|
-
elif len(node_list) == self._other_kernel_flag:
|
|
253
|
-
node_type_name = node_list[0].split(':')[-1].split('/')[-1].split('-')[0]
|
|
254
|
-
run_end_index = self._other_kernel_run_end_index
|
|
255
|
-
else:
|
|
256
|
-
logger.warning("the data format can't support 'node_list':%s", str(node_list))
|
|
257
|
-
return None
|
|
258
|
-
|
|
259
|
-
us_unit = 100 # Convert 10ns to 1us.
|
|
260
|
-
run_start_counter = float(node_list[1].split(':')[-1].split(' ')[1]) / us_unit
|
|
261
|
-
run_end_counter = float(node_list[run_end_index].split(':')[-1].split(' ')[1]) / us_unit
|
|
262
|
-
run_start = node_list[1].split(':')[-1].split(' ')[0]
|
|
263
|
-
run_end = node_list[run_end_index].split(':')[-1].split(' ')[0]
|
|
264
|
-
exe_time = (float(run_end) - float(run_start)) / self._ms_unit
|
|
265
|
-
total_time = float(thread_list[self._total_time_index].split('=')[-1].split()[0]) / self._ms_unit
|
|
266
|
-
dispatch_time = float(thread_list[self._dispatch_time_index].split('=')[-1].split()[0]) / self._ms_unit
|
|
267
|
-
|
|
268
|
-
return [number, node_type_name, total_time, dispatch_time, exe_time,
|
|
269
|
-
run_start_counter, run_end_counter]
|
|
270
|
-
except IndexError as e:
|
|
271
|
-
logger.error(e)
|
|
272
|
-
return None
|
|
@@ -1,14 +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
|
-
# ============================================================================
|
|
@@ -1,71 +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
|
-
"""Constant value for ascend profiling parser."""
|
|
16
|
-
import os
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class Constant:
|
|
20
|
-
"""Constant values"""
|
|
21
|
-
|
|
22
|
-
HOST_TO_DEVICE = "HostToDevice"
|
|
23
|
-
START_FLOW = "s"
|
|
24
|
-
END_FLOW = "f"
|
|
25
|
-
META_EVENT = 'M'
|
|
26
|
-
COMPLETE_EVENT = 'X'
|
|
27
|
-
FLOW_OP = "flow"
|
|
28
|
-
INVALID_FLOW_ID = 18446744073709551615
|
|
29
|
-
DEFAULT_PROCESS_NUMBER = os.cpu_count() // 2
|
|
30
|
-
|
|
31
|
-
# file authority
|
|
32
|
-
MAX_FILE_SIZE = 1024 * 1024 * 1024 * 10
|
|
33
|
-
MAX_CSV_SIZE = 1024 * 1024 * 1024 * 5
|
|
34
|
-
|
|
35
|
-
# tlv constant struct
|
|
36
|
-
FIX_SIZE_BYTES = "fix_size_bytes"
|
|
37
|
-
NS_TO_US = 1e-3
|
|
38
|
-
|
|
39
|
-
# field name
|
|
40
|
-
SEQUENCE_UNMBER = "Sequence number"
|
|
41
|
-
FORWORD_THREAD_ID = "Fwd thread id"
|
|
42
|
-
OP_NAME = "op_name"
|
|
43
|
-
INPUT_SHAPES = "Input Dims"
|
|
44
|
-
INPUT_DTYPES = "Input type"
|
|
45
|
-
CALL_STACK = "Call stack"
|
|
46
|
-
MODULE_HIERARCHY = "Module Hierarchy"
|
|
47
|
-
FLOPS = "flops"
|
|
48
|
-
NAME = "name"
|
|
49
|
-
CUSTOM_INFO = "custom_info"
|
|
50
|
-
|
|
51
|
-
# trace constant
|
|
52
|
-
PROCESS_NAME = "process_name"
|
|
53
|
-
PROCESS_LABEL = "process_labels"
|
|
54
|
-
PROCESS_SORT = "process_sort_index"
|
|
55
|
-
THREAD_NAME = "thread_name"
|
|
56
|
-
THREAD_SORT = "thread_sort_index"
|
|
57
|
-
|
|
58
|
-
# dir name
|
|
59
|
-
FRAMEWORK_DIR = "FRAMEWORK"
|
|
60
|
-
PROFILER_DIR = "profiler"
|
|
61
|
-
TOP_SCOPE_NAMES = ('Default', 'Gradients', 'recompute_Default')
|
|
62
|
-
|
|
63
|
-
# the index of modules of timeline
|
|
64
|
-
MINDSPORE = 1
|
|
65
|
-
CPU_OP = 2
|
|
66
|
-
CANN = 3
|
|
67
|
-
SCOPE_LAYLER = 4
|
|
68
|
-
ASCEND_HARDWARE = 5
|
|
69
|
-
HCCL = 6
|
|
70
|
-
OVERLAP = 7
|
|
71
|
-
OTHERWISE = 8
|
|
@@ -1,180 +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 file manager"""
|
|
16
|
-
import csv
|
|
17
|
-
import json
|
|
18
|
-
import os.path
|
|
19
|
-
from typing import List, Dict, Optional
|
|
20
|
-
|
|
21
|
-
from mindspore import log as logger
|
|
22
|
-
from mindspore.profiler.common.validator.validate_path import validate_and_normalize_path
|
|
23
|
-
from mindspore.profiler.parser.ascend_analysis.constant import Constant
|
|
24
|
-
from mindspore.profiler.parser.ascend_analysis.path_manager import PathManager
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
class FileManager:
|
|
28
|
-
"""Profiler file manager"""
|
|
29
|
-
|
|
30
|
-
MAX_PATH_LENGTH = 4096
|
|
31
|
-
MAX_FILE_NAME_LENGTH = 255
|
|
32
|
-
DATA_FILE_AUTHORITY = 0o640
|
|
33
|
-
DATA_DIR_AUTHORITY = 0o700
|
|
34
|
-
|
|
35
|
-
@classmethod
|
|
36
|
-
def read_file_content(cls, path: str, mode: str = "r"):
|
|
37
|
-
"""Read the content in the input file."""
|
|
38
|
-
if not os.access(path, os.R_OK):
|
|
39
|
-
msg = f"The file {os.path.basename(path)} is not readable!"
|
|
40
|
-
raise RuntimeError(msg)
|
|
41
|
-
|
|
42
|
-
if not os.path.isfile(path):
|
|
43
|
-
raise RuntimeError(f"The file {os.path.basename(path)} is invalid!")
|
|
44
|
-
file_size = os.path.getsize(path)
|
|
45
|
-
if file_size <= 0:
|
|
46
|
-
return ""
|
|
47
|
-
if file_size > Constant.MAX_FILE_SIZE:
|
|
48
|
-
msg = f"File too large file to read: {path}"
|
|
49
|
-
logger.warning(msg)
|
|
50
|
-
return ''
|
|
51
|
-
try:
|
|
52
|
-
with open(path, mode) as file:
|
|
53
|
-
return file.read()
|
|
54
|
-
except Exception as err:
|
|
55
|
-
raise RuntimeError(f"Failed to read file: {path}") from err
|
|
56
|
-
|
|
57
|
-
@classmethod
|
|
58
|
-
def make_dir_safety(cls, dir_path: str):
|
|
59
|
-
"""Make directory with least authority"""
|
|
60
|
-
dir_path = validate_and_normalize_path(dir_path)
|
|
61
|
-
|
|
62
|
-
if os.path.exists(dir_path):
|
|
63
|
-
return
|
|
64
|
-
try:
|
|
65
|
-
os.makedirs(dir_path, mode=cls.DATA_DIR_AUTHORITY, exist_ok=True)
|
|
66
|
-
except Exception as err:
|
|
67
|
-
msg = f"Failed to make directory: {dir_path}"
|
|
68
|
-
raise RuntimeError(msg) from err
|
|
69
|
-
|
|
70
|
-
@classmethod
|
|
71
|
-
def read_json_file(cls, file_path: str) -> Optional[Dict]:
|
|
72
|
-
"""Read json file and return dict data"""
|
|
73
|
-
if not os.path.isfile(file_path):
|
|
74
|
-
return {}
|
|
75
|
-
file_size = os.path.getsize(file_path)
|
|
76
|
-
if file_size <= 0:
|
|
77
|
-
return {}
|
|
78
|
-
if file_size > Constant.MAX_FILE_SIZE:
|
|
79
|
-
msg = f"The file size exceeds the preset value, please check the file: {file_path}"
|
|
80
|
-
logger.warning(msg)
|
|
81
|
-
return {}
|
|
82
|
-
try:
|
|
83
|
-
PathManager.check_directory_path_readable(file_path)
|
|
84
|
-
with open(file_path, 'r', encoding='utf-8') as json_file:
|
|
85
|
-
data = json.load(json_file)
|
|
86
|
-
return data
|
|
87
|
-
except Exception as err:
|
|
88
|
-
raise RuntimeError(f"Failed to read the file: {file_path}") from err
|
|
89
|
-
|
|
90
|
-
@classmethod
|
|
91
|
-
def create_json_file(cls, output_path: str, json_data: List, file_name: str, indent: int = None) -> None:
|
|
92
|
-
"""Create json file with least authority"""
|
|
93
|
-
if not json_data:
|
|
94
|
-
return
|
|
95
|
-
cls.make_dir_safety(output_path)
|
|
96
|
-
file_path = os.path.join(output_path, file_name)
|
|
97
|
-
flags = os.O_WRONLY | os.O_CREAT | os.O_TRUNC
|
|
98
|
-
with os.fdopen(os.open(file_path, flags, cls.DATA_FILE_AUTHORITY), 'w') as fp:
|
|
99
|
-
json.dump(json_data, fp, ensure_ascii=False, indent=indent)
|
|
100
|
-
|
|
101
|
-
@classmethod
|
|
102
|
-
def read_csv_file(cls, file_path: str) -> list:
|
|
103
|
-
"""Read csv file and return list"""
|
|
104
|
-
if not os.path.isfile(file_path):
|
|
105
|
-
return []
|
|
106
|
-
file_size = os.path.getsize(file_path)
|
|
107
|
-
if file_size <= 0:
|
|
108
|
-
return []
|
|
109
|
-
if file_size > Constant.MAX_CSV_SIZE:
|
|
110
|
-
msg = f"The file size exceeds the preset value, please check the file: {file_path}"
|
|
111
|
-
logger.warning(msg)
|
|
112
|
-
return []
|
|
113
|
-
result_data = []
|
|
114
|
-
try:
|
|
115
|
-
with open(file_path, newline="") as csv_file:
|
|
116
|
-
reader = csv.reader(csv_file)
|
|
117
|
-
for row in reader:
|
|
118
|
-
result_data.append(row)
|
|
119
|
-
except Exception as err:
|
|
120
|
-
raise RuntimeError(f"Failed to read the file: {file_path}") from err
|
|
121
|
-
return result_data
|
|
122
|
-
|
|
123
|
-
@classmethod
|
|
124
|
-
def create_csv_file(cls, file_path: str, data: list, headers: list = None) -> None:
|
|
125
|
-
"""Create csv file and write the data"""
|
|
126
|
-
if not data:
|
|
127
|
-
return
|
|
128
|
-
try:
|
|
129
|
-
with os.fdopen(os.open(file_path, os.O_WRONLY | os.O_CREAT, 0o600),
|
|
130
|
-
'w', newline="") as file:
|
|
131
|
-
writer = csv.writer(file)
|
|
132
|
-
if headers:
|
|
133
|
-
writer.writerow(headers)
|
|
134
|
-
writer.writerows(data)
|
|
135
|
-
except Exception as err:
|
|
136
|
-
raise RuntimeError(f"Can't create file: {file_path}") from err
|
|
137
|
-
|
|
138
|
-
@classmethod
|
|
139
|
-
def combine_csv_file(cls, source_file_list: list, target_file_path: str, header_map: dict = None):
|
|
140
|
-
"""Merge multiple CSV files into one"""
|
|
141
|
-
headers, all_data = [], []
|
|
142
|
-
for source_file in source_file_list:
|
|
143
|
-
data = cls.read_csv_file(source_file)
|
|
144
|
-
if len(data) > 1:
|
|
145
|
-
headers = data[0]
|
|
146
|
-
all_data.extend(data[1:])
|
|
147
|
-
if all_data:
|
|
148
|
-
if isinstance(header_map, dict):
|
|
149
|
-
headers = [header_map.get(header, header) for header in headers]
|
|
150
|
-
FileManager.create_csv_file(target_file_path, all_data, headers)
|
|
151
|
-
|
|
152
|
-
@classmethod
|
|
153
|
-
def get_csv_file_list_by_start_name(cls, source_path: str, start_name: str):
|
|
154
|
-
"""Get all the csv files that match the name"""
|
|
155
|
-
file_list = []
|
|
156
|
-
for file_name in os.listdir(source_path):
|
|
157
|
-
if file_name.startswith(start_name) and file_name.endswith(".csv"):
|
|
158
|
-
file_list.append(os.path.join(source_path, file_name))
|
|
159
|
-
return file_list
|
|
160
|
-
|
|
161
|
-
@classmethod
|
|
162
|
-
def read_txt_file(cls, file_path: str) -> list:
|
|
163
|
-
"""Read txt file and return list"""
|
|
164
|
-
if not os.path.isfile(file_path):
|
|
165
|
-
return []
|
|
166
|
-
file_size = os.path.getsize(file_path)
|
|
167
|
-
if file_size <= 0:
|
|
168
|
-
return []
|
|
169
|
-
if file_size > Constant.MAX_FILE_SIZE:
|
|
170
|
-
msg = f"The file size exceeds the preset value, please check the file: {file_path}"
|
|
171
|
-
logger.warning(msg)
|
|
172
|
-
return []
|
|
173
|
-
result_data = []
|
|
174
|
-
try:
|
|
175
|
-
with open(file_path, "r") as file:
|
|
176
|
-
for line in file.readlines():
|
|
177
|
-
result_data.append(line.strip().split(","))
|
|
178
|
-
except Exception as err:
|
|
179
|
-
raise RuntimeError(f"Failed to read the file: {file_path}") from err
|
|
180
|
-
return result_data
|