mindspore 2.6.0__cp311-cp311-win_amd64.whl → 2.7.0__cp311-cp311-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mindspore might be problematic. Click here for more details.
- mindspore/.commit_id +1 -1
- mindspore/Microsoft.VisualStudio.Telemetry.dll +0 -0
- mindspore/Newtonsoft.Json.dll +0 -0
- mindspore/__init__.py +2 -2
- mindspore/_c_dataengine.cp311-win_amd64.pyd +0 -0
- mindspore/_c_expression.cp311-win_amd64.pyd +0 -0
- mindspore/_c_mindrecord.cp311-win_amd64.pyd +0 -0
- mindspore/_checkparam.py +42 -11
- mindspore/_extends/builtin_operations.py +3 -3
- mindspore/{_deprecated → _extends/optimize}/__init__.py +9 -3
- mindspore/_extends/optimize/cell_utils.py +96 -0
- mindspore/_extends/parallel_compile/akg_compiler/custom.py +1109 -0
- mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +1 -1
- mindspore/_extends/parse/__init__.py +3 -3
- mindspore/_extends/parse/compile_config.py +44 -22
- mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +1 -2
- mindspore/_extends/parse/parser.py +64 -83
- mindspore/_extends/parse/resources.py +39 -0
- mindspore/_extends/parse/standard_method.py +47 -14
- mindspore/_extends/parse/trope.py +8 -1
- mindspore/_extends/pijit/__init__.py +1 -2
- mindspore/_extends/pijit/pijit_func_white_list.py +2 -5
- mindspore/amp.py +4 -22
- mindspore/atlprov.dll +0 -0
- mindspore/avcodec-59.dll +0 -0
- mindspore/avdevice-59.dll +0 -0
- mindspore/avfilter-8.dll +0 -0
- mindspore/avformat-59.dll +0 -0
- mindspore/avutil-57.dll +0 -0
- mindspore/boost/adasum.py +1 -1
- mindspore/boost/boost_cell_wrapper.py +4 -4
- mindspore/c1.dll +0 -0
- mindspore/c1xx.dll +0 -0
- mindspore/c2.dll +0 -0
- mindspore/common/__init__.py +43 -12
- mindspore/common/_grad_function.py +2 -1
- mindspore/common/_pijit_context.py +28 -7
- mindspore/common/_stub_tensor.py +1 -209
- mindspore/common/_tensor_cpp_method.py +1 -1
- mindspore/common/_tensor_docs.py +177 -52
- mindspore/common/_utils.py +9 -1
- mindspore/common/api.py +338 -208
- mindspore/common/dtype.py +108 -57
- mindspore/common/dump.py +11 -16
- mindspore/common/dynamic_shape/__init__.py +0 -0
- mindspore/common/{auto_dynamic_shape.py → dynamic_shape/auto_dynamic_shape.py} +17 -23
- mindspore/common/dynamic_shape/enable_dynamic.py +197 -0
- mindspore/common/file_system.py +59 -9
- mindspore/common/generator.py +2 -3
- mindspore/common/hook_handle.py +33 -5
- mindspore/common/jit_config.py +1 -1
- mindspore/common/jit_trace.py +84 -105
- mindspore/common/np_dtype.py +3 -3
- mindspore/common/parameter.py +27 -29
- mindspore/common/recompute.py +5 -7
- mindspore/common/sparse_tensor.py +0 -3
- mindspore/common/symbol.py +0 -1
- mindspore/common/tensor.py +84 -133
- mindspore/communication/_comm_helper.py +46 -4
- mindspore/communication/management.py +79 -7
- mindspore/context.py +47 -38
- mindspore/dataset/__init__.py +1 -1
- mindspore/dataset/audio/transforms.py +1 -1
- mindspore/dataset/core/config.py +38 -4
- mindspore/dataset/engine/datasets.py +350 -322
- mindspore/dataset/engine/datasets_user_defined.py +69 -23
- mindspore/dataset/engine/iterators.py +2 -2
- mindspore/dataset/engine/obs/config_loader.py +2 -2
- mindspore/dataset/engine/obs/obs_mindrecord_dataset.py +8 -0
- mindspore/dataset/transforms/c_transforms.py +2 -2
- mindspore/dataset/transforms/py_transforms.py +7 -3
- mindspore/dataset/transforms/transforms.py +10 -6
- mindspore/dataset/vision/__init__.py +1 -1
- mindspore/dataset/vision/py_transforms.py +8 -8
- mindspore/dataset/vision/transforms.py +17 -5
- mindspore/dataset/vision/utils.py +632 -21
- mindspore/dataset/vision/validators.py +1 -0
- mindspore/device_context/ascend/device.py +1 -1
- mindspore/device_context/ascend/op_tuning.py +35 -1
- mindspore/device_context/gpu/__init__.py +2 -2
- mindspore/device_context/gpu/device.py +1 -1
- mindspore/device_context/gpu/op_precision.py +4 -2
- mindspore/device_context/gpu/op_tuning.py +6 -3
- mindspore/device_manager.py +16 -9
- mindspore/dnnl.dll +0 -0
- mindspore/dpcmi.dll +0 -0
- mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +5 -4
- mindspore/experimental/llm_boost/atb/boost_base.py +2 -3
- mindspore/experimental/optim/adadelta.py +13 -20
- mindspore/experimental/optim/adagrad.py +15 -22
- mindspore/experimental/optim/adam.py +17 -24
- mindspore/experimental/optim/adamax.py +14 -22
- mindspore/experimental/optim/adamw.py +28 -34
- mindspore/experimental/optim/asgd.py +15 -25
- mindspore/experimental/optim/lr_scheduler.py +27 -45
- mindspore/experimental/optim/nadam.py +14 -24
- mindspore/experimental/optim/optimizer.py +13 -23
- mindspore/experimental/optim/radam.py +18 -24
- mindspore/experimental/optim/rmsprop.py +14 -25
- mindspore/experimental/optim/rprop.py +15 -26
- mindspore/experimental/optim/sgd.py +9 -19
- mindspore/hal/__init__.py +4 -4
- mindspore/hal/contiguous_tensors_handle.py +2 -2
- mindspore/hal/memory.py +1 -0
- mindspore/include/api/cell.h +65 -5
- mindspore/include/api/cfg.h +24 -7
- mindspore/include/api/context.h +1 -0
- mindspore/include/api/delegate.h +10 -2
- mindspore/include/api/dual_abi_helper.h +100 -19
- mindspore/include/api/graph.h +14 -1
- mindspore/include/api/kernel.h +16 -3
- mindspore/include/api/kernel_api.h +9 -1
- mindspore/include/api/metrics/accuracy.h +9 -0
- mindspore/include/api/model.h +8 -1
- mindspore/include/api/model_group.h +4 -0
- mindspore/include/api/model_parallel_runner.h +2 -0
- mindspore/include/api/status.h +48 -10
- mindspore/include/api/types.h +8 -3
- mindspore/include/c_api/model_c.h +0 -58
- mindspore/include/c_api/tensor_c.h +0 -26
- mindspore/include/dataset/constants.h +9 -0
- mindspore/include/dataset/vision_ascend.h +1 -1
- mindspore/jpeg62.dll +0 -0
- mindspore/mindrecord/tools/cifar10.py +61 -11
- mindspore/mindrecord/tools/cifar10_to_mr.py +5 -0
- mindspore/mindspore_backend_common.dll +0 -0
- mindspore/mindspore_backend_manager.dll +0 -0
- mindspore/mindspore_common.dll +0 -0
- mindspore/mindspore_core.dll +0 -0
- mindspore/mindspore_cpu_res_manager.dll +0 -0
- mindspore/mindspore_dump.dll +0 -0
- mindspore/mindspore_frontend.dll +0 -0
- mindspore/mindspore_glog.dll +0 -0
- mindspore/mindspore_memory_pool.dll +0 -0
- mindspore/mindspore_ms_backend.dll +0 -0
- mindspore/mindspore_ops.dll +0 -0
- mindspore/mindspore_ops_host.dll +0 -0
- mindspore/mindspore_ops_kernel_common.dll +0 -0
- mindspore/mindspore_profiler.dll +0 -0
- mindspore/mindspore_pyboost.dll +0 -0
- mindspore/mindspore_pynative.dll +0 -0
- mindspore/mindspore_res_manager.dll +0 -0
- mindspore/mindspore_runtime_pipeline.dll +0 -0
- mindspore/mint/__init__.py +4 -44
- mindspore/mint/distributed/__init__.py +5 -0
- mindspore/mint/distributed/distributed.py +425 -19
- mindspore/mint/nn/__init__.py +1 -1
- mindspore/mint/nn/functional.py +53 -6
- mindspore/mint/nn/layer/_functions.py +163 -294
- mindspore/mint/nn/layer/activation.py +8 -6
- mindspore/mint/nn/layer/conv.py +125 -101
- mindspore/mint/nn/layer/normalization.py +11 -25
- mindspore/mint/optim/adam.py +19 -18
- mindspore/mint/optim/adamw.py +14 -8
- mindspore/mint/optim/sgd.py +5 -5
- mindspore/msobj140.dll +0 -0
- mindspore/mspdb140.dll +0 -0
- mindspore/mspdbcore.dll +0 -0
- mindspore/mspdbst.dll +0 -0
- mindspore/mspft140.dll +0 -0
- mindspore/msvcdis140.dll +0 -0
- mindspore/msvcp140_1.dll +0 -0
- mindspore/msvcp140_2.dll +0 -0
- mindspore/msvcp140_atomic_wait.dll +0 -0
- mindspore/msvcp140_codecvt_ids.dll +0 -0
- mindspore/nn/cell.py +488 -620
- mindspore/nn/grad/cell_grad.py +11 -12
- mindspore/nn/layer/activation.py +36 -36
- mindspore/nn/layer/basic.py +74 -77
- mindspore/nn/layer/channel_shuffle.py +4 -4
- mindspore/nn/layer/combined.py +4 -2
- mindspore/nn/layer/conv.py +86 -85
- mindspore/nn/layer/dense.py +9 -7
- mindspore/nn/layer/embedding.py +50 -52
- mindspore/nn/layer/image.py +38 -40
- mindspore/nn/layer/math.py +111 -112
- mindspore/nn/layer/normalization.py +56 -44
- mindspore/nn/layer/pooling.py +58 -63
- mindspore/nn/layer/rnn_cells.py +33 -33
- mindspore/nn/layer/rnns.py +56 -56
- mindspore/nn/layer/thor_layer.py +74 -73
- mindspore/nn/layer/transformer.py +11 -1
- mindspore/nn/learning_rate_schedule.py +20 -20
- mindspore/nn/loss/loss.py +79 -81
- mindspore/nn/optim/adam.py +2 -4
- mindspore/nn/optim/adasum.py +2 -2
- mindspore/nn/optim/lamb.py +1 -3
- mindspore/nn/optim/optimizer.py +1 -1
- mindspore/nn/optim/tft_wrapper.py +2 -3
- mindspore/nn/optim/thor.py +2 -2
- mindspore/nn/probability/distribution/_utils/utils.py +2 -2
- mindspore/nn/probability/distribution/exponential.py +2 -1
- mindspore/nn/probability/distribution/poisson.py +2 -1
- mindspore/nn/sparse/sparse.py +3 -3
- mindspore/nn/wrap/cell_wrapper.py +73 -42
- mindspore/nn/wrap/grad_reducer.py +37 -52
- mindspore/nn/wrap/loss_scale.py +72 -74
- mindspore/numpy/array_creations.py +7 -7
- mindspore/numpy/fft.py +1 -1
- mindspore/numpy/math_ops.py +1 -1
- mindspore/numpy/utils_const.py +1 -1
- mindspore/opencv_core452.dll +0 -0
- mindspore/opencv_imgcodecs452.dll +0 -0
- mindspore/opencv_imgproc452.dll +0 -0
- mindspore/ops/_grad_experimental/grad_comm_ops.py +51 -13
- mindspore/ops/_grad_experimental/grad_debug_ops.py +14 -0
- mindspore/ops/_grad_experimental/grad_inner_ops.py +0 -9
- mindspore/ops/_op_impl/cpu/__init__.py +1 -0
- mindspore/{experimental/es/__init__.py → ops/_op_impl/cpu/joinedstr_op.py} +12 -6
- mindspore/ops/_vmap/vmap_array_ops.py +6 -13
- mindspore/ops/_vmap/vmap_nn_ops.py +8 -16
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +29 -10
- mindspore/ops/auto_generate/gen_extend_func.py +5 -55
- mindspore/ops/auto_generate/gen_ops_def.py +753 -273
- mindspore/ops/auto_generate/gen_ops_prim.py +1687 -958
- mindspore/ops/auto_generate/pyboost_inner_prim.py +31 -1
- mindspore/ops/composite/__init__.py +10 -0
- mindspore/ops/composite/base.py +9 -5
- mindspore/ops/composite/multitype_ops/__init__.py +12 -1
- mindspore/ops/composite/multitype_ops/_compile_utils.py +132 -108
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -1
- mindspore/ops/composite/multitype_ops/add_impl.py +70 -2
- mindspore/ops/composite/multitype_ops/div_impl.py +49 -0
- mindspore/ops/composite/multitype_ops/floordiv_impl.py +29 -0
- mindspore/ops/composite/multitype_ops/getitem_impl.py +11 -0
- mindspore/ops/composite/multitype_ops/mod_impl.py +5 -3
- mindspore/ops/composite/multitype_ops/mul_impl.py +49 -0
- mindspore/ops/composite/multitype_ops/setitem_impl.py +57 -0
- mindspore/ops/composite/multitype_ops/sub_impl.py +34 -0
- mindspore/ops/composite/multitype_ops/zeros_like_impl.py +14 -0
- mindspore/ops/function/__init__.py +4 -1
- mindspore/ops/function/_add_attr_func.py +11 -6
- mindspore/ops/function/array_func.py +17 -100
- mindspore/ops/function/debug_func.py +8 -5
- mindspore/ops/function/grad/grad_func.py +5 -13
- mindspore/ops/function/math_func.py +65 -399
- mindspore/ops/function/nn_func.py +44 -61
- mindspore/ops/function/other_func.py +4 -1
- mindspore/ops/function/random_func.py +31 -4
- mindspore/ops/functional.py +2 -3
- mindspore/ops/functional_overload.py +486 -18
- mindspore/ops/op_info_register.py +21 -0
- mindspore/ops/operations/__init__.py +5 -2
- mindspore/ops/operations/_custom_ops_utils.py +675 -8
- mindspore/ops/operations/_inner_ops.py +14 -18
- mindspore/ops/operations/_sequence_ops.py +1 -1
- mindspore/ops/operations/array_ops.py +4 -50
- mindspore/ops/operations/comm_ops.py +186 -41
- mindspore/ops/operations/custom_ops.py +244 -175
- mindspore/ops/operations/debug_ops.py +55 -4
- mindspore/ops/operations/image_ops.py +13 -13
- mindspore/ops/operations/manually_defined/ops_def.py +27 -28
- mindspore/ops/operations/math_ops.py +8 -9
- mindspore/ops/operations/nn_ops.py +6 -7
- mindspore/ops/primitive.py +9 -20
- mindspore/ops/tensor_method.py +52 -11
- mindspore/ops_generate/api/cpp_create_prim_instance_helper_generator.py +1 -1
- mindspore/ops_generate/api/functional_map_cpp_generator.py +10 -9
- mindspore/ops_generate/api/functions_cc_generator.py +58 -10
- mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +1 -1
- mindspore/ops_generate/common/base_generator.py +14 -0
- mindspore/ops_generate/common/gen_constants.py +7 -2
- mindspore/ops_generate/common/gen_utils.py +0 -19
- mindspore/ops_generate/common/op_proto.py +11 -4
- mindspore/ops_generate/common/template.py +88 -11
- mindspore/ops_generate/gen_ops.py +1 -1
- mindspore/ops_generate/op_def/lite_ops_cpp_generator.py +4 -4
- mindspore/ops_generate/op_def/ops_name_h_generator.py +0 -3
- mindspore/ops_generate/op_def/ops_primitive_h_generator.py +0 -4
- mindspore/ops_generate/op_def_py/op_prim_py_generator.py +5 -2
- mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +49 -8
- mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +2 -2
- mindspore/ops_generate/pyboost/gen_pyboost_func.py +31 -16
- mindspore/ops_generate/pyboost/op_template_parser.py +98 -72
- mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +70 -273
- mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +14 -6
- mindspore/ops_generate/pyboost/pyboost_functions_impl_cpp_generator.py +316 -0
- mindspore/ops_generate/pyboost/pyboost_functions_py_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +5 -3
- mindspore/ops_generate/pyboost/pyboost_inner_prim_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_internal_functions_cpp_generator.py +76 -0
- mindspore/ops_generate/pyboost/pyboost_internal_functions_h_generator.py +76 -0
- mindspore/ops_generate/pyboost/pyboost_internal_kernel_info_adapter_generator.py +125 -0
- mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +4 -3
- mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +348 -61
- mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +1 -1
- mindspore/ops_generate/pyboost/pyboost_utils.py +118 -9
- mindspore/ops_generate/tensor_py_cc_generator.py +1 -24
- mindspore/parallel/_auto_parallel_context.py +9 -17
- mindspore/parallel/_cell_wrapper.py +106 -40
- mindspore/parallel/_parallel_serialization.py +4 -3
- mindspore/parallel/_ps_context.py +4 -6
- mindspore/parallel/_tensor.py +167 -12
- mindspore/parallel/_transformer/moe.py +1 -1
- mindspore/parallel/_transformer/transformer.py +17 -12
- mindspore/parallel/_utils.py +5 -11
- mindspore/parallel/auto_parallel.py +33 -12
- mindspore/parallel/checkpoint_convert.py +3 -3
- mindspore/parallel/checkpoint_transform.py +5 -1
- mindspore/parallel/cluster/process_entity/_api.py +88 -49
- mindspore/parallel/cluster/process_entity/_utils.py +95 -7
- mindspore/parallel/cluster/run.py +48 -7
- mindspore/parallel/function/__init__.py +8 -1
- mindspore/parallel/function/reshard_func.py +7 -6
- mindspore/parallel/nn/__init__.py +15 -2
- mindspore/parallel/nn/parallel_cell_wrapper.py +50 -14
- mindspore/parallel/nn/parallel_grad_reducer.py +7 -14
- mindspore/parallel/shard.py +9 -23
- mindspore/parallel/transform_safetensors.py +468 -174
- mindspore/pgodb140.dll +0 -0
- mindspore/pgort140.dll +0 -0
- mindspore/profiler/__init__.py +2 -1
- mindspore/profiler/analysis/parser/timeline_assembly_factory/ascend_timeline_assembler.py +7 -7
- mindspore/profiler/analysis/parser/timeline_assembly_factory/base_timeline_assembler.py +3 -0
- mindspore/profiler/analysis/parser/timeline_assembly_factory/trace_view_container.py +3 -0
- mindspore/profiler/analysis/parser/timeline_creator/cpu_op_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_creator/fwk_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_creator/msprof_timeline_creator.py +4 -4
- mindspore/profiler/analysis/parser/timeline_creator/scope_layer_timeline_creator.py +3 -3
- mindspore/profiler/analysis/parser/timeline_event/fwk_event.py +4 -1
- mindspore/profiler/analysis/parser/timeline_event/timeline_event_pool.py +2 -1
- mindspore/profiler/analysis/task_manager.py +1 -1
- mindspore/profiler/analysis/viewer/ascend_communication_viewer.py +5 -1
- mindspore/profiler/analysis/viewer/ascend_integrate_viewer.py +2 -1
- mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +10 -9
- mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +43 -23
- mindspore/profiler/analysis/viewer/ascend_step_trace_time_viewer.py +3 -2
- mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +9 -5
- mindspore/profiler/analysis/viewer/ms_operator_details_viewer.py +132 -0
- mindspore/profiler/common/constant.py +16 -0
- mindspore/profiler/common/msprof_cmd_tool.py +2 -2
- mindspore/profiler/common/path_manager.py +9 -0
- mindspore/profiler/common/profiler_context.py +50 -29
- mindspore/profiler/common/profiler_info.py +0 -16
- mindspore/profiler/common/profiler_meta_data.py +1 -0
- mindspore/profiler/common/profiler_op_analyse.py +239 -0
- mindspore/profiler/common/profiler_output_path.py +23 -8
- mindspore/profiler/common/profiler_parameters.py +128 -35
- mindspore/profiler/dynamic_profile/__init__.py +0 -0
- mindspore/profiler/dynamic_profile/dynamic_monitor_proxy.py +39 -0
- mindspore/profiler/dynamic_profile/dynamic_profiler_config_context.py +666 -0
- mindspore/profiler/dynamic_profile/dynamic_profiler_utils.py +62 -0
- mindspore/profiler/dynamic_profiler.py +374 -338
- mindspore/profiler/envprofiler.py +42 -12
- mindspore/profiler/experimental_config.py +112 -7
- mindspore/profiler/mstx.py +33 -12
- mindspore/profiler/platform/__init__.py +2 -3
- mindspore/profiler/platform/cpu_profiler.py +10 -4
- mindspore/profiler/platform/npu_profiler.py +30 -20
- mindspore/profiler/profiler.py +218 -154
- mindspore/profiler/profiler_action_controller.py +65 -77
- mindspore/profiler/profiler_interface.py +2 -2
- mindspore/profiler/schedule.py +10 -4
- mindspore/rewrite/common/config.py +1 -0
- mindspore/rewrite/common/namer.py +1 -0
- mindspore/rewrite/common/namespace.py +1 -0
- mindspore/rewrite/node/node.py +31 -11
- mindspore/rewrite/parsers/assign_parser.py +1 -1
- mindspore/rewrite/symbol_tree/symbol_tree.py +2 -2
- mindspore/run_check/_check_version.py +7 -10
- mindspore/runtime/__init__.py +8 -6
- mindspore/runtime/event.py +10 -4
- mindspore/runtime/executor.py +87 -45
- mindspore/runtime/memory.py +22 -30
- mindspore/runtime/thread_bind_core.py +299 -165
- mindspore/safeguard/rewrite_obfuscation.py +12 -13
- mindspore/swresample-4.dll +0 -0
- mindspore/swscale-6.dll +0 -0
- mindspore/tbbmalloc.dll +0 -0
- mindspore/tinyxml2.dll +0 -0
- mindspore/train/_utils.py +9 -5
- mindspore/train/amp.py +43 -23
- mindspore/train/callback/__init__.py +5 -5
- mindspore/train/callback/_callback.py +2 -1
- mindspore/train/callback/_checkpoint.py +4 -14
- mindspore/train/callback/_flops_collector.py +11 -7
- mindspore/train/callback/_landscape.py +0 -1
- mindspore/train/callback/_train_fault_tolerance.py +72 -18
- mindspore/train/data_sink.py +15 -6
- mindspore/train/dataset_helper.py +14 -5
- mindspore/train/model.py +49 -47
- mindspore/train/serialization.py +168 -126
- mindspore/train/summary/summary_record.py +13 -2
- mindspore/train/train_thor/model_thor.py +2 -2
- mindspore/turbojpeg.dll +0 -0
- mindspore/utils/__init__.py +3 -2
- mindspore/utils/dryrun.py +0 -6
- mindspore/utils/runtime_execution_order_check.py +162 -78
- mindspore/utils/sdc_detect.py +68 -0
- mindspore/utils/utils.py +14 -17
- mindspore/vcmeta.dll +0 -0
- mindspore/vcruntime140.dll +0 -0
- mindspore/vcruntime140_1.dll +0 -0
- mindspore/version.py +1 -1
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/METADATA +5 -4
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/RECORD +400 -439
- mindspore/_deprecated/jit.py +0 -198
- mindspore/_extends/remote/kernel_build_server_ascend.py +0 -75
- mindspore/communication/_hccl_management.py +0 -297
- mindspore/experimental/es/embedding_service.py +0 -891
- mindspore/experimental/es/embedding_service_layer.py +0 -581
- mindspore/profiler/common/validator/__init__.py +0 -14
- mindspore/profiler/common/validator/validate_path.py +0 -84
- mindspore/profiler/parser/__init__.py +0 -14
- mindspore/profiler/parser/aicpu_data_parser.py +0 -272
- mindspore/profiler/parser/ascend_analysis/__init__.py +0 -14
- mindspore/profiler/parser/ascend_analysis/constant.py +0 -71
- mindspore/profiler/parser/ascend_analysis/file_manager.py +0 -180
- mindspore/profiler/parser/ascend_analysis/function_event.py +0 -185
- mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +0 -136
- mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +0 -131
- mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +0 -104
- mindspore/profiler/parser/ascend_analysis/path_manager.py +0 -313
- mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +0 -123
- mindspore/profiler/parser/ascend_analysis/tlv_decoder.py +0 -86
- mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +0 -75
- mindspore/profiler/parser/ascend_cluster_generator.py +0 -116
- mindspore/profiler/parser/ascend_communicate_generator.py +0 -314
- mindspore/profiler/parser/ascend_flops_generator.py +0 -116
- mindspore/profiler/parser/ascend_fpbp_generator.py +0 -82
- mindspore/profiler/parser/ascend_hccl_generator.py +0 -271
- mindspore/profiler/parser/ascend_integrate_generator.py +0 -42
- mindspore/profiler/parser/ascend_memory_generator.py +0 -185
- mindspore/profiler/parser/ascend_msprof_exporter.py +0 -282
- mindspore/profiler/parser/ascend_msprof_generator.py +0 -187
- mindspore/profiler/parser/ascend_op_generator.py +0 -334
- mindspore/profiler/parser/ascend_steptrace_generator.py +0 -94
- mindspore/profiler/parser/ascend_timeline_generator.py +0 -545
- mindspore/profiler/parser/base_timeline_generator.py +0 -483
- mindspore/profiler/parser/container.py +0 -229
- mindspore/profiler/parser/cpu_gpu_timeline_generator.py +0 -697
- mindspore/profiler/parser/flops_parser.py +0 -531
- mindspore/profiler/parser/framework_enum.py +0 -111
- mindspore/profiler/parser/framework_parser.py +0 -464
- mindspore/profiler/parser/framework_struct.py +0 -61
- mindspore/profiler/parser/gpu_analysis/__init__.py +0 -14
- mindspore/profiler/parser/gpu_analysis/function_event.py +0 -44
- mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +0 -89
- mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +0 -72
- mindspore/profiler/parser/hccl_parser.py +0 -573
- mindspore/profiler/parser/hwts_log_parser.py +0 -122
- mindspore/profiler/parser/integrator.py +0 -526
- mindspore/profiler/parser/memory_usage_parser.py +0 -277
- mindspore/profiler/parser/minddata_analyzer.py +0 -800
- mindspore/profiler/parser/minddata_parser.py +0 -186
- mindspore/profiler/parser/minddata_pipeline_parser.py +0 -299
- mindspore/profiler/parser/op_intermediate_parser.py +0 -149
- mindspore/profiler/parser/optime_parser.py +0 -250
- mindspore/profiler/parser/profiler_info.py +0 -213
- mindspore/profiler/parser/step_trace_parser.py +0 -666
- mindspore/utils/hooks.py +0 -81
- /mindspore/common/{_auto_dynamic.py → dynamic_shape/_auto_dynamic.py} +0 -0
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/WHEEL +0 -0
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/entry_points.txt +0 -0
- {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/top_level.txt +0 -0
|
@@ -1,116 +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
|
-
"""trace step time analyse model"""
|
|
16
|
-
import csv
|
|
17
|
-
import fnmatch
|
|
18
|
-
import json
|
|
19
|
-
import logging
|
|
20
|
-
import os
|
|
21
|
-
import stat
|
|
22
|
-
|
|
23
|
-
import numpy as np
|
|
24
|
-
from mindspore.profiler.common.exceptions.exceptions import ProfilerIOException
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
def find_files(directory, pattern):
|
|
28
|
-
"""Find files from the directory"""
|
|
29
|
-
file_list = []
|
|
30
|
-
for root, _, file in os.walk(directory):
|
|
31
|
-
file.sort(key=lambda x: os.path.getctime(os.path.join(directory, x)))
|
|
32
|
-
for base in file:
|
|
33
|
-
if fnmatch.fnmatch(base, pattern):
|
|
34
|
-
filename = os.path.join(root, base)
|
|
35
|
-
file_list.append(filename)
|
|
36
|
-
return file_list
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
class AscendClusterGenerator:
|
|
40
|
-
"""Generate step trace time data from msprof*.json"""
|
|
41
|
-
|
|
42
|
-
def __init__(self, source_path):
|
|
43
|
-
self.root_path = source_path
|
|
44
|
-
self.msprof_data = np.array([])
|
|
45
|
-
self.step_trace_time = {'Step': None, 'Computing': 0, 'comunNotOverlp': 0, 'Overlapped': 0, 'Communication': 0,
|
|
46
|
-
'Free': 0, 'Stage': 0, 'Bubble': 0, 'comunNotOverlpRec': 0}
|
|
47
|
-
self.msprof_data_df = np.dtype([('name', object), ('ts', float), ('dur', float)])
|
|
48
|
-
self.trace_step_time_df = np.dtype(
|
|
49
|
-
[('Step', int), ('Computing', float), ('comunNotOverlp', float), ('Communication', float), ('Free', float),
|
|
50
|
-
('Stage', float), ('Bubble', float), ('comunNotOverlpRec', float)])
|
|
51
|
-
self.title = ['Step', 'Computing', 'Communication(Not Overlapped)', 'Overlapped', 'Communication', 'Free',
|
|
52
|
-
'Stage', 'Bubble', 'Communication(Not Overlapped and Exclude Receive)']
|
|
53
|
-
|
|
54
|
-
def parse(self):
|
|
55
|
-
"""
|
|
56
|
-
Analyse msprof json generate cluster data.
|
|
57
|
-
"""
|
|
58
|
-
self.read_msprof()
|
|
59
|
-
|
|
60
|
-
if (not isinstance(self.msprof_data, np.ndarray) or self.msprof_data.shape[0] == 0
|
|
61
|
-
or not self.msprof_data.tolist()):
|
|
62
|
-
return
|
|
63
|
-
|
|
64
|
-
self.step_trace_time['Computing'] = np.sum(self.msprof_data[self.msprof_data['name'] == 'Computing']['dur'])
|
|
65
|
-
self.step_trace_time['comunNotOverlp'] = np.sum(
|
|
66
|
-
self.msprof_data[self.msprof_data['name'] == 'Communication(Not Overlapped)']['dur'])
|
|
67
|
-
self.step_trace_time['Communication'] = np.sum(
|
|
68
|
-
self.msprof_data[self.msprof_data['name'] == 'Communication']['dur'])
|
|
69
|
-
self.step_trace_time['Free'] = np.sum(self.msprof_data[self.msprof_data['name'] == 'Free']['dur'])
|
|
70
|
-
self.step_trace_time['Bubble'] = np.sum(
|
|
71
|
-
self.msprof_data[np.char.find(self.msprof_data['name'].astype('str'), '/Receive-op')]['dur'])
|
|
72
|
-
|
|
73
|
-
self.step_trace_time['Overlapped'] = self.step_trace_time['Communication'] - self.step_trace_time[
|
|
74
|
-
'comunNotOverlp']
|
|
75
|
-
self.step_trace_time['Stage'] = np.max(self.msprof_data['ts'] + self.msprof_data['dur']) - np.min(
|
|
76
|
-
self.msprof_data['ts']) - self.step_trace_time['Bubble']
|
|
77
|
-
self.step_trace_time['comunNotOverlpRec'] = self.step_trace_time['comunNotOverlp'] - self.step_trace_time[
|
|
78
|
-
'Bubble']
|
|
79
|
-
|
|
80
|
-
def read_msprof(self):
|
|
81
|
-
"""
|
|
82
|
-
read msprof json information into memory.
|
|
83
|
-
"""
|
|
84
|
-
msprof_data = []
|
|
85
|
-
for file in find_files(self.root_path, "msprof_*.json"):
|
|
86
|
-
with open(file) as jsonfile:
|
|
87
|
-
for row in json.load(jsonfile):
|
|
88
|
-
name = row.get('name', '')
|
|
89
|
-
if name is None:
|
|
90
|
-
name = ''
|
|
91
|
-
if row.get('name') in ['Computing', 'Communication', 'Communication(Not Overlapped)',
|
|
92
|
-
'Free'] or name.find('/Receive-op'):
|
|
93
|
-
ts = row.get('ts', 0)
|
|
94
|
-
dur = row.get('dur', 0)
|
|
95
|
-
msprof_data.append(tuple([name, ts, dur]))
|
|
96
|
-
self.msprof_data = np.array(msprof_data, dtype=self.msprof_data_df)
|
|
97
|
-
|
|
98
|
-
def write(self, step_trace_time_path):
|
|
99
|
-
"""
|
|
100
|
-
Write the step trace time csv.
|
|
101
|
-
|
|
102
|
-
Args:
|
|
103
|
-
step_trace_time_path(str): step_trace_time.csv path.
|
|
104
|
-
"""
|
|
105
|
-
try:
|
|
106
|
-
with os.fdopen(os.open(step_trace_time_path,
|
|
107
|
-
os.O_WRONLY | os.O_CREAT | os.O_TRUNC, stat.S_IWUSR | stat.S_IRUSR),
|
|
108
|
-
'w') as step_trace_time:
|
|
109
|
-
writer = csv.writer(step_trace_time)
|
|
110
|
-
writer.writerow(self.title)
|
|
111
|
-
writer.writerow([v for _, v in self.step_trace_time.items()])
|
|
112
|
-
except (IOError, OSError) as err:
|
|
113
|
-
logging.critical('Error occurred when write step trace time file: %s', err)
|
|
114
|
-
raise ProfilerIOException() from err
|
|
115
|
-
if os.path.exists(step_trace_time_path):
|
|
116
|
-
os.chmod(step_trace_time_path, stat.S_IREAD | stat.S_IWRITE)
|
|
@@ -1,314 +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
|
-
"""communicate data analyze api file"""
|
|
16
|
-
import json
|
|
17
|
-
import re
|
|
18
|
-
import logging
|
|
19
|
-
import os
|
|
20
|
-
import stat
|
|
21
|
-
from collections import defaultdict
|
|
22
|
-
|
|
23
|
-
from mindspore.profiler.common.exceptions.exceptions import ProfilerIOException
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class AscendCommunicationGenerator:
|
|
27
|
-
"""
|
|
28
|
-
load and split communication info by step
|
|
29
|
-
"""
|
|
30
|
-
COMMUNICATION_TIME_INFO = "Communication Time Info"
|
|
31
|
-
START_TIMESTAMP = "Start Timestamp(us)"
|
|
32
|
-
COMMUNICATION_BANDWIDTH_INFO = "Communication Bandwidth Info"
|
|
33
|
-
HCOM_SEND = "Send"
|
|
34
|
-
HCOM_RECEIVE = "Receive"
|
|
35
|
-
TOTAL = "Total"
|
|
36
|
-
SYNCHRONIZATION_TIME_RATIO = "Synchronization Time Ratio"
|
|
37
|
-
SYNCHRONIZATION_TIME_MS = "Synchronization Time(ms)"
|
|
38
|
-
WAIT_TIME_RATIO = "Wait Time Ratio"
|
|
39
|
-
TRANSIT_TIME_MS = "Transit Time(ms)"
|
|
40
|
-
TRANSIT_SIZE_MB = "Transit Size(MB)"
|
|
41
|
-
SIZE_DISTRIBUTION = "Size Distribution"
|
|
42
|
-
WAIT_TIME_MS = "Wait Time(ms)"
|
|
43
|
-
BANDWIDTH_GB_S = "Bandwidth(GB/s)"
|
|
44
|
-
COMMUNICATION = "communication.json"
|
|
45
|
-
COMMUNICATION_MATRIX = "communication_matrix.json"
|
|
46
|
-
P2P = "p2p"
|
|
47
|
-
COLLECTIVE = "collective"
|
|
48
|
-
TRANSPORT_TYPE = "Transport Type"
|
|
49
|
-
PATTERN1 = re.compile(r"receive|send")
|
|
50
|
-
PATTERN2 = re.compile(r"invalid|broadcast|allreduce|reduce|"
|
|
51
|
-
r"allgather|reducescatter|scatter|alltoall|alltoallv|alltoallvc")
|
|
52
|
-
|
|
53
|
-
def __init__(self, source_path):
|
|
54
|
-
super().__init__()
|
|
55
|
-
self.root_path = source_path
|
|
56
|
-
self.step_list = [{"step_id": None, "start_ts": 0, "end_ts": float('inf'), "comm_ops": {}}]
|
|
57
|
-
self.output_communication = {}
|
|
58
|
-
self.output_matrix_data = {}
|
|
59
|
-
|
|
60
|
-
@staticmethod
|
|
61
|
-
def combine_size_distribution(op_dict: dict, total_dict: dict):
|
|
62
|
-
"""combine size distribution"""
|
|
63
|
-
for size, size_info in op_dict.items():
|
|
64
|
-
total_dict[size][0] += size_info[0]
|
|
65
|
-
total_dict[size][1] += size_info[1]
|
|
66
|
-
|
|
67
|
-
@staticmethod
|
|
68
|
-
def compute_ratio(dividend: float, divisor: float):
|
|
69
|
-
"""compute ratio"""
|
|
70
|
-
if abs(divisor) < 1e-15:
|
|
71
|
-
return 0
|
|
72
|
-
return round(dividend / divisor, 4)
|
|
73
|
-
|
|
74
|
-
def parse(self) -> None:
|
|
75
|
-
"""parse"""
|
|
76
|
-
self.generate_communication()
|
|
77
|
-
self.generate_matrix()
|
|
78
|
-
|
|
79
|
-
def generate_communication(self):
|
|
80
|
-
"""
|
|
81
|
-
generate communication.json
|
|
82
|
-
"""
|
|
83
|
-
communication_file = os.path.join(self.root_path, self.COMMUNICATION)
|
|
84
|
-
with open(communication_file) as file:
|
|
85
|
-
communication_data = json.load(file)
|
|
86
|
-
if not communication_data:
|
|
87
|
-
return
|
|
88
|
-
self.split_comm_op_by_step(communication_data)
|
|
89
|
-
|
|
90
|
-
for step_info in self.step_list:
|
|
91
|
-
step = "step" + step_info.get("step_id") if step_info.get("step_id") else "step"
|
|
92
|
-
self.output_communication[step] = self.get_communication_ops_dict(step_info.get("comm_ops"))
|
|
93
|
-
|
|
94
|
-
def generate_matrix(self):
|
|
95
|
-
"""generate matrix"""
|
|
96
|
-
communication_file = os.path.join(self.root_path, self.COMMUNICATION_MATRIX)
|
|
97
|
-
with open(communication_file) as file:
|
|
98
|
-
matrix_data = json.load(file)
|
|
99
|
-
if not matrix_data:
|
|
100
|
-
return
|
|
101
|
-
matrix_data_by_step = self.split_matrix_by_step(matrix_data)
|
|
102
|
-
|
|
103
|
-
for step, comm_matrix_data in matrix_data_by_step.items():
|
|
104
|
-
self.output_matrix_data[step] = self.get_matrix_ops_dict(comm_matrix_data)
|
|
105
|
-
|
|
106
|
-
def split_comm_op_by_step(self, communication_data: dict):
|
|
107
|
-
"""split comm op by step"""
|
|
108
|
-
if len(self.step_list) == 1:
|
|
109
|
-
self.step_list[0]["comm_ops"] = communication_data
|
|
110
|
-
for communication_op, communication_op_info in communication_data.items():
|
|
111
|
-
start_time = communication_op_info.get(self.COMMUNICATION_TIME_INFO, {}).get(self.START_TIMESTAMP)
|
|
112
|
-
for step_info in self.step_list:
|
|
113
|
-
if step_info.get("start_ts", -1) <= start_time <= step_info.get("end_ts", -1):
|
|
114
|
-
step_info.get("comm_ops", {})[communication_op] = communication_op_info
|
|
115
|
-
break
|
|
116
|
-
|
|
117
|
-
def split_communication_p2p_ops(self, op_data: dict):
|
|
118
|
-
"""
|
|
119
|
-
split communicate
|
|
120
|
-
"""
|
|
121
|
-
comm_op_dict = {self.P2P: {}, self.COLLECTIVE: {}}
|
|
122
|
-
for communication_op, communication_info in op_data.items():
|
|
123
|
-
if communication_op.find(self.HCOM_SEND) != -1 or communication_op.find(self.HCOM_RECEIVE) != -1:
|
|
124
|
-
comm_op_dict[self.P2P][communication_op] = communication_info
|
|
125
|
-
elif communication_op.startswith(self.TOTAL):
|
|
126
|
-
continue
|
|
127
|
-
else:
|
|
128
|
-
comm_op_dict[self.COLLECTIVE][communication_op] = communication_info
|
|
129
|
-
return comm_op_dict
|
|
130
|
-
|
|
131
|
-
def split_matrix_by_step(self, matrix_data: dict) -> dict:
|
|
132
|
-
"""
|
|
133
|
-
split matrix by step
|
|
134
|
-
"""
|
|
135
|
-
matrix_data_by_step = {}
|
|
136
|
-
if self.is_step_list_empty():
|
|
137
|
-
matrix_data_by_step["step"] = matrix_data
|
|
138
|
-
return matrix_data_by_step
|
|
139
|
-
|
|
140
|
-
for comm_op in matrix_data:
|
|
141
|
-
for step_info in self.step_list:
|
|
142
|
-
if comm_op in step_info.get("comm_ops", {}):
|
|
143
|
-
step = "step" + step_info.get("step_id") if step_info.get("step_id") else "step"
|
|
144
|
-
matrix_data_by_step.setdefault(step, {})[comm_op] = matrix_data.get(comm_op)
|
|
145
|
-
break
|
|
146
|
-
return matrix_data_by_step
|
|
147
|
-
|
|
148
|
-
def get_communication_ops_dict(self, op_data: dict) -> dict:
|
|
149
|
-
"""get communication ops dict"""
|
|
150
|
-
comm_op_dict = self.split_communication_p2p_ops(op_data)
|
|
151
|
-
self.compute_total_info(comm_op_dict[self.P2P])
|
|
152
|
-
self.compute_total_info(comm_op_dict[self.COLLECTIVE])
|
|
153
|
-
return comm_op_dict
|
|
154
|
-
|
|
155
|
-
def integrate_matrix_data(self, comm_op_dict_simple):
|
|
156
|
-
"""integrate the matrix data"""
|
|
157
|
-
comm_op_dict = defaultdict(dict)
|
|
158
|
-
for new_comm_op_name, data in comm_op_dict_simple.items():
|
|
159
|
-
data.sort(key=lambda x: x[self.BANDWIDTH_GB_S], reverse=True)
|
|
160
|
-
t_type = data[0].get(self.TRANSPORT_TYPE, '')
|
|
161
|
-
t_size = sum(x.get(self.TRANSIT_SIZE_MB, 0) for x in data)
|
|
162
|
-
t_time = sum(x.get(self.TRANSIT_TIME_MS, 0) for x in data)
|
|
163
|
-
bandwidth = self.compute_ratio(t_size, t_time)
|
|
164
|
-
|
|
165
|
-
link = new_comm_op_name[2]
|
|
166
|
-
|
|
167
|
-
comm_op_dict[f'{new_comm_op_name[0]}-top1@{new_comm_op_name[1]}'].update({link: data[0]})
|
|
168
|
-
comm_op_dict[f'{new_comm_op_name[0]}-middle@{new_comm_op_name[1]}'].update({link: data[len(data) // 2]})
|
|
169
|
-
comm_op_dict[f'{new_comm_op_name[0]}-bottom1@{new_comm_op_name[1]}'].update({link: data[-1]})
|
|
170
|
-
index2 = -2
|
|
171
|
-
index3 = -3
|
|
172
|
-
if len(data) == 1:
|
|
173
|
-
index2 = -1
|
|
174
|
-
index3 = -1
|
|
175
|
-
elif len(data) == 2:
|
|
176
|
-
index3 = -2
|
|
177
|
-
comm_op_dict[f'{new_comm_op_name[0]}-bottom2@{new_comm_op_name[1]}'].update({link: data[index2]})
|
|
178
|
-
comm_op_dict[f'{new_comm_op_name[0]}-bottom3@{new_comm_op_name[1]}'].update({link: data[index3]})
|
|
179
|
-
comm_op_dict[f'{new_comm_op_name[0]}-total@{new_comm_op_name[1]}'].update({link: {
|
|
180
|
-
self.TRANSPORT_TYPE: t_type,
|
|
181
|
-
self.TRANSIT_SIZE_MB: t_size,
|
|
182
|
-
self.TRANSIT_TIME_MS: t_time,
|
|
183
|
-
self.BANDWIDTH_GB_S: bandwidth
|
|
184
|
-
}})
|
|
185
|
-
return comm_op_dict
|
|
186
|
-
|
|
187
|
-
def get_matrix_ops_dict(self, op_data: dict) -> dict:
|
|
188
|
-
"""parse matrix data"""
|
|
189
|
-
comm_op_dict_simple_p2p = defaultdict(list)
|
|
190
|
-
comm_op_dict_simple_collective = defaultdict(list)
|
|
191
|
-
|
|
192
|
-
for communication_op, communication_info in op_data.items():
|
|
193
|
-
if communication_op.find(self.HCOM_SEND) != -1 or communication_op.find(self.HCOM_RECEIVE) != -1:
|
|
194
|
-
|
|
195
|
-
match_obj = self.PATTERN1.search(communication_op.lower())
|
|
196
|
-
comm_op_type = match_obj.group()
|
|
197
|
-
for link, data in communication_info.items():
|
|
198
|
-
new_comm_op_name = (comm_op_type, communication_op.split("@")[-1], link)
|
|
199
|
-
data['op_name'] = communication_op.split("@")[0]
|
|
200
|
-
comm_op_dict_simple_p2p[new_comm_op_name].append(data)
|
|
201
|
-
|
|
202
|
-
elif communication_op.startswith(self.TOTAL):
|
|
203
|
-
continue
|
|
204
|
-
else:
|
|
205
|
-
match_obj = self.PATTERN2.search(communication_op.lower())
|
|
206
|
-
if not match_obj:
|
|
207
|
-
comm_op_type = communication_op.lower().split('/')[-1].split('-op')[0]
|
|
208
|
-
logging.warning("Communication operator type not found communication_op: %s, use comm_op_type: %s",
|
|
209
|
-
communication_op, comm_op_type)
|
|
210
|
-
else:
|
|
211
|
-
comm_op_type = match_obj.group()
|
|
212
|
-
for link, data in communication_info.items():
|
|
213
|
-
new_comm_op_name = (comm_op_type, communication_op.split("@")[-1], link)
|
|
214
|
-
data['op_name'] = communication_op.split("@")[0]
|
|
215
|
-
comm_op_dict_simple_collective[new_comm_op_name].append(data)
|
|
216
|
-
|
|
217
|
-
comm_op_dict = {self.P2P: self.integrate_matrix_data(comm_op_dict_simple_p2p),
|
|
218
|
-
self.COLLECTIVE: self.integrate_matrix_data(comm_op_dict_simple_collective)}
|
|
219
|
-
|
|
220
|
-
return comm_op_dict
|
|
221
|
-
|
|
222
|
-
def is_step_list_empty(self):
|
|
223
|
-
"""is step list empty"""
|
|
224
|
-
for step_info in self.step_list:
|
|
225
|
-
if step_info.get("comm_ops"):
|
|
226
|
-
return False
|
|
227
|
-
return True
|
|
228
|
-
|
|
229
|
-
def compute_total_info(self, comm_ops: dict):
|
|
230
|
-
"""
|
|
231
|
-
compute total info
|
|
232
|
-
"""
|
|
233
|
-
if not comm_ops:
|
|
234
|
-
return
|
|
235
|
-
total_time_info_dict = defaultdict(float)
|
|
236
|
-
total_bandwidth_info_dict = {}
|
|
237
|
-
for _, communication_op_info in comm_ops.items():
|
|
238
|
-
for com_info, com_info_dict in communication_op_info.items():
|
|
239
|
-
if com_info == self.COMMUNICATION_TIME_INFO:
|
|
240
|
-
self.combine_time_info(com_info_dict, total_time_info_dict)
|
|
241
|
-
if com_info == self.COMMUNICATION_BANDWIDTH_INFO:
|
|
242
|
-
self.combine_bandwidth_info(com_info_dict, total_bandwidth_info_dict)
|
|
243
|
-
self.compute_time_ratio(total_time_info_dict)
|
|
244
|
-
self.compute_bandwidth_ratio(total_bandwidth_info_dict)
|
|
245
|
-
comm_ops['Total Op Info'] = {
|
|
246
|
-
self.COMMUNICATION_TIME_INFO: total_time_info_dict,
|
|
247
|
-
self.COMMUNICATION_BANDWIDTH_INFO: total_bandwidth_info_dict
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
def combine_time_info(self, com_info_dict: dict, total_time_info_dict: dict):
|
|
251
|
-
"""combine time info"""
|
|
252
|
-
ratio_list = [self.WAIT_TIME_RATIO, self.SYNCHRONIZATION_TIME_RATIO]
|
|
253
|
-
for time_info in com_info_dict:
|
|
254
|
-
if time_info not in ratio_list and time_info != self.START_TIMESTAMP:
|
|
255
|
-
total_time_info_dict[time_info] += com_info_dict.get(time_info)
|
|
256
|
-
|
|
257
|
-
def combine_bandwidth_info(self, com_info_dict: dict, total_bandwidth_info_dict: dict):
|
|
258
|
-
"""
|
|
259
|
-
combine bandwidth info
|
|
260
|
-
"""
|
|
261
|
-
add_list = [self.TRANSIT_TIME_MS, self.TRANSIT_SIZE_MB]
|
|
262
|
-
dict_list = [self.SIZE_DISTRIBUTION]
|
|
263
|
-
for transport_type, part_transport_dict in com_info_dict.items():
|
|
264
|
-
if transport_type not in total_bandwidth_info_dict:
|
|
265
|
-
total_bandwidth_info_dict[transport_type] = {
|
|
266
|
-
self.TRANSIT_TIME_MS: 0,
|
|
267
|
-
self.TRANSIT_SIZE_MB: 0,
|
|
268
|
-
self.SIZE_DISTRIBUTION: defaultdict(lambda: [0, 0])
|
|
269
|
-
}
|
|
270
|
-
for bandwidth_msg, value in part_transport_dict.items():
|
|
271
|
-
if bandwidth_msg in add_list:
|
|
272
|
-
total_bandwidth_info_dict[transport_type][bandwidth_msg] += value
|
|
273
|
-
if bandwidth_msg in dict_list:
|
|
274
|
-
self.combine_size_distribution(value, total_bandwidth_info_dict[transport_type][bandwidth_msg])
|
|
275
|
-
|
|
276
|
-
def compute_time_ratio(self, total_time_info_dict: dict):
|
|
277
|
-
"""compute time ratio"""
|
|
278
|
-
total_time_info_dict[self.WAIT_TIME_RATIO] = \
|
|
279
|
-
self.compute_ratio(total_time_info_dict.get(self.WAIT_TIME_MS, 0),
|
|
280
|
-
total_time_info_dict.get(self.WAIT_TIME_MS, 0) +
|
|
281
|
-
total_time_info_dict.get(self.TRANSIT_TIME_MS, 0))
|
|
282
|
-
total_time_info_dict[self.SYNCHRONIZATION_TIME_RATIO] = \
|
|
283
|
-
self.compute_ratio(total_time_info_dict.get(self.SYNCHRONIZATION_TIME_MS, 0),
|
|
284
|
-
total_time_info_dict.get(self.TRANSIT_TIME_MS, 0) +
|
|
285
|
-
total_time_info_dict.get(self.SYNCHRONIZATION_TIME_MS, 0))
|
|
286
|
-
|
|
287
|
-
def compute_bandwidth_ratio(self, total_bandwidth_info_dict: dict):
|
|
288
|
-
"""compute bandwidth ratio"""
|
|
289
|
-
for _, bandwidth_dict in total_bandwidth_info_dict.items():
|
|
290
|
-
self.compute_ratio(bandwidth_dict.get(self.TRANSIT_SIZE_MB, 0), bandwidth_dict.get(self.TRANSIT_TIME_MS, 0))
|
|
291
|
-
|
|
292
|
-
def write(self, communication_file_path, communication_matrix_file_path):
|
|
293
|
-
"""
|
|
294
|
-
write communication file and communication matrix file
|
|
295
|
-
"""
|
|
296
|
-
try:
|
|
297
|
-
with os.fdopen(os.open(communication_file_path,
|
|
298
|
-
os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600), 'w') as json_file:
|
|
299
|
-
json.dump(self.output_communication, json_file)
|
|
300
|
-
except (IOError, OSError) as err:
|
|
301
|
-
logging.critical('Error occurred when write communication file: %s', err)
|
|
302
|
-
raise ProfilerIOException() from err
|
|
303
|
-
if os.path.exists(communication_file_path):
|
|
304
|
-
os.chmod(communication_file_path, stat.S_IREAD | stat.S_IWRITE)
|
|
305
|
-
|
|
306
|
-
try:
|
|
307
|
-
with os.fdopen(os.open(communication_matrix_file_path,
|
|
308
|
-
os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600), 'w') as json_file:
|
|
309
|
-
json.dump(self.output_matrix_data, json_file)
|
|
310
|
-
except (IOError, OSError) as err:
|
|
311
|
-
logging.critical('Error occurred when write communication matrix file: %s', err)
|
|
312
|
-
raise ProfilerIOException() from err
|
|
313
|
-
if os.path.exists(communication_matrix_file_path):
|
|
314
|
-
os.chmod(communication_matrix_file_path, stat.S_IREAD | stat.S_IWRITE)
|
|
@@ -1,116 +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
|
-
"""flops analyse model"""
|
|
16
|
-
import csv
|
|
17
|
-
import json
|
|
18
|
-
import logging
|
|
19
|
-
import os
|
|
20
|
-
import stat
|
|
21
|
-
|
|
22
|
-
import numpy as np
|
|
23
|
-
from mindspore import log as logger
|
|
24
|
-
from mindspore.profiler.common.exceptions.exceptions import ProfilerIOException
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
class AscendFlopsGenerator:
|
|
28
|
-
"""Generate ascend flops data from DataFrame."""
|
|
29
|
-
|
|
30
|
-
def __init__(self, op_summary, launch_ops, pretty=False):
|
|
31
|
-
self.op_summary = op_summary
|
|
32
|
-
self.launch_ops = launch_ops
|
|
33
|
-
self.flops_dt = np.dtype(
|
|
34
|
-
[('full_kernel_name', object), ('MFLOPs(10^6 cube)', float), ('GFLOPS(10^9 cube)', float),
|
|
35
|
-
('MFLOPs(10^6 vector)', float), ('GFLOPS(10^9 vector)', float)])
|
|
36
|
-
self.flops = None
|
|
37
|
-
self.flops_summary = None
|
|
38
|
-
self._full_kernel_name = None
|
|
39
|
-
self.pretty = pretty
|
|
40
|
-
|
|
41
|
-
@property
|
|
42
|
-
def indent(self):
|
|
43
|
-
indent = 1 if self.pretty else None
|
|
44
|
-
return indent
|
|
45
|
-
|
|
46
|
-
def parse(self):
|
|
47
|
-
"""Analyse the op_summary data generate flops data."""
|
|
48
|
-
|
|
49
|
-
self.flops = np.empty((len(self.op_summary)), dtype=self.flops_dt)
|
|
50
|
-
self._set_full_kernel_name(self.op_summary, self.launch_ops)
|
|
51
|
-
nonzero_duration = self.op_summary['Task Duration'] != 0
|
|
52
|
-
self.flops['full_kernel_name'] = self._full_kernel_name
|
|
53
|
-
self.flops['MFLOPs(10^6 cube)'] = self.op_summary['cube_fops'] * 1e-6
|
|
54
|
-
self.flops['GFLOPS(10^9 cube)'] = np.where(nonzero_duration, self.op_summary['cube_fops'] / self.op_summary[
|
|
55
|
-
'Task Duration'] * 1e-6, 0)
|
|
56
|
-
self.flops['MFLOPs(10^6 vector)'] = self.op_summary['vector_fops'] * 1e-6
|
|
57
|
-
self.flops['GFLOPS(10^9 vector)'] = self.op_summary['vector_fops'] / self.op_summary['Task Duration'] * 1e-6
|
|
58
|
-
self.flops['GFLOPS(10^9 vector)'] = np.where(nonzero_duration, self.op_summary['vector_fops'] / self.op_summary[
|
|
59
|
-
'Task Duration'] * 1e-6, 0)
|
|
60
|
-
|
|
61
|
-
cube_flops = 0
|
|
62
|
-
vec_flops = 0
|
|
63
|
-
if np.sum(self.op_summary['Task Duration']) != 0:
|
|
64
|
-
cube_flops = round(np.sum(self.flops['GFLOPS(10^9 cube)']) / np.sum(self.op_summary['Task Duration']), 4)
|
|
65
|
-
vec_flops = round(np.sum(self.flops['GFLOPS(10^9 vector)']) / np.sum(self.op_summary['Task Duration']), 4)
|
|
66
|
-
|
|
67
|
-
self.flops_summary = {
|
|
68
|
-
'cube_FLOPs': round(float(np.sum(self.flops['MFLOPs(10^6 cube)'])), 4),
|
|
69
|
-
'cube_FLOPS': cube_flops,
|
|
70
|
-
'vec_FLOPs': round(float(np.sum(self.flops['MFLOPs(10^6 vector)'])), 4),
|
|
71
|
-
'vec_FLOPS': vec_flops
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
def write(self, flops_path, flops_summary_path):
|
|
75
|
-
"""
|
|
76
|
-
Write the flops.csv and flops_summary.json
|
|
77
|
-
|
|
78
|
-
Args:
|
|
79
|
-
flops_path(str): flops.csv path.
|
|
80
|
-
flops_summary_path(str): flops_summary.json path.
|
|
81
|
-
"""
|
|
82
|
-
try:
|
|
83
|
-
with os.fdopen(os.open(flops_path,
|
|
84
|
-
os.O_WRONLY | os.O_CREAT | os.O_TRUNC, stat.S_IWUSR | stat.S_IRUSR), 'w') as fp:
|
|
85
|
-
writer = csv.writer(fp)
|
|
86
|
-
writer.writerow(self.flops.dtype.names)
|
|
87
|
-
writer.writerows(self.flops.tolist())
|
|
88
|
-
except (IOError, OSError) as err:
|
|
89
|
-
logging.critical('Errot occurred when write flops file: %s', err)
|
|
90
|
-
raise ProfilerIOException() from err
|
|
91
|
-
if os.path.exists(flops_path):
|
|
92
|
-
os.chmod(flops_path, stat.S_IREAD | stat.S_IWRITE)
|
|
93
|
-
|
|
94
|
-
try:
|
|
95
|
-
with os.fdopen(os.open(flops_summary_path,
|
|
96
|
-
os.O_WRONLY | os.O_CREAT | os.O_TRUNC, stat.S_IWUSR | stat.S_IRUSR),
|
|
97
|
-
'w') as json_file:
|
|
98
|
-
json.dump(self.flops_summary, json_file, indent=self.indent)
|
|
99
|
-
except (IOError, OSError) as err:
|
|
100
|
-
logging.critical('Errot occurred when write step trace point info file: %s', err)
|
|
101
|
-
raise ProfilerIOException() from err
|
|
102
|
-
if os.path.exists(flops_summary_path):
|
|
103
|
-
os.chmod(flops_summary_path, stat.S_IREAD | stat.S_IWRITE)
|
|
104
|
-
|
|
105
|
-
def _set_full_kernel_name(self, op_summary, launch_ops):
|
|
106
|
-
"""update full kernel name"""
|
|
107
|
-
self._full_kernel_name = op_summary['Op Name']
|
|
108
|
-
|
|
109
|
-
if launch_ops and len(launch_ops) != len(op_summary):
|
|
110
|
-
logger.error("Size mismatch between op_summary and launch_ops!")
|
|
111
|
-
launch_ops = []
|
|
112
|
-
|
|
113
|
-
for index, launch_op in enumerate(launch_ops):
|
|
114
|
-
if not launch_op:
|
|
115
|
-
continue
|
|
116
|
-
self._full_kernel_name[index] = f"{launch_op}/{self._full_kernel_name[index]}"
|
|
@@ -1,82 +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
|
-
"""fp bp and is_training_mode_flag analyse model"""
|
|
16
|
-
import json
|
|
17
|
-
import logging
|
|
18
|
-
import os
|
|
19
|
-
import stat
|
|
20
|
-
from collections import defaultdict
|
|
21
|
-
|
|
22
|
-
import numpy as np
|
|
23
|
-
from mindspore.profiler.common.exceptions.exceptions import ProfilerIOException
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class AscendFPBPGenerator:
|
|
27
|
-
"""Generate ascend fp bp data from DataFrame."""
|
|
28
|
-
|
|
29
|
-
def __init__(self, op_summary, steptrace, pretty=False):
|
|
30
|
-
self.op_summary = op_summary
|
|
31
|
-
self.steptrace = steptrace
|
|
32
|
-
self.points = None
|
|
33
|
-
self.pretty = pretty
|
|
34
|
-
|
|
35
|
-
@property
|
|
36
|
-
def indent(self):
|
|
37
|
-
indent = 1 if self.pretty else None
|
|
38
|
-
return indent
|
|
39
|
-
|
|
40
|
-
def parse(self):
|
|
41
|
-
"""Analyse the op_summary and steptrace data generate fpbp data."""
|
|
42
|
-
is_training_mode_flag = False
|
|
43
|
-
points = None
|
|
44
|
-
|
|
45
|
-
steptrace = self.steptrace[self.steptrace['Iteration ID'] == 1]
|
|
46
|
-
steptrace = steptrace[(steptrace['FP Start'] != 0) & (steptrace['BP End'] != 0)]
|
|
47
|
-
if steptrace.size:
|
|
48
|
-
is_training_mode_flag = True
|
|
49
|
-
op_summary = self.op_summary[np.argsort(self.op_summary['Task Start Time'])]
|
|
50
|
-
fp_index = np.searchsorted(op_summary['Task Start Time'], steptrace['FP Start'], side='right') - 1
|
|
51
|
-
bp_index = np.searchsorted(op_summary['Task Start Time'] + op_summary['Task Duration'], steptrace['BP End'],
|
|
52
|
-
side='left') - 1
|
|
53
|
-
points = defaultdict(dict)
|
|
54
|
-
for i in range(steptrace.size):
|
|
55
|
-
model_id = f"model_{steptrace[i]['Iteration ID']}"
|
|
56
|
-
points[model_id]['fp_start'] = op_summary[fp_index[i]]['Op Name']
|
|
57
|
-
points[model_id]['bp_end'] = op_summary[bp_index[i]]['Op Name']
|
|
58
|
-
self.points = defaultdict()
|
|
59
|
-
self.points['fp_start'] = op_summary[fp_index[0]]['Op Name']
|
|
60
|
-
self.points['bp_end'] = op_summary[bp_index[0]]['Op Name']
|
|
61
|
-
|
|
62
|
-
return points, is_training_mode_flag
|
|
63
|
-
|
|
64
|
-
def write(self, step_trace_point_info_path):
|
|
65
|
-
"""
|
|
66
|
-
Write the flops.csv and flops_summary.json
|
|
67
|
-
|
|
68
|
-
Args:
|
|
69
|
-
step_trace_point_info_path(str): step_trace_point_info.json path.
|
|
70
|
-
"""
|
|
71
|
-
if not self.points:
|
|
72
|
-
return
|
|
73
|
-
try:
|
|
74
|
-
with os.fdopen(os.open(step_trace_point_info_path,
|
|
75
|
-
os.O_WRONLY | os.O_CREAT | os.O_TRUNC, stat.S_IWUSR | stat.S_IRUSR),
|
|
76
|
-
'w') as json_file:
|
|
77
|
-
json.dump(self.points, json_file, indent=self.indent)
|
|
78
|
-
except (IOError, OSError) as err:
|
|
79
|
-
logging.critical('Errot occurred when write step trace point info file: %s', err)
|
|
80
|
-
raise ProfilerIOException() from err
|
|
81
|
-
if os.path.exists(step_trace_point_info_path):
|
|
82
|
-
os.chmod(step_trace_point_info_path, stat.S_IREAD | stat.S_IWRITE)
|