mindspore 2.6.0__cp310-cp310-win_amd64.whl → 2.7.0__cp310-cp310-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.cp310-win_amd64.pyd +0 -0
- mindspore/_c_expression.cp310-win_amd64.pyd +0 -0
- mindspore/_c_mindrecord.cp310-win_amd64.pyd +0 -0
- mindspore/_checkparam.py +42 -11
- mindspore/_extends/builtin_operations.py +3 -3
- mindspore/{_deprecated → _extends/optimize}/__init__.py +9 -3
- mindspore/_extends/optimize/cell_utils.py +96 -0
- mindspore/_extends/parallel_compile/akg_compiler/custom.py +1109 -0
- mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +1 -1
- mindspore/_extends/parse/__init__.py +3 -3
- mindspore/_extends/parse/compile_config.py +44 -22
- mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +1 -2
- mindspore/_extends/parse/parser.py +64 -83
- mindspore/_extends/parse/resources.py +39 -0
- mindspore/_extends/parse/standard_method.py +47 -14
- mindspore/_extends/parse/trope.py +8 -1
- mindspore/_extends/pijit/__init__.py +1 -2
- mindspore/_extends/pijit/pijit_func_white_list.py +2 -5
- mindspore/amp.py +4 -22
- mindspore/atlprov.dll +0 -0
- mindspore/avcodec-59.dll +0 -0
- mindspore/avdevice-59.dll +0 -0
- mindspore/avfilter-8.dll +0 -0
- mindspore/avformat-59.dll +0 -0
- mindspore/avutil-57.dll +0 -0
- mindspore/boost/adasum.py +1 -1
- mindspore/boost/boost_cell_wrapper.py +4 -4
- mindspore/c1.dll +0 -0
- mindspore/c1xx.dll +0 -0
- mindspore/c2.dll +0 -0
- mindspore/common/__init__.py +43 -12
- mindspore/common/_grad_function.py +2 -1
- mindspore/common/_pijit_context.py +28 -7
- mindspore/common/_stub_tensor.py +1 -209
- mindspore/common/_tensor_cpp_method.py +1 -1
- mindspore/common/_tensor_docs.py +177 -52
- mindspore/common/_utils.py +9 -1
- mindspore/common/api.py +338 -208
- mindspore/common/dtype.py +108 -57
- mindspore/common/dump.py +11 -16
- mindspore/common/dynamic_shape/__init__.py +0 -0
- mindspore/common/{auto_dynamic_shape.py → dynamic_shape/auto_dynamic_shape.py} +17 -23
- mindspore/common/dynamic_shape/enable_dynamic.py +197 -0
- mindspore/common/file_system.py +59 -9
- mindspore/common/generator.py +2 -3
- mindspore/common/hook_handle.py +33 -5
- mindspore/common/jit_config.py +1 -1
- mindspore/common/jit_trace.py +84 -105
- mindspore/common/np_dtype.py +3 -3
- mindspore/common/parameter.py +27 -29
- mindspore/common/recompute.py +5 -7
- mindspore/common/sparse_tensor.py +0 -3
- mindspore/common/symbol.py +0 -1
- mindspore/common/tensor.py +84 -133
- mindspore/communication/_comm_helper.py +46 -4
- mindspore/communication/management.py +79 -7
- mindspore/context.py +47 -38
- mindspore/dataset/__init__.py +1 -1
- mindspore/dataset/audio/transforms.py +1 -1
- mindspore/dataset/core/config.py +38 -4
- mindspore/dataset/engine/datasets.py +350 -322
- mindspore/dataset/engine/datasets_user_defined.py +69 -23
- mindspore/dataset/engine/iterators.py +2 -2
- mindspore/dataset/engine/obs/config_loader.py +2 -2
- mindspore/dataset/engine/obs/obs_mindrecord_dataset.py +8 -0
- mindspore/dataset/transforms/c_transforms.py +2 -2
- mindspore/dataset/transforms/py_transforms.py +7 -3
- mindspore/dataset/transforms/transforms.py +10 -6
- mindspore/dataset/vision/__init__.py +1 -1
- mindspore/dataset/vision/py_transforms.py +8 -8
- mindspore/dataset/vision/transforms.py +17 -5
- mindspore/dataset/vision/utils.py +632 -21
- mindspore/dataset/vision/validators.py +1 -0
- mindspore/device_context/ascend/device.py +1 -1
- mindspore/device_context/ascend/op_tuning.py +35 -1
- mindspore/device_context/gpu/__init__.py +2 -2
- mindspore/device_context/gpu/device.py +1 -1
- mindspore/device_context/gpu/op_precision.py +4 -2
- mindspore/device_context/gpu/op_tuning.py +6 -3
- mindspore/device_manager.py +16 -9
- mindspore/dnnl.dll +0 -0
- mindspore/dpcmi.dll +0 -0
- mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +5 -4
- mindspore/experimental/llm_boost/atb/boost_base.py +2 -3
- mindspore/experimental/optim/adadelta.py +13 -20
- mindspore/experimental/optim/adagrad.py +15 -22
- mindspore/experimental/optim/adam.py +17 -24
- mindspore/experimental/optim/adamax.py +14 -22
- mindspore/experimental/optim/adamw.py +28 -34
- mindspore/experimental/optim/asgd.py +15 -25
- mindspore/experimental/optim/lr_scheduler.py +27 -45
- mindspore/experimental/optim/nadam.py +14 -24
- mindspore/experimental/optim/optimizer.py +13 -23
- mindspore/experimental/optim/radam.py +18 -24
- mindspore/experimental/optim/rmsprop.py +14 -25
- mindspore/experimental/optim/rprop.py +15 -26
- mindspore/experimental/optim/sgd.py +9 -19
- mindspore/hal/__init__.py +4 -4
- mindspore/hal/contiguous_tensors_handle.py +2 -2
- mindspore/hal/memory.py +1 -0
- mindspore/include/api/cell.h +65 -5
- mindspore/include/api/cfg.h +24 -7
- mindspore/include/api/context.h +1 -0
- mindspore/include/api/delegate.h +10 -2
- mindspore/include/api/dual_abi_helper.h +100 -19
- mindspore/include/api/graph.h +14 -1
- mindspore/include/api/kernel.h +16 -3
- mindspore/include/api/kernel_api.h +9 -1
- mindspore/include/api/metrics/accuracy.h +9 -0
- mindspore/include/api/model.h +8 -1
- mindspore/include/api/model_group.h +4 -0
- mindspore/include/api/model_parallel_runner.h +2 -0
- mindspore/include/api/status.h +48 -10
- mindspore/include/api/types.h +8 -3
- mindspore/include/c_api/model_c.h +0 -58
- mindspore/include/c_api/tensor_c.h +0 -26
- mindspore/include/dataset/constants.h +9 -0
- mindspore/include/dataset/vision_ascend.h +1 -1
- mindspore/jpeg62.dll +0 -0
- mindspore/mindrecord/tools/cifar10.py +61 -11
- mindspore/mindrecord/tools/cifar10_to_mr.py +5 -0
- mindspore/mindspore_backend_common.dll +0 -0
- mindspore/mindspore_backend_manager.dll +0 -0
- mindspore/mindspore_common.dll +0 -0
- mindspore/mindspore_core.dll +0 -0
- mindspore/mindspore_cpu_res_manager.dll +0 -0
- mindspore/mindspore_dump.dll +0 -0
- mindspore/mindspore_frontend.dll +0 -0
- mindspore/mindspore_glog.dll +0 -0
- mindspore/mindspore_memory_pool.dll +0 -0
- mindspore/mindspore_ms_backend.dll +0 -0
- mindspore/mindspore_ops.dll +0 -0
- mindspore/mindspore_ops_host.dll +0 -0
- mindspore/mindspore_ops_kernel_common.dll +0 -0
- mindspore/mindspore_profiler.dll +0 -0
- mindspore/mindspore_pyboost.dll +0 -0
- mindspore/mindspore_pynative.dll +0 -0
- mindspore/mindspore_res_manager.dll +0 -0
- mindspore/mindspore_runtime_pipeline.dll +0 -0
- mindspore/mint/__init__.py +4 -44
- mindspore/mint/distributed/__init__.py +5 -0
- mindspore/mint/distributed/distributed.py +425 -19
- mindspore/mint/nn/__init__.py +1 -1
- mindspore/mint/nn/functional.py +53 -6
- mindspore/mint/nn/layer/_functions.py +163 -294
- mindspore/mint/nn/layer/activation.py +8 -6
- mindspore/mint/nn/layer/conv.py +125 -101
- mindspore/mint/nn/layer/normalization.py +11 -25
- mindspore/mint/optim/adam.py +19 -18
- mindspore/mint/optim/adamw.py +14 -8
- mindspore/mint/optim/sgd.py +5 -5
- mindspore/msobj140.dll +0 -0
- mindspore/mspdb140.dll +0 -0
- mindspore/mspdbcore.dll +0 -0
- mindspore/mspdbst.dll +0 -0
- mindspore/mspft140.dll +0 -0
- mindspore/msvcdis140.dll +0 -0
- mindspore/msvcp140_1.dll +0 -0
- mindspore/msvcp140_2.dll +0 -0
- mindspore/msvcp140_atomic_wait.dll +0 -0
- mindspore/msvcp140_codecvt_ids.dll +0 -0
- mindspore/nn/cell.py +488 -620
- mindspore/nn/grad/cell_grad.py +11 -12
- mindspore/nn/layer/activation.py +36 -36
- mindspore/nn/layer/basic.py +74 -77
- mindspore/nn/layer/channel_shuffle.py +4 -4
- mindspore/nn/layer/combined.py +4 -2
- mindspore/nn/layer/conv.py +86 -85
- mindspore/nn/layer/dense.py +9 -7
- mindspore/nn/layer/embedding.py +50 -52
- mindspore/nn/layer/image.py +38 -40
- mindspore/nn/layer/math.py +111 -112
- mindspore/nn/layer/normalization.py +56 -44
- mindspore/nn/layer/pooling.py +58 -63
- mindspore/nn/layer/rnn_cells.py +33 -33
- mindspore/nn/layer/rnns.py +56 -56
- mindspore/nn/layer/thor_layer.py +74 -73
- mindspore/nn/layer/transformer.py +11 -1
- mindspore/nn/learning_rate_schedule.py +20 -20
- mindspore/nn/loss/loss.py +79 -81
- mindspore/nn/optim/adam.py +2 -4
- mindspore/nn/optim/adasum.py +2 -2
- mindspore/nn/optim/lamb.py +1 -3
- mindspore/nn/optim/optimizer.py +1 -1
- mindspore/nn/optim/tft_wrapper.py +2 -3
- mindspore/nn/optim/thor.py +2 -2
- mindspore/nn/probability/distribution/_utils/utils.py +2 -2
- mindspore/nn/probability/distribution/exponential.py +2 -1
- mindspore/nn/probability/distribution/poisson.py +2 -1
- mindspore/nn/sparse/sparse.py +3 -3
- mindspore/nn/wrap/cell_wrapper.py +73 -42
- mindspore/nn/wrap/grad_reducer.py +37 -52
- mindspore/nn/wrap/loss_scale.py +72 -74
- mindspore/numpy/array_creations.py +7 -7
- mindspore/numpy/fft.py +1 -1
- mindspore/numpy/math_ops.py +1 -1
- mindspore/numpy/utils_const.py +1 -1
- mindspore/opencv_core452.dll +0 -0
- mindspore/opencv_imgcodecs452.dll +0 -0
- mindspore/opencv_imgproc452.dll +0 -0
- mindspore/ops/_grad_experimental/grad_comm_ops.py +51 -13
- mindspore/ops/_grad_experimental/grad_debug_ops.py +14 -0
- mindspore/ops/_grad_experimental/grad_inner_ops.py +0 -9
- mindspore/ops/_op_impl/cpu/__init__.py +1 -0
- mindspore/{experimental/es/__init__.py → ops/_op_impl/cpu/joinedstr_op.py} +12 -6
- mindspore/ops/_vmap/vmap_array_ops.py +6 -13
- mindspore/ops/_vmap/vmap_nn_ops.py +8 -16
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +29 -10
- mindspore/ops/auto_generate/gen_extend_func.py +5 -55
- mindspore/ops/auto_generate/gen_ops_def.py +753 -273
- mindspore/ops/auto_generate/gen_ops_prim.py +1687 -958
- mindspore/ops/auto_generate/pyboost_inner_prim.py +31 -1
- mindspore/ops/composite/__init__.py +10 -0
- mindspore/ops/composite/base.py +9 -5
- mindspore/ops/composite/multitype_ops/__init__.py +12 -1
- mindspore/ops/composite/multitype_ops/_compile_utils.py +132 -108
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -1
- mindspore/ops/composite/multitype_ops/add_impl.py +70 -2
- mindspore/ops/composite/multitype_ops/div_impl.py +49 -0
- mindspore/ops/composite/multitype_ops/floordiv_impl.py +29 -0
- mindspore/ops/composite/multitype_ops/getitem_impl.py +11 -0
- mindspore/ops/composite/multitype_ops/mod_impl.py +5 -3
- mindspore/ops/composite/multitype_ops/mul_impl.py +49 -0
- mindspore/ops/composite/multitype_ops/setitem_impl.py +57 -0
- mindspore/ops/composite/multitype_ops/sub_impl.py +34 -0
- mindspore/ops/composite/multitype_ops/zeros_like_impl.py +14 -0
- mindspore/ops/function/__init__.py +4 -1
- mindspore/ops/function/_add_attr_func.py +11 -6
- mindspore/ops/function/array_func.py +17 -100
- mindspore/ops/function/debug_func.py +8 -5
- mindspore/ops/function/grad/grad_func.py +5 -13
- mindspore/ops/function/math_func.py +65 -399
- mindspore/ops/function/nn_func.py +44 -61
- mindspore/ops/function/other_func.py +4 -1
- mindspore/ops/function/random_func.py +31 -4
- mindspore/ops/functional.py +2 -3
- mindspore/ops/functional_overload.py +486 -18
- mindspore/ops/op_info_register.py +21 -0
- mindspore/ops/operations/__init__.py +5 -2
- mindspore/ops/operations/_custom_ops_utils.py +675 -8
- mindspore/ops/operations/_inner_ops.py +14 -18
- mindspore/ops/operations/_sequence_ops.py +1 -1
- mindspore/ops/operations/array_ops.py +4 -50
- mindspore/ops/operations/comm_ops.py +186 -41
- mindspore/ops/operations/custom_ops.py +244 -175
- mindspore/ops/operations/debug_ops.py +55 -4
- mindspore/ops/operations/image_ops.py +13 -13
- mindspore/ops/operations/manually_defined/ops_def.py +27 -28
- mindspore/ops/operations/math_ops.py +8 -9
- mindspore/ops/operations/nn_ops.py +6 -7
- mindspore/ops/primitive.py +9 -20
- mindspore/ops/tensor_method.py +52 -11
- mindspore/ops_generate/api/cpp_create_prim_instance_helper_generator.py +1 -1
- mindspore/ops_generate/api/functional_map_cpp_generator.py +10 -9
- mindspore/ops_generate/api/functions_cc_generator.py +58 -10
- mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +1 -1
- mindspore/ops_generate/common/base_generator.py +14 -0
- mindspore/ops_generate/common/gen_constants.py +7 -2
- mindspore/ops_generate/common/gen_utils.py +0 -19
- mindspore/ops_generate/common/op_proto.py +11 -4
- mindspore/ops_generate/common/template.py +88 -11
- mindspore/ops_generate/gen_ops.py +1 -1
- mindspore/ops_generate/op_def/lite_ops_cpp_generator.py +4 -4
- mindspore/ops_generate/op_def/ops_name_h_generator.py +0 -3
- mindspore/ops_generate/op_def/ops_primitive_h_generator.py +0 -4
- mindspore/ops_generate/op_def_py/op_prim_py_generator.py +5 -2
- mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +49 -8
- mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +2 -2
- mindspore/ops_generate/pyboost/gen_pyboost_func.py +31 -16
- mindspore/ops_generate/pyboost/op_template_parser.py +98 -72
- mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +70 -273
- mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +14 -6
- mindspore/ops_generate/pyboost/pyboost_functions_impl_cpp_generator.py +316 -0
- mindspore/ops_generate/pyboost/pyboost_functions_py_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +5 -3
- mindspore/ops_generate/pyboost/pyboost_inner_prim_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_internal_functions_cpp_generator.py +76 -0
- mindspore/ops_generate/pyboost/pyboost_internal_functions_h_generator.py +76 -0
- mindspore/ops_generate/pyboost/pyboost_internal_kernel_info_adapter_generator.py +125 -0
- mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +4 -3
- mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +348 -61
- mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_utils.py +118 -9
- mindspore/ops_generate/tensor_py_cc_generator.py +1 -24
- mindspore/parallel/_auto_parallel_context.py +9 -17
- mindspore/parallel/_cell_wrapper.py +106 -40
- mindspore/parallel/_parallel_serialization.py +4 -3
- mindspore/parallel/_ps_context.py +4 -6
- mindspore/parallel/_tensor.py +167 -12
- mindspore/parallel/_transformer/moe.py +1 -1
- mindspore/parallel/_transformer/transformer.py +17 -12
- mindspore/parallel/_utils.py +5 -11
- mindspore/parallel/auto_parallel.py +33 -12
- mindspore/parallel/checkpoint_convert.py +3 -3
- mindspore/parallel/checkpoint_transform.py +5 -1
- mindspore/parallel/cluster/process_entity/_api.py +88 -49
- mindspore/parallel/cluster/process_entity/_utils.py +95 -7
- mindspore/parallel/cluster/run.py +48 -7
- mindspore/parallel/function/__init__.py +8 -1
- mindspore/parallel/function/reshard_func.py +7 -6
- mindspore/parallel/nn/__init__.py +15 -2
- mindspore/parallel/nn/parallel_cell_wrapper.py +50 -14
- mindspore/parallel/nn/parallel_grad_reducer.py +7 -14
- mindspore/parallel/shard.py +9 -23
- mindspore/parallel/transform_safetensors.py +468 -174
- mindspore/pgodb140.dll +0 -0
- mindspore/pgort140.dll +0 -0
- mindspore/profiler/__init__.py +2 -1
- mindspore/profiler/analysis/parser/timeline_assembly_factory/ascend_timeline_assembler.py +7 -7
- mindspore/profiler/analysis/parser/timeline_assembly_factory/base_timeline_assembler.py +3 -0
- mindspore/profiler/analysis/parser/timeline_assembly_factory/trace_view_container.py +3 -0
- mindspore/profiler/analysis/parser/timeline_creator/cpu_op_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_creator/fwk_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_creator/msprof_timeline_creator.py +4 -4
- mindspore/profiler/analysis/parser/timeline_creator/scope_layer_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_event/fwk_event.py +4 -1
- mindspore/profiler/analysis/parser/timeline_event/timeline_event_pool.py +2 -1
- mindspore/profiler/analysis/task_manager.py +1 -1
- mindspore/profiler/analysis/viewer/ascend_communication_viewer.py +5 -1
- mindspore/profiler/analysis/viewer/ascend_integrate_viewer.py +2 -1
- mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +10 -9
- mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +43 -23
- mindspore/profiler/analysis/viewer/ascend_step_trace_time_viewer.py +3 -2
- mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +9 -5
- mindspore/profiler/analysis/viewer/ms_operator_details_viewer.py +132 -0
- mindspore/profiler/common/constant.py +16 -0
- mindspore/profiler/common/msprof_cmd_tool.py +2 -2
- mindspore/profiler/common/path_manager.py +9 -0
- mindspore/profiler/common/profiler_context.py +50 -29
- mindspore/profiler/common/profiler_info.py +0 -16
- mindspore/profiler/common/profiler_meta_data.py +1 -0
- mindspore/profiler/common/profiler_op_analyse.py +239 -0
- mindspore/profiler/common/profiler_output_path.py +23 -8
- mindspore/profiler/common/profiler_parameters.py +128 -35
- mindspore/profiler/dynamic_profile/__init__.py +0 -0
- mindspore/profiler/dynamic_profile/dynamic_monitor_proxy.py +39 -0
- mindspore/profiler/dynamic_profile/dynamic_profiler_config_context.py +666 -0
- mindspore/profiler/dynamic_profile/dynamic_profiler_utils.py +62 -0
- mindspore/profiler/dynamic_profiler.py +374 -338
- mindspore/profiler/envprofiler.py +42 -12
- mindspore/profiler/experimental_config.py +112 -7
- mindspore/profiler/mstx.py +33 -12
- mindspore/profiler/platform/__init__.py +2 -3
- mindspore/profiler/platform/cpu_profiler.py +10 -4
- mindspore/profiler/platform/npu_profiler.py +30 -20
- mindspore/profiler/profiler.py +218 -154
- mindspore/profiler/profiler_action_controller.py +65 -77
- mindspore/profiler/profiler_interface.py +2 -2
- mindspore/profiler/schedule.py +10 -4
- mindspore/rewrite/common/config.py +1 -0
- mindspore/rewrite/common/namer.py +1 -0
- mindspore/rewrite/common/namespace.py +1 -0
- mindspore/rewrite/node/node.py +31 -11
- mindspore/rewrite/parsers/assign_parser.py +1 -1
- mindspore/rewrite/symbol_tree/symbol_tree.py +2 -2
- mindspore/run_check/_check_version.py +7 -10
- mindspore/runtime/__init__.py +8 -6
- mindspore/runtime/event.py +10 -4
- mindspore/runtime/executor.py +87 -45
- mindspore/runtime/memory.py +22 -30
- mindspore/runtime/thread_bind_core.py +299 -165
- mindspore/safeguard/rewrite_obfuscation.py +12 -13
- mindspore/swresample-4.dll +0 -0
- mindspore/swscale-6.dll +0 -0
- mindspore/tbbmalloc.dll +0 -0
- mindspore/tinyxml2.dll +0 -0
- mindspore/train/_utils.py +9 -5
- mindspore/train/amp.py +43 -23
- mindspore/train/callback/__init__.py +5 -5
- mindspore/train/callback/_callback.py +2 -1
- mindspore/train/callback/_checkpoint.py +4 -14
- mindspore/train/callback/_flops_collector.py +11 -7
- mindspore/train/callback/_landscape.py +0 -1
- mindspore/train/callback/_train_fault_tolerance.py +72 -18
- mindspore/train/data_sink.py +15 -6
- mindspore/train/dataset_helper.py +14 -5
- mindspore/train/model.py +49 -47
- mindspore/train/serialization.py +168 -126
- mindspore/train/summary/summary_record.py +13 -2
- mindspore/train/train_thor/model_thor.py +2 -2
- mindspore/turbojpeg.dll +0 -0
- mindspore/utils/__init__.py +3 -2
- mindspore/utils/dryrun.py +0 -6
- mindspore/utils/runtime_execution_order_check.py +162 -78
- mindspore/utils/sdc_detect.py +68 -0
- mindspore/utils/utils.py +14 -17
- mindspore/vcmeta.dll +0 -0
- mindspore/vcruntime140.dll +0 -0
- mindspore/vcruntime140_1.dll +0 -0
- mindspore/version.py +1 -1
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/METADATA +5 -4
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/RECORD +400 -439
- mindspore/_deprecated/jit.py +0 -198
- mindspore/_extends/remote/kernel_build_server_ascend.py +0 -75
- mindspore/communication/_hccl_management.py +0 -297
- mindspore/experimental/es/embedding_service.py +0 -891
- mindspore/experimental/es/embedding_service_layer.py +0 -581
- mindspore/profiler/common/validator/__init__.py +0 -14
- mindspore/profiler/common/validator/validate_path.py +0 -84
- mindspore/profiler/parser/__init__.py +0 -14
- mindspore/profiler/parser/aicpu_data_parser.py +0 -272
- mindspore/profiler/parser/ascend_analysis/__init__.py +0 -14
- mindspore/profiler/parser/ascend_analysis/constant.py +0 -71
- mindspore/profiler/parser/ascend_analysis/file_manager.py +0 -180
- mindspore/profiler/parser/ascend_analysis/function_event.py +0 -185
- mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +0 -136
- mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +0 -131
- mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +0 -104
- mindspore/profiler/parser/ascend_analysis/path_manager.py +0 -313
- mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +0 -123
- mindspore/profiler/parser/ascend_analysis/tlv_decoder.py +0 -86
- mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +0 -75
- mindspore/profiler/parser/ascend_cluster_generator.py +0 -116
- mindspore/profiler/parser/ascend_communicate_generator.py +0 -314
- mindspore/profiler/parser/ascend_flops_generator.py +0 -116
- mindspore/profiler/parser/ascend_fpbp_generator.py +0 -82
- mindspore/profiler/parser/ascend_hccl_generator.py +0 -271
- mindspore/profiler/parser/ascend_integrate_generator.py +0 -42
- mindspore/profiler/parser/ascend_memory_generator.py +0 -185
- mindspore/profiler/parser/ascend_msprof_exporter.py +0 -282
- mindspore/profiler/parser/ascend_msprof_generator.py +0 -187
- mindspore/profiler/parser/ascend_op_generator.py +0 -334
- mindspore/profiler/parser/ascend_steptrace_generator.py +0 -94
- mindspore/profiler/parser/ascend_timeline_generator.py +0 -545
- mindspore/profiler/parser/base_timeline_generator.py +0 -483
- mindspore/profiler/parser/container.py +0 -229
- mindspore/profiler/parser/cpu_gpu_timeline_generator.py +0 -697
- mindspore/profiler/parser/flops_parser.py +0 -531
- mindspore/profiler/parser/framework_enum.py +0 -111
- mindspore/profiler/parser/framework_parser.py +0 -464
- mindspore/profiler/parser/framework_struct.py +0 -61
- mindspore/profiler/parser/gpu_analysis/__init__.py +0 -14
- mindspore/profiler/parser/gpu_analysis/function_event.py +0 -44
- mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +0 -89
- mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +0 -72
- mindspore/profiler/parser/hccl_parser.py +0 -573
- mindspore/profiler/parser/hwts_log_parser.py +0 -122
- mindspore/profiler/parser/integrator.py +0 -526
- mindspore/profiler/parser/memory_usage_parser.py +0 -277
- mindspore/profiler/parser/minddata_analyzer.py +0 -800
- mindspore/profiler/parser/minddata_parser.py +0 -186
- mindspore/profiler/parser/minddata_pipeline_parser.py +0 -299
- mindspore/profiler/parser/op_intermediate_parser.py +0 -149
- mindspore/profiler/parser/optime_parser.py +0 -250
- mindspore/profiler/parser/profiler_info.py +0 -213
- mindspore/profiler/parser/step_trace_parser.py +0 -666
- mindspore/utils/hooks.py +0 -81
- /mindspore/common/{_auto_dynamic.py → dynamic_shape/_auto_dynamic.py} +0 -0
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/WHEEL +0 -0
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/entry_points.txt +0 -0
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/top_level.txt +0 -0
|
@@ -1,271 +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
|
-
"""hccl analyse model"""
|
|
16
|
-
import copy
|
|
17
|
-
import csv
|
|
18
|
-
import json
|
|
19
|
-
import logging
|
|
20
|
-
import os
|
|
21
|
-
import stat
|
|
22
|
-
import glob
|
|
23
|
-
|
|
24
|
-
import numpy as np
|
|
25
|
-
from mindspore.profiler.common.exceptions.exceptions import ProfilerIOException
|
|
26
|
-
from mindspore.profiler.common.util import get_newest_file
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class AscendHCCLGenerator:
|
|
30
|
-
"""Generate ascend hccl data from files."""
|
|
31
|
-
|
|
32
|
-
DEFAULT_MODEL_ID = 4294967295
|
|
33
|
-
|
|
34
|
-
def __init__(self, mindstudio_profiler_output, steptrace):
|
|
35
|
-
self.mindstudio_profiler_output = mindstudio_profiler_output
|
|
36
|
-
self.steptrace = steptrace
|
|
37
|
-
self.hccl_raw = []
|
|
38
|
-
self.hccl_data_df = np.dtype(
|
|
39
|
-
[('model_id', int), ('iteration_id', int), ('name', object), ('pid', int), ('tid', int), ('ts', float),
|
|
40
|
-
('te', float), ('dur', float), ('ph', object),
|
|
41
|
-
('task_type', object), ('link_info', object), ('transport_type', object), ('size', int), ('tag', object)])
|
|
42
|
-
|
|
43
|
-
@staticmethod
|
|
44
|
-
def _cost_analyse(iteration):
|
|
45
|
-
"""analyse communication cost and wait cost"""
|
|
46
|
-
communication_cost = np.sum(iteration[iteration['name'] != 'Notify_Wait']['dur'])
|
|
47
|
-
wait_cost = np.sum(iteration[iteration['name'] == 'Notify_Wait']['dur'])
|
|
48
|
-
return communication_cost, wait_cost
|
|
49
|
-
|
|
50
|
-
@staticmethod
|
|
51
|
-
def _rdma_analyse(groupby_transport):
|
|
52
|
-
"""rdma analyse"""
|
|
53
|
-
thread_groups = np.unique(groupby_transport['tid'])
|
|
54
|
-
thread_information = []
|
|
55
|
-
for thread_index in thread_groups:
|
|
56
|
-
groupby_thread = groupby_transport[groupby_transport['tid'] == thread_index]
|
|
57
|
-
rdma_communication_time = 0
|
|
58
|
-
rdma_communication_size = 0
|
|
59
|
-
rdma_communication_wait_time = 0
|
|
60
|
-
start_index = 0
|
|
61
|
-
end_index = groupby_thread.size - 2
|
|
62
|
-
while start_index < end_index:
|
|
63
|
-
first_task_type = groupby_thread[start_index]['task_type']
|
|
64
|
-
if first_task_type == 'RDMASend':
|
|
65
|
-
second_index = start_index + 1
|
|
66
|
-
third_index = start_index + 2
|
|
67
|
-
second_task_type = groupby_thread[second_index]['task_type']
|
|
68
|
-
third_task_type = groupby_thread[third_index]['task_type']
|
|
69
|
-
if second_task_type == 'RDMASend' and third_task_type == 'Notify Wait':
|
|
70
|
-
rdma_send_cost = groupby_thread[start_index]['dur']
|
|
71
|
-
notify_record_cost = groupby_thread[second_index]['dur']
|
|
72
|
-
notify_wait_cost = groupby_thread[third_index]['dur']
|
|
73
|
-
rdma_communication_time += rdma_send_cost + notify_record_cost + notify_wait_cost
|
|
74
|
-
rdma_communication_wait_time += notify_wait_cost
|
|
75
|
-
rdma_communication_size += groupby_thread[start_index]['size'] + groupby_thread[second_index][
|
|
76
|
-
'size']
|
|
77
|
-
start_index += 2
|
|
78
|
-
start_index += 1
|
|
79
|
-
rdma_communication_wait_time = rdma_communication_wait_time / 1e3
|
|
80
|
-
rdma_communication_size = rdma_communication_size / 1e3
|
|
81
|
-
rdma_communication_time = rdma_communication_time / 1e3
|
|
82
|
-
rdma_bandwidth = rdma_communication_size / (rdma_communication_time / 1e3) \
|
|
83
|
-
if rdma_communication_size else 0
|
|
84
|
-
thread_information.append(
|
|
85
|
-
[rdma_communication_time, rdma_communication_size, rdma_bandwidth, rdma_communication_wait_time])
|
|
86
|
-
if len(thread_information) > 1:
|
|
87
|
-
thread_information = np.sum(thread_information, axis=0).tolist()
|
|
88
|
-
|
|
89
|
-
return thread_information
|
|
90
|
-
|
|
91
|
-
def parse(self):
|
|
92
|
-
"""Analyse the original hccl data generator hccl data."""
|
|
93
|
-
|
|
94
|
-
raw_data = []
|
|
95
|
-
msprof_name = fr'{self.mindstudio_profiler_output}/msprof_*.json'
|
|
96
|
-
for msprof_file in get_newest_file(glob.glob(msprof_name)):
|
|
97
|
-
with open(msprof_file) as fr:
|
|
98
|
-
raw_data.extend(json.load(fr))
|
|
99
|
-
|
|
100
|
-
hccl_data = self._original_data_analyse(raw_data)
|
|
101
|
-
|
|
102
|
-
for model_id in np.unique(hccl_data['model_id']):
|
|
103
|
-
hccl_data_model = hccl_data[hccl_data['model_id'] == model_id]
|
|
104
|
-
for iteration_id in np.unique(hccl_data_model['iteration_id']):
|
|
105
|
-
hccl_data_model_iteration = hccl_data_model[hccl_data_model['iteration_id'] == iteration_id]
|
|
106
|
-
|
|
107
|
-
hccl_abstract_data = hccl_data_model_iteration[hccl_data_model_iteration['task_type'] == '']
|
|
108
|
-
hccl_detail_data = hccl_data_model_iteration[hccl_data_model_iteration['task_type'] != '']
|
|
109
|
-
hccl_abstract_data = np.sort(hccl_abstract_data, order='ts')
|
|
110
|
-
hccl_detail_data = np.sort(hccl_detail_data, order='ts')
|
|
111
|
-
|
|
112
|
-
tag = np.searchsorted(hccl_abstract_data['ts'], hccl_detail_data['ts'], side='right') - 1
|
|
113
|
-
|
|
114
|
-
hccl_detail_data['tag'] = [x[-1] for x in
|
|
115
|
-
np.char.split(hccl_abstract_data[tag]['name'].astype(str), sep='/')]
|
|
116
|
-
|
|
117
|
-
self.hccl_raw.append(self._iteration_analyse(hccl_detail_data, iteration_id))
|
|
118
|
-
|
|
119
|
-
self.hccl_raw = sorted(self.hccl_raw, key=lambda x: x[0])
|
|
120
|
-
if self.hccl_raw:
|
|
121
|
-
self.hccl_raw.append(copy.deepcopy(self.hccl_raw[-1]))
|
|
122
|
-
self.hccl_raw[-1][0] = '-'
|
|
123
|
-
for _, value in self.hccl_raw[-1][4].items():
|
|
124
|
-
value[0] = '-'
|
|
125
|
-
|
|
126
|
-
def write(self, hccl_raw_path):
|
|
127
|
-
"""
|
|
128
|
-
Write the flops.csv and flops_summary.json
|
|
129
|
-
|
|
130
|
-
Args:
|
|
131
|
-
hccl_raw_path(str): hccl_raw.csv path.
|
|
132
|
-
"""
|
|
133
|
-
try:
|
|
134
|
-
with os.fdopen(os.open(hccl_raw_path,
|
|
135
|
-
os.O_WRONLY | os.O_CREAT | os.O_TRUNC, stat.S_IWUSR | stat.S_IRUSR), 'w',
|
|
136
|
-
newline='') as hccl_row:
|
|
137
|
-
writer = csv.writer(hccl_row)
|
|
138
|
-
writer.writerow(
|
|
139
|
-
['step_num', 'communication_cost', 'wait_cost', 'link_info', 'communication_operator_cost'])
|
|
140
|
-
for row in self.hccl_raw:
|
|
141
|
-
row[3] = json.dumps(row[3])
|
|
142
|
-
row[4] = json.dumps(row[4])
|
|
143
|
-
writer.writerows(self.hccl_raw)
|
|
144
|
-
except (IOError, OSError) as err:
|
|
145
|
-
logging.critical('Errot occurred when write aicore detail file: %s', err)
|
|
146
|
-
raise ProfilerIOException() from err
|
|
147
|
-
if os.path.exists(hccl_raw_path):
|
|
148
|
-
os.chmod(hccl_raw_path, stat.S_IREAD | stat.S_IWRITE)
|
|
149
|
-
|
|
150
|
-
def _original_data_analyse(self, original_data):
|
|
151
|
-
"""analyse original data"""
|
|
152
|
-
|
|
153
|
-
groups_steptrace = {model_id: np.sort(self.steptrace[self.steptrace['Model ID'] == model_id],
|
|
154
|
-
order='Iteration ID')
|
|
155
|
-
for model_id in np.unique(self.steptrace['Model ID'])}
|
|
156
|
-
|
|
157
|
-
hccl_pid = None
|
|
158
|
-
for row in original_data:
|
|
159
|
-
if row.get('ph') == 'M' and row.get('name') == 'process_name' and row.get('args', {}).get('name') == 'HCCL':
|
|
160
|
-
hccl_pid = row.get('pid')
|
|
161
|
-
break
|
|
162
|
-
|
|
163
|
-
target_data = []
|
|
164
|
-
for row in original_data:
|
|
165
|
-
model_id = row.get('args', {}).get('model id')
|
|
166
|
-
pid = row.get('pid')
|
|
167
|
-
if hccl_pid == pid and row.get('ph') == 'X' and model_id is not None:
|
|
168
|
-
name = row.get('name')
|
|
169
|
-
tid = row.get('tid')
|
|
170
|
-
ts = float(row.get('ts'))
|
|
171
|
-
dur = float(row.get('dur'))
|
|
172
|
-
te = ts + dur
|
|
173
|
-
ph = row.get('ph')
|
|
174
|
-
task_type = row.get('args', {}).get('task type', '')
|
|
175
|
-
src_rank = row.get('args', {}).get('src rank', 0)
|
|
176
|
-
dst_rank = row.get('args', {}).get('dst rank', 0)
|
|
177
|
-
if src_rank == int('0xffffffff', 16):
|
|
178
|
-
src_rank = dst_rank
|
|
179
|
-
if dst_rank == int('0xffffffff', 16):
|
|
180
|
-
dst_rank = src_rank
|
|
181
|
-
transport_type = row.get('args', {}).get('transport type', '')
|
|
182
|
-
if transport_type == 'LOCAL':
|
|
183
|
-
src_rank, dst_rank = dst_rank, src_rank
|
|
184
|
-
link_info = str(src_rank) + '-' + str(dst_rank)
|
|
185
|
-
size = row.get('args', {}).get('size(Byte)', 0)
|
|
186
|
-
size = size if isinstance(size, int) else int(size, 16)
|
|
187
|
-
steptrace = groups_steptrace.get(model_id, None)
|
|
188
|
-
if steptrace is None:
|
|
189
|
-
if self.DEFAULT_MODEL_ID != model_id:
|
|
190
|
-
logging.warning('Could not find model: %s in hccl json, skip.', model_id)
|
|
191
|
-
continue
|
|
192
|
-
tag = np.searchsorted(steptrace['Iteration End'], te * 1e-3, side='left')
|
|
193
|
-
iteration_id = steptrace[tag]['Iteration ID']
|
|
194
|
-
target_data.append(
|
|
195
|
-
tuple([model_id, iteration_id, name, pid, tid,
|
|
196
|
-
ts, te, dur, ph, task_type,
|
|
197
|
-
link_info, transport_type, size, -1]))
|
|
198
|
-
|
|
199
|
-
hccl_data = np.array(target_data, dtype=self.hccl_data_df)
|
|
200
|
-
|
|
201
|
-
return hccl_data
|
|
202
|
-
|
|
203
|
-
def _iteration_analyse(self, hccl_detail_data, iteration):
|
|
204
|
-
"""analyse data by iteration """
|
|
205
|
-
communication_cost, wait_cost = self._cost_analyse(hccl_detail_data)
|
|
206
|
-
link_info = self._link_info_analyse(hccl_detail_data)
|
|
207
|
-
communication_operator_cost = self._communication_operator_cost_analyse(hccl_detail_data, iteration)
|
|
208
|
-
return [iteration, communication_cost, wait_cost, link_info, communication_operator_cost]
|
|
209
|
-
|
|
210
|
-
def _link_info_analyse(self, hccl_detail_data):
|
|
211
|
-
"""analyse link info data"""
|
|
212
|
-
groupby_iteration = hccl_detail_data[hccl_detail_data['task_type'] != 'Notify Record']
|
|
213
|
-
link_info_groups = np.unique(groupby_iteration['link_info'])
|
|
214
|
-
link_info_information = dict()
|
|
215
|
-
for link_info_index in link_info_groups:
|
|
216
|
-
groupby_link_info = groupby_iteration[groupby_iteration['link_info'] == link_info_index]
|
|
217
|
-
transport_groups = np.unique(groupby_iteration['transport_type'])
|
|
218
|
-
transport_information = dict()
|
|
219
|
-
for transport_index in transport_groups:
|
|
220
|
-
groupby_transport = groupby_link_info[groupby_link_info['transport_type'] == transport_index]
|
|
221
|
-
if transport_index == 'SDMA' and groupby_transport.size > 0:
|
|
222
|
-
groupby_sdma = \
|
|
223
|
-
groupby_transport[np.isin(groupby_transport['task_type'], ['Memcpy', 'Reduce Inline'])][
|
|
224
|
-
['dur', 'size']]
|
|
225
|
-
sdma_communication_time = np.sum(groupby_sdma['dur']) * 1e-3
|
|
226
|
-
sdma_communication_size = np.sum(groupby_sdma['size']) * 1e-3
|
|
227
|
-
sdma_bandwidth = sdma_communication_size / sdma_communication_time * 1e-3 \
|
|
228
|
-
if sdma_communication_time != 0 else 0
|
|
229
|
-
transport_information['SDMA'] = [sdma_communication_time, sdma_communication_size, sdma_bandwidth]
|
|
230
|
-
elif transport_index == 'RDMA' and groupby_transport.size > 0:
|
|
231
|
-
transport_information['RDMA'] = self._rdma_analyse(groupby_transport)
|
|
232
|
-
link_info_information[link_info_index] = transport_information
|
|
233
|
-
return link_info_information
|
|
234
|
-
|
|
235
|
-
def _communication_operator_cost_analyse(self, hccl_detail_data, iteration_index):
|
|
236
|
-
"""analyse communication operator cost"""
|
|
237
|
-
groupby_iteration = hccl_detail_data[hccl_detail_data['task_type'] != 'Notify Record']
|
|
238
|
-
tag_groups = np.unique(groupby_iteration['tag'])
|
|
239
|
-
tag_information = dict()
|
|
240
|
-
for tag_index in tag_groups:
|
|
241
|
-
groupby_tag = groupby_iteration[groupby_iteration['tag'] == tag_index]
|
|
242
|
-
link_groups = np.unique(groupby_iteration['link_info'])
|
|
243
|
-
link_info_information = dict()
|
|
244
|
-
for link_info_index in link_groups:
|
|
245
|
-
groupby_link_info = groupby_tag[groupby_tag['link_info'] == link_info_index]
|
|
246
|
-
transport_groups = np.unique(groupby_link_info['transport_type'])
|
|
247
|
-
transport_information = dict()
|
|
248
|
-
for transport_index in transport_groups:
|
|
249
|
-
groupby_transport = groupby_link_info[groupby_link_info['transport_type'] == transport_index]
|
|
250
|
-
if transport_index == 'SDMA':
|
|
251
|
-
groupby_sdma = \
|
|
252
|
-
groupby_transport[np.isin(groupby_transport['task_type'], ['Memcpy', 'Reduce Inline'])][
|
|
253
|
-
['dur', 'size']]
|
|
254
|
-
sdma_communication_time = np.sum(groupby_sdma['dur']) * 1e-3
|
|
255
|
-
sdma_communication_size = np.sum(groupby_sdma['size']) * 1e-3
|
|
256
|
-
sdma_bandwidth = sdma_communication_size / sdma_communication_time * 1e-3 \
|
|
257
|
-
if sdma_communication_time != 0 else 0
|
|
258
|
-
transport_information['SDMA'] = [
|
|
259
|
-
sdma_communication_time, sdma_communication_size,
|
|
260
|
-
sdma_bandwidth
|
|
261
|
-
]
|
|
262
|
-
elif transport_index == 'RDMA':
|
|
263
|
-
transport_information['RDMA'] = self._rdma_analyse(groupby_transport)
|
|
264
|
-
link_info_information[link_info_index] = transport_information
|
|
265
|
-
communication_cost = np.sum(groupby_tag[groupby_tag['name'] != 'Notify_Wait']['dur'])
|
|
266
|
-
wait_cost = np.sum(groupby_tag[groupby_tag['name'] == 'Notify_Wait']['dur'])
|
|
267
|
-
tag_information[tag_index] = [
|
|
268
|
-
str(iteration_index), communication_cost, wait_cost,
|
|
269
|
-
link_info_information
|
|
270
|
-
]
|
|
271
|
-
return tag_information
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# Copyright 2024 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
|
-
"""PROF csv data analyze module"""
|
|
16
|
-
import os
|
|
17
|
-
|
|
18
|
-
from mindspore.profiler.parser.ascend_analysis.file_manager import FileManager
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
class AscendIntegrateGenerator:
|
|
22
|
-
"""Generate ms profiler output csv"""
|
|
23
|
-
|
|
24
|
-
def __init__(self, mindstudio_profiler_output: str, ascend_ms_output_path: str):
|
|
25
|
-
self._mindstudio_profiler_output = mindstudio_profiler_output
|
|
26
|
-
self._ascend_ms_output_path = ascend_ms_output_path
|
|
27
|
-
|
|
28
|
-
def parse(self):
|
|
29
|
-
"""Generate ms profiler output csv"""
|
|
30
|
-
self._generate_kernel_details()
|
|
31
|
-
|
|
32
|
-
def _generate_kernel_details(self):
|
|
33
|
-
"""Generate kernel_details.csv"""
|
|
34
|
-
header_map = {
|
|
35
|
-
"Op Name": "Name", "OP Type": "Type", "Task Type": "Accelerator Core",
|
|
36
|
-
"Task Start Time(us)": "Start Time(us)", "Task Duration(us)": "Duration(us)",
|
|
37
|
-
"Task Wait Time(us)": "Wait Time(us)",
|
|
38
|
-
}
|
|
39
|
-
op_summary_file_list = FileManager.get_csv_file_list_by_start_name(self._mindstudio_profiler_output,
|
|
40
|
-
"op_summary")
|
|
41
|
-
kernel_details_file = os.path.join(self._ascend_ms_output_path, "kernel_details.csv")
|
|
42
|
-
FileManager.combine_csv_file(op_summary_file_list, kernel_details_file, header_map)
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
# Copyright 2024 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
|
-
"""memory data analyze module"""
|
|
16
|
-
import os
|
|
17
|
-
|
|
18
|
-
from decimal import Decimal
|
|
19
|
-
|
|
20
|
-
from mindspore.profiler.parser.ascend_analysis.file_manager import FileManager
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class AscendMemoryGenerator:
|
|
24
|
-
"""Parsing the memory data of the ascend device"""
|
|
25
|
-
GE_MEMORY_RECORD_HEADERS = ["Device id", "Component", "Timestamp(us)", "Total Allocated(KB)",
|
|
26
|
-
"Total Reserved(KB)", "Device"]
|
|
27
|
-
MS_MEMORY_RECORD_HEADERS = ["Timestamp(ns)", "Total Allocated(Byte)", "Total Reserved(Byte)", "Total Active(Byte)"]
|
|
28
|
-
TARGET_MEMORY_RECORD_HEADERS = ["Component", "Timestamp(us)", "Total Allocated(MB)", "Total Reserved(MB)",
|
|
29
|
-
"Total Active(MB)", "Device Type"]
|
|
30
|
-
|
|
31
|
-
def __init__(self, source_path: str, rank_id: int, mindstudio_profiler_output: str, ascend_ms_output_path: str):
|
|
32
|
-
self._source_path = source_path
|
|
33
|
-
self._rank_id = rank_id
|
|
34
|
-
self._mindstudio_profiler_output = mindstudio_profiler_output
|
|
35
|
-
self._ascend_ms_output_path = ascend_ms_output_path
|
|
36
|
-
self._ge_memory_record = []
|
|
37
|
-
self._ms_memory_record = []
|
|
38
|
-
|
|
39
|
-
def parse(self):
|
|
40
|
-
"""Parse all memory data"""
|
|
41
|
-
self.copy_npu_module_mem_csv()
|
|
42
|
-
self.parse_memory_record()
|
|
43
|
-
|
|
44
|
-
def copy_npu_module_mem_csv(self):
|
|
45
|
-
"""Generate npu_module_mem.csv"""
|
|
46
|
-
npu_module_mem_file_list = FileManager.get_csv_file_list_by_start_name(self._mindstudio_profiler_output,
|
|
47
|
-
"npu_module_mem")
|
|
48
|
-
target_file_path = os.path.join(self._ascend_ms_output_path, "npu_module_mem.csv")
|
|
49
|
-
FileManager.combine_csv_file(npu_module_mem_file_list, target_file_path)
|
|
50
|
-
|
|
51
|
-
def parse_memory_record(self):
|
|
52
|
-
"""Generate memory_record.csv"""
|
|
53
|
-
self._parse_ge_memory_record()
|
|
54
|
-
self._parse_ms_memory_record()
|
|
55
|
-
combined_memory_data = self._combine_ge_ms_memory_record()
|
|
56
|
-
target_file_path = os.path.join(self._ascend_ms_output_path, "memory_record.csv")
|
|
57
|
-
FileManager.create_csv_file(target_file_path, combined_memory_data, self.TARGET_MEMORY_RECORD_HEADERS)
|
|
58
|
-
|
|
59
|
-
def _parse_ge_memory_record(self):
|
|
60
|
-
"""Parse ge memory record data"""
|
|
61
|
-
memory_record_file_list = FileManager.get_csv_file_list_by_start_name(self._mindstudio_profiler_output,
|
|
62
|
-
"memory_record")
|
|
63
|
-
for file in memory_record_file_list:
|
|
64
|
-
data = FileManager.read_csv_file(file)
|
|
65
|
-
if len(data) > 1:
|
|
66
|
-
self._ge_memory_record.extend(data[1:])
|
|
67
|
-
|
|
68
|
-
def _parse_ms_memory_record(self):
|
|
69
|
-
"""Parse mindspore memory record data"""
|
|
70
|
-
memory_record_file = os.path.join(self._source_path, f"cpu_ms_memory_record_{self._rank_id}.txt")
|
|
71
|
-
data = FileManager.read_txt_file(memory_record_file)
|
|
72
|
-
if len(data) > 1:
|
|
73
|
-
self._ms_memory_record.extend(data[1:])
|
|
74
|
-
|
|
75
|
-
def _get_app_reserved_memory(self) -> list:
|
|
76
|
-
"""Get the reserved memory of the application from npu_mem.csv"""
|
|
77
|
-
npu_module_mem_file_list = FileManager.get_csv_file_list_by_start_name(self._mindstudio_profiler_output,
|
|
78
|
-
"npu_mem")
|
|
79
|
-
app_mems = []
|
|
80
|
-
for file in npu_module_mem_file_list:
|
|
81
|
-
md_mems = FileManager.read_csv_file(file)
|
|
82
|
-
for mem in md_mems:
|
|
83
|
-
if mem[1] == "APP":
|
|
84
|
-
app_mems.append(MemoryRecordBean([mem[1], mem[-1].rstrip('\t'), 0.0, float(mem[4]), 0.0,
|
|
85
|
-
f"NPU:{self._rank_id}"]).row)
|
|
86
|
-
|
|
87
|
-
return app_mems
|
|
88
|
-
|
|
89
|
-
def _combine_ge_ms_memory_record(self) -> list:
|
|
90
|
-
"""Combine ge and mindspore memory record data"""
|
|
91
|
-
memory_records = []
|
|
92
|
-
for ge_memory in self._ge_memory_record:
|
|
93
|
-
memory_record = dict(zip(self.GE_MEMORY_RECORD_HEADERS, ge_memory))
|
|
94
|
-
memory_records.append(
|
|
95
|
-
MemoryRecordBean([memory_record.get("Component", "GE"), memory_record.get("Timestamp(us)"),
|
|
96
|
-
memory_record.get("Total Allocated(KB)", 0),
|
|
97
|
-
memory_record.get("Total Reserved(KB)", 0),
|
|
98
|
-
0, memory_record.get("Device")]))
|
|
99
|
-
for ms_memory in self._ms_memory_record:
|
|
100
|
-
memory_record = dict(zip(self.MS_MEMORY_RECORD_HEADERS, ms_memory))
|
|
101
|
-
memory_records.append(
|
|
102
|
-
MemoryRecordBean(["MindSpore", Decimal(memory_record.get("Timestamp(ns)", 0)) / 1000,
|
|
103
|
-
float(memory_record.get("Total Allocated(Byte)", 0)) / 1024,
|
|
104
|
-
float(memory_record.get("Total Reserved(Byte)", 0)) / 1024,
|
|
105
|
-
float(memory_record.get("Total Active(Byte)", 0)) / 1024,
|
|
106
|
-
f"NPU:{self._rank_id}"]))
|
|
107
|
-
memory_records.sort(key=lambda x: x.time_us)
|
|
108
|
-
last_ge_memory, last_ms_memory = MemoryRecordBean([0] * 6), MemoryRecordBean([0] * 6)
|
|
109
|
-
result_data = []
|
|
110
|
-
for memory_record in memory_records:
|
|
111
|
-
result_data.append(memory_record.row)
|
|
112
|
-
last_memory = last_ms_memory if memory_record.is_ge_component() else last_ge_memory
|
|
113
|
-
combined_mem = MemoryRecordBean(["MindSpore+GE", memory_record.time_us,
|
|
114
|
-
memory_record.total_allocated_kb + last_memory.total_allocated_kb,
|
|
115
|
-
memory_record.total_reserved_kb + last_memory.total_reserved_kb,
|
|
116
|
-
memory_record.total_active_kb + last_memory.total_active_kb,
|
|
117
|
-
f"NPU:{self._rank_id}"])
|
|
118
|
-
result_data.append(combined_mem.row)
|
|
119
|
-
if memory_record.is_ge_component():
|
|
120
|
-
last_ge_memory = memory_record
|
|
121
|
-
else:
|
|
122
|
-
last_ms_memory = memory_record
|
|
123
|
-
return result_data + self._get_app_reserved_memory()
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
class MemoryRecordBean:
|
|
127
|
-
"""Memory Record Struct"""
|
|
128
|
-
KB_TO_MB = 1000
|
|
129
|
-
HEADERS = ["Component", "Timestamp(us)", "Total Allocated(KB)", "Total Reserved(KB)",
|
|
130
|
-
"Total Active(KB)", "Device Type"]
|
|
131
|
-
|
|
132
|
-
def __init__(self, data: list):
|
|
133
|
-
self._data = dict(zip(self.HEADERS, data))
|
|
134
|
-
|
|
135
|
-
@property
|
|
136
|
-
def row(self) -> list:
|
|
137
|
-
return [self.component, self.time_us_str, self.total_allocated_mb, self.total_reserved_mb,
|
|
138
|
-
self.total_active_mb, self.device_type]
|
|
139
|
-
|
|
140
|
-
@property
|
|
141
|
-
def component(self) -> str:
|
|
142
|
-
return self._data.get("Component", "")
|
|
143
|
-
|
|
144
|
-
@property
|
|
145
|
-
def time_us_str(self) -> str:
|
|
146
|
-
ts_us = self._data.get("Timestamp(us)", 0)
|
|
147
|
-
return str(ts_us)
|
|
148
|
-
|
|
149
|
-
@property
|
|
150
|
-
def total_allocated_mb(self) -> float:
|
|
151
|
-
return float(self._data.get("Total Allocated(KB)", 0)) / self.KB_TO_MB
|
|
152
|
-
|
|
153
|
-
@property
|
|
154
|
-
def total_reserved_mb(self) -> float:
|
|
155
|
-
return float(self._data.get("Total Reserved(KB)", 0)) / self.KB_TO_MB
|
|
156
|
-
|
|
157
|
-
@property
|
|
158
|
-
def total_active_mb(self) -> float:
|
|
159
|
-
return float(self._data.get("Total Active(KB)", 0)) / self.KB_TO_MB
|
|
160
|
-
|
|
161
|
-
@property
|
|
162
|
-
def device_type(self) -> float:
|
|
163
|
-
return self._data.get("Device Type", "")
|
|
164
|
-
|
|
165
|
-
@property
|
|
166
|
-
def total_allocated_kb(self) -> float:
|
|
167
|
-
return float(self._data.get("Total Allocated(KB)", 0))
|
|
168
|
-
|
|
169
|
-
@property
|
|
170
|
-
def total_reserved_kb(self) -> float:
|
|
171
|
-
return float(self._data.get("Total Reserved(KB)", 0))
|
|
172
|
-
|
|
173
|
-
@property
|
|
174
|
-
def total_active_kb(self) -> float:
|
|
175
|
-
return float(self._data.get("Total Active(KB)", 0))
|
|
176
|
-
|
|
177
|
-
@property
|
|
178
|
-
def time_us(self) -> Decimal:
|
|
179
|
-
return Decimal(self._data.get("Timestamp(us)", 0))
|
|
180
|
-
|
|
181
|
-
def is_ge_component(self):
|
|
182
|
-
"""
|
|
183
|
-
Determine if it is GE
|
|
184
|
-
"""
|
|
185
|
-
return self.component == "GE"
|