mindspore 2.3.0__cp39-none-any.whl → 2.3.0rc2__cp39-none-any.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/Third_Party_Open_Source_Software_Notice +0 -1512
- mindspore/__init__.py +1 -2
- mindspore/_c_dataengine.cpython-39-aarch64-linux-gnu.so +0 -0
- mindspore/_c_expression.cpython-39-aarch64-linux-gnu.so +0 -0
- mindspore/_c_mindrecord.cpython-39-aarch64-linux-gnu.so +0 -0
- mindspore/_checkparam.py +25 -5
- mindspore/_extends/graph_kernel/model/graph_parallel.py +1 -1
- mindspore/_extends/parse/__init__.py +2 -2
- mindspore/_extends/parse/compile_config.py +0 -29
- mindspore/_extends/parse/namespace.py +2 -2
- mindspore/_extends/parse/parser.py +5 -21
- mindspore/_extends/parse/resources.py +7 -5
- mindspore/_extends/parse/standard_method.py +59 -40
- mindspore/_mindspore_offline_debug.cpython-39-aarch64-linux-gnu.so +0 -0
- mindspore/amp.py +5 -26
- mindspore/bin/cache_admin +0 -0
- mindspore/bin/cache_server +0 -0
- mindspore/boost/adasum.py +1 -1
- mindspore/boost/base.py +1 -1
- mindspore/boost/boost_cell_wrapper.py +1 -1
- mindspore/boost/grad_freeze.py +2 -2
- mindspore/boost/less_batch_normalization.py +6 -9
- mindspore/common/__init__.py +1 -8
- mindspore/common/_register_for_tensor.py +9 -8
- mindspore/common/api.py +65 -275
- mindspore/common/dtype.py +4 -8
- mindspore/common/dump.py +5 -2
- mindspore/common/jit_config.py +1 -1
- mindspore/common/lazy_inline.py +2 -14
- mindspore/common/parameter.py +15 -14
- mindspore/common/recompute.py +5 -20
- mindspore/common/sparse_tensor.py +6 -21
- mindspore/common/tensor.py +52 -100
- mindspore/communication/__init__.py +11 -6
- mindspore/communication/management.py +94 -92
- mindspore/context.py +18 -180
- mindspore/dataset/engine/datasets.py +46 -69
- mindspore/dataset/engine/datasets_user_defined.py +53 -72
- mindspore/dataset/engine/datasets_vision.py +2 -2
- mindspore/dataset/engine/queue.py +38 -56
- mindspore/dataset/engine/validators.py +5 -11
- mindspore/dataset/vision/__init__.py +5 -5
- mindspore/dataset/vision/c_transforms.py +5 -5
- mindspore/dataset/vision/py_transforms_util.py +1 -1
- mindspore/dataset/vision/transforms.py +46 -591
- mindspore/dataset/vision/utils.py +1 -121
- mindspore/dataset/vision/validators.py +3 -9
- mindspore/hal/__init__.py +1 -7
- mindspore/hal/device.py +1 -1
- mindspore/include/api/model.h +0 -3
- mindspore/include/dataset/vision.h +2 -54
- mindspore/include/mindapi/base/types.h +0 -1
- mindspore/lib/libdnnl.so.2 +0 -0
- mindspore/lib/libmindspore.so +0 -0
- mindspore/lib/libmindspore_backend.so +0 -0
- mindspore/lib/libmindspore_common.so +0 -0
- mindspore/lib/libmindspore_core.so +0 -0
- mindspore/lib/libmindspore_glog.so.0 +0 -0
- mindspore/lib/libmindspore_gpr.so.15 +0 -0
- mindspore/lib/libmindspore_grpc++.so.1 +0 -0
- mindspore/lib/libmindspore_grpc.so.15 +0 -0
- mindspore/lib/libmindspore_shared_lib.so +0 -0
- mindspore/lib/libmpi_adapter.so +0 -0
- mindspore/lib/libmpi_collective.so +0 -0
- mindspore/lib/libnnacl.so +0 -0
- mindspore/lib/libopencv_core.so.4.5 +0 -0
- mindspore/lib/libps_cache.so +0 -0
- mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/ai_core/tbe/config/ascend310p/aic-ascend310p-ops-info.json +0 -35
- mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/ai_core/tbe/custom_aicore_ops_impl/kv_cache_mgr.py +0 -2
- mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/vector_core/tbe/custom_aicore_ops_impl/kv_cache_mgr.py +0 -2
- mindspore/lib/plugin/ascend/custom_aicpu_ops/op_impl/cpu/aicpu_kernel/impl/libcust_cpu_kernels.so +0 -0
- mindspore/lib/plugin/ascend/custom_aicpu_ops/op_impl/cpu/config/cust_aicpu_kernel.json +0 -72
- mindspore/lib/plugin/ascend/custom_aicpu_ops/op_proto/libcust_op_proto.so +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_api/include/{aclnn_all_finite.h → aclnn_add_custom.h} +11 -9
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_api/include/aclnn_decoder_kv_cache.h +1 -1
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_api/include/aclnn_prompt_kv_cache.h +1 -1
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_api/lib/libcust_opapi.so +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/config/ascend310p/aic-ascend310p-ops-info.json +12 -184
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/config/ascend910/aic-ascend910-ops-info.json +15 -7
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/config/ascend910b/aic-ascend910b-ops-info.json +15 -7
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/add_custom.cpp +81 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/add_custom.py +134 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/decoder_kv_cache.py +31 -77
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/prompt_kv_cache.py +31 -77
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/op_tiling/lib/linux/aarch64/libcust_opmaster_rt2.0.so +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/op_tiling/liboptiling.so +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_proto/inc/op_proto.h +5 -4
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_proto/lib/linux/aarch64/libcust_opsproto_rt2.0.so +0 -0
- mindspore/lib/plugin/ascend/libascend_collective.so +0 -0
- mindspore/lib/plugin/ascend/libdvpp_utils.so +0 -0
- mindspore/lib/plugin/ascend/libhccl_plugin.so +0 -0
- mindspore/lib/plugin/ascend/liblowlatency_collective.so +0 -0
- mindspore/lib/plugin/ascend/libmindspore_cpu_kernels.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/bin/DeviceBin +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/bin/PkgInspect +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/bin/op_man +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/device/ascend910b/bin/ascend910b.bin +286 -275
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/host/libasdops_cann_host.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/host/libasdops_host.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/lib/libasdops.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/lib/libasdops_static.a +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/add/add_impl.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/apply_rotary_pos_emb_impl.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/asdop/asd_op_impl.h +0 -3
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/backend_param.h +0 -5
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/cast/cast_tiling.h +45 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/compare/compare_impl.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/flash_attention_score/flash_attention_score_impl.h +4 -8
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/flash_attention_score/flash_attention_score_tiling.h +4 -11
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/flash_attention_score/kernel/flash_attention_score_mix_hwsync.h +0 -18
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/internal_kernel.h +0 -6
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/internal_rtbackend.h +75 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul/kernel/matmul.h +5 -5
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul/matmul_impl.h +3 -18
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_common/pp_matmul_common_tiling.h +5 -5
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_common/pp_matmul_info.h +2 -2
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_common/tiling_data.h +3 -36
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_stridedslice/kernel/matmul_stridedslice_fusion.h +2 -2
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_stridedslice/matmul_stridedslice_fusion_impl.h +4 -22
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/op_param.h +2 -16
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/paged_attention/kernel/paged_attention_mix_hwsync.h +3 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/paged_attention/paged_attention_impl.h +4 -5
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/paged_attention/paged_attention_tiling.h +4 -9
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/attention_param.h +2 -5
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/matmul_ext_param.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/matmul_qkv_param.h +4 -10
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/sub_param.h +12 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/rms_norm_impl.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/sub/sub_impl.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/tune_repo/matmul_table.h +1 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/backend.h +2 -10
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/elewise_utils.h +1 -5
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log.h +0 -1
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log_tiling.h +0 -17
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/math.h +7 -2
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libAdd_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libSub_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libadd_layernorm_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libadd_rms_norm_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libapply_rotary_pos_emb_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libcast_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libgelu_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libmatmul_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libmatmul_stridedslice_fusion_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libms_kernels_internal.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libnot_equal_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libreshape_and_cache_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/librms_norm_impl.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bnsd_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bnsd_tri_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bsh_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bsh_tri_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bnsd_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bnsd_tri_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bsh_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bsh_tri_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_bf16_bnsd_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_bf16_bsh_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_fp16_bnsd_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_fp16_bsh_full_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/lib/liblcal.so +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/lib/liblccl_wrapper.so +0 -0
- mindspore/lib/plugin/libmindspore_ascend.so.2 +0 -0
- mindspore/mindrecord/filewriter.py +2 -2
- mindspore/mint/__init__.py +40 -720
- mindspore/mint/nn/__init__.py +7 -89
- mindspore/mint/nn/functional.py +16 -165
- mindspore/mint/optim/adamw.py +16 -15
- mindspore/nn/__init__.py +2 -0
- mindspore/nn/cell.py +98 -97
- mindspore/nn/extend/basic.py +2 -2
- mindspore/nn/extend/embedding.py +1 -1
- mindspore/nn/extend/layer/normalization.py +5 -7
- mindspore/nn/generator.py +297 -0
- mindspore/nn/layer/activation.py +3 -4
- mindspore/nn/layer/basic.py +16 -79
- mindspore/nn/layer/conv.py +8 -17
- mindspore/nn/layer/embedding.py +4 -1
- mindspore/nn/layer/math.py +1 -1
- mindspore/nn/layer/normalization.py +1 -1
- mindspore/nn/layer/pooling.py +0 -5
- mindspore/nn/layer/rnn_cells.py +2 -2
- mindspore/nn/loss/loss.py +19 -19
- mindspore/nn/optim/adasum.py +1 -1
- mindspore/nn/optim/sgd.py +2 -3
- mindspore/nn/probability/distribution/exponential.py +1 -1
- mindspore/nn/probability/distribution/geometric.py +1 -1
- mindspore/nn/probability/distribution/logistic.py +1 -1
- mindspore/nn/wrap/cell_wrapper.py +1 -25
- mindspore/nn/wrap/loss_scale.py +1 -24
- mindspore/numpy/array_ops.py +1 -5
- mindspore/numpy/dtypes.py +3 -3
- mindspore/numpy/math_ops.py +8 -8
- mindspore/ops/__init__.py +1 -1
- mindspore/ops/_grad_experimental/grad_comm_ops.py +16 -75
- mindspore/ops/_vmap/vmap_array_ops.py +0 -27
- mindspore/ops/_vmap/vmap_math_ops.py +1 -29
- mindspore/ops/_vmap/vmap_nn_ops.py +18 -19
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +8 -34
- mindspore/ops/auto_generate/gen_arg_dtype_cast.py +9 -2
- mindspore/ops/auto_generate/gen_arg_handler.py +0 -26
- mindspore/ops/auto_generate/gen_extend_func.py +27 -603
- mindspore/ops/auto_generate/gen_ops_def.py +203 -993
- mindspore/ops/auto_generate/gen_ops_prim.py +402 -1946
- mindspore/ops/auto_generate/pyboost_inner_prim.py +20 -90
- mindspore/ops/composite/base.py +6 -3
- mindspore/ops/composite/math_ops.py +1 -1
- mindspore/ops/composite/multitype_ops/_compile_utils.py +17 -24
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -1
- mindspore/ops/extend/__init__.py +3 -2
- mindspore/ops/extend/array_func.py +51 -10
- mindspore/ops/extend/nn_func.py +78 -2
- mindspore/ops/function/__init__.py +13 -8
- mindspore/ops/function/array_func.py +179 -455
- mindspore/ops/function/clip_func.py +1 -1
- mindspore/ops/function/grad/grad_func.py +3 -3
- mindspore/ops/function/math_func.py +103 -117
- mindspore/ops/function/nn_func.py +163 -275
- mindspore/ops/function/other_func.py +2 -2
- mindspore/ops/function/random_func.py +69 -202
- mindspore/ops/function/sparse_func.py +4 -4
- mindspore/ops/functional.py +327 -332
- mindspore/ops/operations/__init__.py +3 -13
- mindspore/ops/operations/_grad_ops.py +27 -3
- mindspore/ops/operations/_inner_ops.py +356 -53
- mindspore/ops/operations/_rl_inner_ops.py +2 -2
- mindspore/ops/operations/_tensor_array.py +8 -8
- mindspore/ops/operations/array_ops.py +65 -82
- mindspore/ops/operations/comm_ops.py +93 -784
- mindspore/ops/operations/custom_ops.py +28 -51
- mindspore/ops/operations/debug_ops.py +4 -4
- mindspore/ops/operations/inner_ops.py +2 -2
- mindspore/ops/operations/manually_defined/ops_def.py +4 -304
- mindspore/ops/operations/math_ops.py +50 -3
- mindspore/ops/operations/nn_ops.py +247 -14
- mindspore/ops/operations/other_ops.py +3 -3
- mindspore/ops/operations/random_ops.py +1 -1
- mindspore/ops/operations/sparse_ops.py +1 -1
- mindspore/ops/primitive.py +8 -9
- mindspore/ops/silent_check.py +5 -5
- mindspore/ops_generate/arg_dtype_cast.py +9 -2
- mindspore/ops_generate/arg_handler.py +0 -26
- mindspore/ops_generate/gen_aclnn_implement.py +4 -1
- mindspore/ops_generate/gen_ops.py +4 -26
- mindspore/ops_generate/gen_pyboost_func.py +12 -41
- mindspore/ops_generate/gen_utils.py +0 -21
- mindspore/ops_generate/pyboost_utils.py +2 -7
- mindspore/ops_generate/template.py +0 -1
- mindspore/parallel/_auto_parallel_context.py +1 -21
- mindspore/parallel/_tensor.py +5 -0
- mindspore/parallel/_transformer/transformer.py +1 -1
- mindspore/parallel/_utils.py +1 -15
- mindspore/parallel/algo_parameter_config.py +3 -1
- mindspore/parallel/checkpoint_transform.py +9 -12
- mindspore/parallel/cluster/process_entity/_api.py +29 -28
- mindspore/parallel/cluster/process_entity/_utils.py +3 -13
- mindspore/parallel/cluster/run.py +16 -13
- mindspore/parallel/parameter_broadcast.py +2 -2
- mindspore/parallel/shard.py +17 -31
- mindspore/profiler/__init__.py +2 -3
- mindspore/profiler/common/util.py +2 -107
- mindspore/profiler/envprofiling.py +1 -1
- mindspore/profiler/parser/ascend_analysis/constant.py +21 -8
- mindspore/profiler/parser/ascend_analysis/file_manager.py +0 -82
- mindspore/profiler/parser/ascend_analysis/function_event.py +28 -43
- mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +27 -49
- mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +10 -15
- mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +20 -25
- mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +5 -5
- mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +1 -10
- mindspore/profiler/parser/ascend_hccl_generator.py +1 -4
- mindspore/profiler/parser/ascend_msprof_exporter.py +22 -43
- mindspore/profiler/parser/ascend_timeline_generator.py +5 -7
- mindspore/profiler/parser/minddata_parser.py +3 -72
- mindspore/profiler/profiling.py +59 -176
- mindspore/rewrite/api/node.py +1 -1
- mindspore/rewrite/common/namespace.py +5 -5
- mindspore/rewrite/parsers/assign_parser.py +0 -2
- mindspore/rewrite/parsers/class_def_parser.py +4 -8
- mindspore/run_check/_check_version.py +1 -1
- mindspore/scipy/fft.py +3 -1
- mindspore/scipy/linalg.py +3 -2
- mindspore/scipy/ops.py +3 -5
- mindspore/scipy/optimize/__init__.py +2 -2
- mindspore/train/__init__.py +4 -4
- mindspore/train/anf_ir_pb2.py +2 -8
- mindspore/train/callback/__init__.py +2 -5
- mindspore/train/callback/_backup_and_restore.py +2 -2
- mindspore/train/callback/_checkpoint.py +16 -104
- mindspore/train/callback/_landscape.py +1 -1
- mindspore/train/callback/_time_monitor.py +1 -1
- mindspore/train/data_sink.py +4 -5
- mindspore/train/dataset_helper.py +20 -45
- mindspore/train/model.py +38 -266
- mindspore/train/serialization.py +105 -256
- mindspore/train/summary/_summary_adapter.py +1 -1
- mindspore/version.py +1 -1
- {mindspore-2.3.0.dist-info → mindspore-2.3.0rc2.dist-info}/METADATA +2 -2
- {mindspore-2.3.0.dist-info → mindspore-2.3.0rc2.dist-info}/RECORD +303 -420
- mindspore/_extends/pijit/__init__.py +0 -23
- mindspore/_extends/pijit/pijit_func_white_list.py +0 -343
- mindspore/common/file_system.py +0 -48
- mindspore/common/generator.py +0 -260
- mindspore/common/no_inline.py +0 -54
- mindspore/common/np_dtype.py +0 -25
- mindspore/communication/comm_func.py +0 -1140
- mindspore/hal/memory.py +0 -326
- mindspore/lib/libavcodec.so.59 +0 -0
- mindspore/lib/libavdevice.so.59 +0 -0
- mindspore/lib/libavfilter.so.8 +0 -0
- mindspore/lib/libavformat.so.59 +0 -0
- mindspore/lib/libavutil.so.57 +0 -0
- mindspore/lib/libmindspore_np_dtype.so +0 -0
- mindspore/lib/libswresample.so.4 +0 -0
- mindspore/lib/libswscale.so.6 +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/all_finite.cpp +0 -326
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/all_finite.py +0 -180
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_576ceaeef5870c451cab59af55ea46ad.json +0 -58
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_576ceaeef5870c451cab59af55ea46ad.o +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_86a73ff6e28d734c96bb8d3054f7dd18.json +0 -58
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_86a73ff6e28d734c96bb8d3054f7dd18.o +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_f55e0ebaad1f2f572e43677336992fa0.json +0 -58
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_f55e0ebaad1f2f572e43677336992fa0.o +0 -0
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/config/ascend910b/all_finite.json +0 -109
- mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/config/ascend910b/binary_info_config.json +0 -38
- mindspore/lib/plugin/ascend/custom_compiler/OWNERS +0 -12
- mindspore/lib/plugin/ascend/custom_compiler/setup.py +0 -255
- mindspore/lib/plugin/ascend/custom_compiler/start.sh +0 -26
- mindspore/lib/plugin/ascend/custom_compiler/template.json +0 -40
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/acme.h +0 -24
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/acme_op.h +0 -69
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/base_type.h +0 -133
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/op_creator.h +0 -32
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/op_param.h +0 -35
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/tiling_info.h +0 -60
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/core/kernel_register.h +0 -37
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/core/platform/platform_configs.h +0 -89
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/core/platform/rt_funcs.h +0 -135
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/add_op.h +0 -34
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/asd_backoff_base.h +0 -62
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/asd_elewise_op.h +0 -33
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/asd_ops.h +0 -88
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/asd_pa_op.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/cast_op.h +0 -52
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/matmul_op.h +0 -95
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/utils/asd_utils.h +0 -84
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/utils/comm_utils.h +0 -61
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_fp32.h +0 -224
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/and_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/div_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/elewise_binary_impl.h +0 -48
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/elewise_binary_tiling.h +0 -25
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/and_kernel.h +0 -46
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/div_kernel.h +0 -46
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/elewise_binary_base.h +0 -260
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/elewise_binary_kernel.h +0 -35
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/max_kernel.h +0 -66
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/min_kernel.h +0 -66
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/mul_kernel.h +0 -66
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/or_kernel.h +0 -46
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/max_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/min_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/mul_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/or_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/abs_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/elewise_unary_impl.h +0 -47
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/elewise_unary_tiling.h +0 -24
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/exp_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/abs_kernel.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/elewise_unary_base.h +0 -148
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/elewise_unary_kernel.h +0 -31
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/exp_kernel.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/ln_kernel.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/not_kernel.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/reciprocal_kernel.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/relu_kernel.h +0 -55
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/rsqrt_kernel.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/sqrt_kernel.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/ln_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/not_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/reciprocal_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/relu_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/rsqrt_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/sqrt_impl.h +0 -29
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/grouped_matmul_impl.h +0 -45
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/grouped_matmul_tiling.h +0 -187
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/kernel/grouped_matmul.h +0 -245
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/kernel/grouped_matmul_interface.h +0 -24
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/kernel/grouped_matmul_utils.h +0 -111
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/tiling_data.h +0 -54
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/compare_param.h +0 -31
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/elewise_param.h +0 -41
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/grouped_matmul_param.h +0 -40
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/profiling_util.h +0 -364
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log_utils.h +0 -69
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/register/kernel_creator.h +0 -39
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/register/kernel_registry.h +0 -114
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/utils.h +0 -98
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MatMulPostFusionMixTactic/matmul_postfusion_mix.json +0 -19
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MatMulPostFusionMixTactic/matmul_postfusion_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MatMulPostFusionMixTactic/matmul_postfusion_mix_mix_aic_0.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MatMulPostFusionMixTactic/matmul_postfusion_mix_mix_aiv_0.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MultiMatMulPostFusionMixTactic/multi_matmul_postfusion_mix.json +0 -19
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MultiMatMulPostFusionMixTactic/multi_matmul_postfusion_mix.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MultiMatMulPostFusionMixTactic/multi_matmul_postfusion_mix_mix_aic_0.o +0 -0
- mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MultiMatMulPostFusionMixTactic/multi_matmul_postfusion_mix_mix_aiv_0.o +0 -0
- mindspore/mint/linalg/__init__.py +0 -22
- mindspore/nn/layer/embedding_service.py +0 -531
- mindspore/nn/layer/embedding_service_layer.py +0 -393
- mindspore/ops/function/reshard_func.py +0 -102
- mindspore/ops/operations/_infer_ops.py +0 -19
- mindspore/ops/operations/reshard_ops.py +0 -53
- mindspore/profiler/common/process_pool.py +0 -41
- mindspore/profiler/common/singleton.py +0 -28
- mindspore/profiler/parser/ascend_integrate_generator.py +0 -42
- mindspore/profiler/parser/ascend_memory_generator.py +0 -185
- mindspore/train/callback/_cluster_monitor.py +0 -201
- mindspore/train/callback/_flops_collector.py +0 -238
- mindspore/train/callback/_mindio_ttp.py +0 -443
- {mindspore-2.3.0.dist-info → mindspore-2.3.0rc2.dist-info}/WHEEL +0 -0
- {mindspore-2.3.0.dist-info → mindspore-2.3.0rc2.dist-info}/entry_points.txt +0 -0
- {mindspore-2.3.0.dist-info → mindspore-2.3.0rc2.dist-info}/top_level.txt +0 -0
|
@@ -24,23 +24,22 @@ from mindspore.profiler.parser.ascend_analysis.fwk_file_parser import FwkFilePar
|
|
|
24
24
|
from mindspore.profiler.parser.ascend_analysis.trace_event_manager import TraceEventManager
|
|
25
25
|
from mindspore.profiler.parser.ascend_analysis.msprof_timeline_parser import MsprofTimelineParser
|
|
26
26
|
from mindspore.profiler.parser.ascend_analysis.profiler_info_parser import ProfilerInfoParser
|
|
27
|
-
from mindspore.profiler.parser.ascend_analysis.constant import Constant
|
|
28
27
|
|
|
29
28
|
|
|
30
29
|
class FwkCANNParser:
|
|
31
30
|
"""The top-level trace view parser."""
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
_trace_view_save_path = "trace_view_{}.json"
|
|
34
33
|
|
|
35
|
-
def __init__(self, source_path: str, msprof_data: List, rank_id: int
|
|
34
|
+
def __init__(self, source_path: str, msprof_data: List, rank_id: int):
|
|
36
35
|
source_path = validate_and_normalize_path(source_path)
|
|
37
36
|
ProfilerInfoParser.init_source_path(source_path)
|
|
38
37
|
ProfilerInfoParser.init_rank_id(rank_id)
|
|
39
38
|
fwk_parser = FwkFileParser(source_path, rank_id)
|
|
40
39
|
msprof_timeline_parser = MsprofTimelineParser(msprof_data)
|
|
41
|
-
self.
|
|
42
|
-
self.
|
|
43
|
-
self.
|
|
40
|
+
self._fwk_op_data = fwk_parser.get_op_range_data()
|
|
41
|
+
self._fwk_trace_data = fwk_parser.get_fwk_trace_data(self._fwk_op_data)
|
|
42
|
+
self._acl_to_npu = msprof_timeline_parser.get_acl_to_npu_data()
|
|
44
43
|
self.rank_id: int = rank_id
|
|
45
44
|
self.kernels: List[CANNEvent] = []
|
|
46
45
|
|
|
@@ -49,57 +48,36 @@ class FwkCANNParser:
|
|
|
49
48
|
Generate trace view json timeline file which contains framework side and
|
|
50
49
|
device side data.
|
|
51
50
|
"""
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return self._fwk_json + fwk_flow_json + self._device_most_json + device_flow_and_x_json
|
|
55
|
-
|
|
56
|
-
def __link_msop_self(self):
|
|
57
|
-
"""Create flow between framework-side multi-level pipeline task."""
|
|
58
|
-
link_event_dict = defaultdict(list)
|
|
59
|
-
for op_data in self._fwk_data:
|
|
60
|
-
if op_data.name == Constant.FLOW_OP:
|
|
61
|
-
link_event_dict[op_data.flow_id].insert(0, op_data)
|
|
62
|
-
elif op_data.flow_id != Constant.INVALID_FLOW_ID:
|
|
63
|
-
link_event_dict[op_data.flow_id].append(op_data)
|
|
64
|
-
flow_json = []
|
|
65
|
-
for op_data_list in link_event_dict.values():
|
|
66
|
-
if len(op_data_list) != 2:
|
|
67
|
-
logger.info('Only alow 2 op_data have the same flow_id. but got %s', len(op_data_list))
|
|
68
|
-
continue
|
|
69
|
-
flow_json.extend(TraceEventManager.create_mindspore_to_self_flow(op_data_list[0],
|
|
70
|
-
op_data_list[1]))
|
|
71
|
-
return flow_json
|
|
51
|
+
trace_data = self.__link_msop_kernel()
|
|
52
|
+
return self._fwk_trace_data + trace_data
|
|
72
53
|
|
|
73
54
|
def __link_msop_kernel(self) -> List:
|
|
74
55
|
"""Associate the frame-side operator with the device-side kernel"""
|
|
75
|
-
|
|
56
|
+
trace_data = []
|
|
76
57
|
op_data_by_tid = defaultdict(list)
|
|
77
58
|
acl_to_npu_by_tid = {}
|
|
78
|
-
for
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
acl_to_npu_by_tid.setdefault(cann_op_tid, defaultdict(list))[cann_op_ts].extend(event_list)
|
|
83
|
-
|
|
59
|
+
for op_data in self._fwk_op_data:
|
|
60
|
+
op_data_by_tid[op_data.tid].append(op_data)
|
|
61
|
+
for (ts, tid), event_list in self._acl_to_npu.items():
|
|
62
|
+
acl_to_npu_by_tid.setdefault(tid, defaultdict(list))[ts].extend(event_list)
|
|
84
63
|
if op_data_by_tid.keys() != acl_to_npu_by_tid.keys():
|
|
85
64
|
logger.warning("Failed to create link between mindspore operator and kernels.")
|
|
86
65
|
|
|
87
|
-
for
|
|
88
|
-
host_data_sorted = sorted(op_data_by_tid.get(device_tid, []), key=lambda x: x.ts)
|
|
66
|
+
for tid in op_data_by_tid:
|
|
89
67
|
op_idx = 0
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
return
|
|
68
|
+
op_data_sorted = sorted(op_data_by_tid[tid], key=lambda x: x.ts)
|
|
69
|
+
acl_sorted = sorted(acl_to_npu_by_tid.get(tid, {}).items(), key=lambda x: x[0])
|
|
70
|
+
for ts, cann_event_list in acl_sorted:
|
|
71
|
+
op_idx, status = FwkCANNParser.__find_launch_op(ts, op_data_sorted, op_idx)
|
|
72
|
+
if not status:
|
|
73
|
+
continue
|
|
74
|
+
for cann_event in cann_event_list:
|
|
75
|
+
cann_event.parent = op_data_sorted[op_idx]
|
|
76
|
+
op_data_sorted[op_idx].children.append(cann_event)
|
|
77
|
+
flow_list = TraceEventManager.create_mindspore_to_npu_flow(op_data_sorted[op_idx], cann_event)
|
|
78
|
+
self.kernels.append(cann_event)
|
|
79
|
+
trace_data += flow_list
|
|
80
|
+
return trace_data
|
|
103
81
|
|
|
104
82
|
@staticmethod
|
|
105
83
|
def __find_launch_op(ts: Decimal, op_list: List[MindSporeOpEvent],
|
|
@@ -122,7 +100,7 @@ class FwkCANNParser:
|
|
|
122
100
|
right = len(op_list) if (right is None or right < 0) else right
|
|
123
101
|
# The data in range [left, right) is considered.
|
|
124
102
|
while right > left:
|
|
125
|
-
if op_list[left].ts
|
|
103
|
+
if op_list[left].ts > ts:
|
|
126
104
|
return left, False
|
|
127
105
|
if op_list[left].end_us < ts:
|
|
128
106
|
left += 1
|
|
@@ -24,14 +24,13 @@ from mindspore.profiler.parser.ascend_analysis.file_manager import FileManager
|
|
|
24
24
|
from mindspore.profiler.parser.ascend_analysis.tlv_decoder import TLVDecoder
|
|
25
25
|
from mindspore.profiler.parser.ascend_analysis.function_event import MindSporeOpEvent
|
|
26
26
|
from mindspore.profiler.parser.ascend_analysis.trace_event_manager import TraceEventManager
|
|
27
|
-
from mindspore.profiler.parser.ascend_analysis.constant import Constant
|
|
28
27
|
|
|
29
28
|
|
|
30
29
|
class FwkFileParser:
|
|
31
30
|
"""Framework-side operator file parser."""
|
|
32
31
|
|
|
33
32
|
_op_range = "FRAMEWORK/op_range_{}"
|
|
34
|
-
_op_range_struct_size =
|
|
33
|
+
_op_range_struct_size = 57
|
|
35
34
|
|
|
36
35
|
def __init__(self, source_path: str, rank_id: int):
|
|
37
36
|
"""
|
|
@@ -41,7 +40,7 @@ class FwkFileParser:
|
|
|
41
40
|
self._op_range_path = None
|
|
42
41
|
self.__init_framework_path(source_path)
|
|
43
42
|
|
|
44
|
-
def get_op_range_data(self
|
|
43
|
+
def get_op_range_data(self) -> List[MindSporeOpEvent]:
|
|
45
44
|
"""Read and decode all the mindspore oprange data."""
|
|
46
45
|
op_range_list = []
|
|
47
46
|
if os.path.exists(self._op_range_path):
|
|
@@ -49,27 +48,23 @@ class FwkFileParser:
|
|
|
49
48
|
op_range_list = TLVDecoder.decode(op_range_bytes, MindSporeOpEvent, self._op_range_struct_size)
|
|
50
49
|
else:
|
|
51
50
|
logger.error("Failed to find op_range data.")
|
|
52
|
-
if step_list and isinstance(step_list, list):
|
|
53
|
-
first_step = min(op.step for op in op_range_list)
|
|
54
|
-
step_list = [step - 1 + first_step for step in step_list]
|
|
55
|
-
op_range_list = list(filter(lambda op: op.step in step_list, op_range_list))
|
|
56
51
|
return op_range_list
|
|
57
52
|
|
|
58
53
|
def get_fwk_trace_data(self, mindspore_op_data: List[MindSporeOpEvent] = None):
|
|
59
54
|
"""Generate chrome trace format json data from decoded oprange data."""
|
|
60
55
|
if not mindspore_op_data:
|
|
61
56
|
mindspore_op_data = self.get_op_range_data()
|
|
62
|
-
tid_map = defaultdict(
|
|
63
|
-
fwk_x_event_list = []
|
|
57
|
+
tid_map = defaultdict(list)
|
|
58
|
+
fwk_x_event_list = [None] * len(mindspore_op_data)
|
|
59
|
+
index = 0
|
|
64
60
|
|
|
65
61
|
for mindspore_op in mindspore_op_data:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
fwk_x_event_list.append(TraceEventManager.create_x_event(mindspore_op, "cpu_op"))
|
|
62
|
+
tid_map[mindspore_op.pid].append(mindspore_op.tid)
|
|
63
|
+
fwk_x_event_list[index] = TraceEventManager.create_x_event(mindspore_op, "cpu_op")
|
|
64
|
+
index += 1
|
|
70
65
|
fwk_m_event_list = []
|
|
71
|
-
for pid,
|
|
72
|
-
fwk_m_event_list.extend(TraceEventManager.create_m_event(pid,
|
|
66
|
+
for pid, tid_list in tid_map.items():
|
|
67
|
+
fwk_m_event_list.extend(TraceEventManager.create_m_event(pid, tid_list))
|
|
73
68
|
return fwk_x_event_list + fwk_m_event_list
|
|
74
69
|
|
|
75
70
|
def __init_framework_path(self, source_path: str):
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
# ============================================================================
|
|
15
15
|
"""msprof timeline file parser"""
|
|
16
16
|
from collections import defaultdict
|
|
17
|
-
from typing import List
|
|
17
|
+
from typing import List, Dict, Tuple
|
|
18
18
|
|
|
19
19
|
from mindspore.profiler.parser.ascend_analysis.function_event import CANNEvent
|
|
20
20
|
|
|
@@ -22,36 +22,31 @@ from mindspore.profiler.parser.ascend_analysis.function_event import CANNEvent
|
|
|
22
22
|
class MsprofTimelineParser:
|
|
23
23
|
"""Msprof timeline file parser."""
|
|
24
24
|
|
|
25
|
+
ACL_TO_NPU = "acl_to_npu"
|
|
26
|
+
START_FLOW = "s"
|
|
27
|
+
END_FLOW = "f"
|
|
28
|
+
TIMELINE = "timeline"
|
|
29
|
+
|
|
25
30
|
def __init__(self, msprof_data: List):
|
|
26
31
|
self.timeline_data = msprof_data
|
|
27
32
|
|
|
28
|
-
def get_acl_to_npu_data(self):
|
|
33
|
+
def get_acl_to_npu_data(self) -> Dict[Tuple, List[CANNEvent]]:
|
|
29
34
|
"""Get all the acl to npu flow events."""
|
|
30
35
|
flow_start_dict, flow_end_dict = {}, {}
|
|
31
|
-
|
|
36
|
+
cann_event_list: List[CANNEvent] = []
|
|
32
37
|
for data in self.timeline_data:
|
|
33
38
|
cann_event = CANNEvent(data)
|
|
34
|
-
|
|
35
|
-
x_event_list.append(cann_event)
|
|
36
|
-
else:
|
|
37
|
-
cann_event_json = cann_event.to_json()
|
|
38
|
-
if cann_event_json:
|
|
39
|
-
other_event_json.append(cann_event_json)
|
|
40
|
-
|
|
39
|
+
cann_event_list.append(cann_event)
|
|
41
40
|
if cann_event.is_flow_start_event():
|
|
42
|
-
flow_start_dict[cann_event.id] = (cann_event.
|
|
41
|
+
flow_start_dict[cann_event.id] = (cann_event.ts, cann_event.tid)
|
|
43
42
|
elif cann_event.is_flow_end_event():
|
|
44
|
-
flow_end_dict[
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if cann_event_json:
|
|
55
|
-
device_data_without_flow_json.append(cann_event_json)
|
|
56
|
-
|
|
57
|
-
return start_flow_to_npu_dict, device_data_without_flow_json + other_event_json
|
|
43
|
+
flow_end_dict[cann_event.unique_id] = cann_event.id
|
|
44
|
+
acl_to_npu_dict = defaultdict(list)
|
|
45
|
+
for cann_event in cann_event_list:
|
|
46
|
+
if not cann_event.is_x_event():
|
|
47
|
+
continue
|
|
48
|
+
corr_id = flow_end_dict.get(cann_event.unique_id)
|
|
49
|
+
acl_ts_tid = flow_start_dict.get(corr_id)
|
|
50
|
+
if corr_id is not None and acl_ts_tid is not None:
|
|
51
|
+
acl_to_npu_dict[acl_ts_tid].append(cann_event)
|
|
52
|
+
return acl_to_npu_dict
|
|
@@ -28,6 +28,7 @@ from mindspore.profiler.parser.profiler_info import ProfilerInfo
|
|
|
28
28
|
class ProfilerInfoParser:
|
|
29
29
|
"""Parse files that record information, such as profiler_info.json"""
|
|
30
30
|
|
|
31
|
+
_localtime_diff = Decimal(0)
|
|
31
32
|
_freq = 100.0
|
|
32
33
|
_time_offset = 0
|
|
33
34
|
_start_cnt = 0
|
|
@@ -49,7 +50,7 @@ class ProfilerInfoParser:
|
|
|
49
50
|
cls._source_prof_path = prof_path
|
|
50
51
|
|
|
51
52
|
@classmethod
|
|
52
|
-
def init_rank_id(cls, rank_id
|
|
53
|
+
def init_rank_id(cls, rank_id):
|
|
53
54
|
"""initialize the rank id."""
|
|
54
55
|
cls._rank_id = rank_id
|
|
55
56
|
|
|
@@ -76,9 +77,8 @@ class ProfilerInfoParser:
|
|
|
76
77
|
profiler_info_path = os.path.join(cls._source_prof_path, os.path.pardir,
|
|
77
78
|
f"profiler_info_{cls._rank_id}.json")
|
|
78
79
|
if not os.path.isfile(profiler_info_path):
|
|
79
|
-
raise RuntimeError(f"Can`t find the file {profiler_info_path}, please check
|
|
80
|
-
with os.fdopen(os.open(profiler_info_path, os.O_RDONLY, 0o600),
|
|
81
|
-
'r') as fr:
|
|
80
|
+
raise RuntimeError(f"Can`t find the file {profiler_info_path}, please check!")
|
|
81
|
+
with os.fdopen(os.open(profiler_info_path, os.O_RDONLY, 0o600), 'r') as fr:
|
|
82
82
|
profiler_info_data = json.load(fr)
|
|
83
83
|
cls._start_cnt = profiler_info_data.get('system_cnt')
|
|
84
84
|
cls._time_offset = profiler_info_data.get('system_time')
|
|
@@ -86,7 +86,7 @@ class ProfilerInfoParser:
|
|
|
86
86
|
ProfilerInfo.set_system_cnt(cls._start_cnt)
|
|
87
87
|
cls._loaded_frequency = True
|
|
88
88
|
start_ns = cls.__get_timestamp(syscnt)
|
|
89
|
-
start_us = Decimal(start_ns
|
|
89
|
+
start_us = Decimal(start_ns) / Constant.NS_TO_US
|
|
90
90
|
return start_us
|
|
91
91
|
|
|
92
92
|
@classmethod
|
|
@@ -33,7 +33,7 @@ class TraceEventManager:
|
|
|
33
33
|
return x_event
|
|
34
34
|
|
|
35
35
|
@classmethod
|
|
36
|
-
def create_m_event(cls, pid: int, tid_list:
|
|
36
|
+
def create_m_event(cls, pid: int, tid_list: List) -> List:
|
|
37
37
|
"""Create some metadata event."""
|
|
38
38
|
# framework sidee trace information display format: MindSpore(pid pid_value): CPU
|
|
39
39
|
event_list = [
|
|
@@ -57,12 +57,3 @@ class TraceEventManager:
|
|
|
57
57
|
"tid": start_event.tid, "ts": str(start_event.ts), "cat": "async_npu"},
|
|
58
58
|
{"ph": "f", "bp": "e", "name": "mindspore_to_npu", "id": flow_id, "pid": end_event.pid,
|
|
59
59
|
"tid": end_event.tid, "ts": str(end_event.ts), "cat": "async_npu"}]
|
|
60
|
-
|
|
61
|
-
@classmethod
|
|
62
|
-
def create_mindspore_to_self_flow(cls, start_event: BaseEvent, end_event: BaseEvent) -> List:
|
|
63
|
-
"""Create flow events link mindspore operator and npu kernel."""
|
|
64
|
-
flow_id = start_event.flow_id
|
|
65
|
-
return [{"ph": "s", "bp": "e", "name": "mindspore_to_self", "id": flow_id, "pid": start_event.pid,
|
|
66
|
-
"tid": start_event.tid, "ts": str(start_event.ts), "cat": "async_mindspore"},
|
|
67
|
-
{"ph": "f", "bp": "e", "name": "mindspore_to_self", "id": flow_id, "pid": end_event.pid,
|
|
68
|
-
"tid": end_event.tid, "ts": str(end_event.ts), "cat": "async_mindspore"}]
|
|
@@ -29,8 +29,6 @@ from mindspore.profiler.common.util import get_newest_file
|
|
|
29
29
|
class AscendHCCLGenerator:
|
|
30
30
|
"""Generate ascend hccl data from files."""
|
|
31
31
|
|
|
32
|
-
DEFAULT_MODEL_ID = 4294967295
|
|
33
|
-
|
|
34
32
|
def __init__(self, mindstudio_profiler_output, steptrace):
|
|
35
33
|
self.mindstudio_profiler_output = mindstudio_profiler_output
|
|
36
34
|
self.steptrace = steptrace
|
|
@@ -186,8 +184,7 @@ class AscendHCCLGenerator:
|
|
|
186
184
|
size = size if isinstance(size, int) else int(size, 16)
|
|
187
185
|
steptrace = groups_steptrace.get(model_id, None)
|
|
188
186
|
if steptrace is None:
|
|
189
|
-
|
|
190
|
-
logging.warning('Could not find model: %s in hccl json, skip.', model_id)
|
|
187
|
+
logging.warning('Could not find model: %s in hccl json, skip.', model_id)
|
|
191
188
|
continue
|
|
192
189
|
tag = np.searchsorted(steptrace['Iteration End'], te * 1e-3, side='left')
|
|
193
190
|
iteration_id = steptrace[tag]['Iteration ID']
|
|
@@ -99,30 +99,18 @@ class AscendMsprofExporter:
|
|
|
99
99
|
logger.info("The msprof command has been added to the path!")
|
|
100
100
|
|
|
101
101
|
@classmethod
|
|
102
|
-
def
|
|
103
|
-
"""Check the existence of
|
|
104
|
-
|
|
105
|
-
return ""
|
|
106
|
-
outs, _ = AscendMsprofExporter.run_cmd(["which", cls._msprof_cmd])
|
|
102
|
+
def get_msprof_info_path(cls):
|
|
103
|
+
"""Check the existence of get_msprof_info.py script"""
|
|
104
|
+
outs, _ = AscendMsprofExporter.run_cmd(['which', cls._msprof_cmd])
|
|
107
105
|
if not outs:
|
|
108
106
|
return ""
|
|
109
107
|
msprof_path = os.path.realpath(outs.strip())
|
|
110
|
-
sup_path = msprof_path.split(
|
|
111
|
-
script_path = os.path.join(sup_path,
|
|
108
|
+
sup_path = msprof_path.split('tools')[0]
|
|
109
|
+
script_path = os.path.join(sup_path, 'tools/profiler/profiler_tool/analysis/interface/get_msprof_info.py')
|
|
112
110
|
if not os.path.exists(script_path):
|
|
113
111
|
return ""
|
|
114
112
|
return script_path
|
|
115
113
|
|
|
116
|
-
@classmethod
|
|
117
|
-
def get_msprof_info_path(cls):
|
|
118
|
-
"""Check the existence of get_msprof_info.py script"""
|
|
119
|
-
return cls.get_msprof_script_path("tools/profiler/profiler_tool/analysis/interface/get_msprof_info.py")
|
|
120
|
-
|
|
121
|
-
@classmethod
|
|
122
|
-
def get_msprof_py_script_path(cls):
|
|
123
|
-
"""Check the existence of msprof.py script"""
|
|
124
|
-
return cls.get_msprof_script_path("tools/profiler/profiler_tool/analysis/msprof/msprof.py")
|
|
125
|
-
|
|
126
114
|
@classmethod
|
|
127
115
|
def run_cmd(cls, cmd, timeout=300):
|
|
128
116
|
"""run shell command"""
|
|
@@ -143,14 +131,17 @@ class AscendMsprofExporter:
|
|
|
143
131
|
|
|
144
132
|
def get_drv_version(self):
|
|
145
133
|
"""Get the drv_version for choosing the export mode."""
|
|
134
|
+
script_path = AscendMsprofExporter.get_msprof_info_path()
|
|
135
|
+
if not script_path:
|
|
136
|
+
logger.warning("Can`t find get_msprof_info.py path, use single-export mode instead.")
|
|
137
|
+
return False
|
|
138
|
+
|
|
139
|
+
logger.info("get_msprof_info.py path is : %s", script_path)
|
|
140
|
+
host_dir = os.path.join(self.prof_root_dir, 'host')
|
|
141
|
+
cmd = ['python',
|
|
142
|
+
script_path,
|
|
143
|
+
'-dir', host_dir]
|
|
146
144
|
try:
|
|
147
|
-
script_path = AscendMsprofExporter.get_msprof_info_path()
|
|
148
|
-
if not script_path:
|
|
149
|
-
logger.warning("Can`t find get_msprof_info.py path, use single-export mode instead.")
|
|
150
|
-
return False
|
|
151
|
-
logger.info("get_msprof_info.py path is : %s", script_path)
|
|
152
|
-
host_dir = os.path.join(self.prof_root_dir, 'host')
|
|
153
|
-
cmd = ['python', script_path, '-dir', host_dir]
|
|
154
145
|
outs, _ = AscendMsprofExporter.run_cmd(cmd)
|
|
155
146
|
if not outs:
|
|
156
147
|
logger.warning('Check the drvVersion can`t find the result, use single-export mode instead.')
|
|
@@ -164,7 +155,7 @@ class AscendMsprofExporter:
|
|
|
164
155
|
if drv_version >= self.DRV_VERSION:
|
|
165
156
|
return True
|
|
166
157
|
return False
|
|
167
|
-
except (RuntimeError, JSONDecodeError, AttributeError
|
|
158
|
+
except (RuntimeError, JSONDecodeError, AttributeError) as err:
|
|
168
159
|
logger.warning('Get the drvVersion error, use single-export mode instead. detail : %s', err)
|
|
169
160
|
return False
|
|
170
161
|
|
|
@@ -178,8 +169,12 @@ class AscendMsprofExporter:
|
|
|
178
169
|
model_iteration_dict = self._generate_step_trace()
|
|
179
170
|
|
|
180
171
|
if model_iteration_dict:
|
|
181
|
-
for model_id,
|
|
182
|
-
|
|
172
|
+
for model_id, value in model_iteration_dict.items():
|
|
173
|
+
for iteration_id in value:
|
|
174
|
+
msprof_export_cmd = self._msprof_command_generator_old(self.prof_root_dir, model_id,
|
|
175
|
+
iteration_id)
|
|
176
|
+
AscendMsprofExporter.run_cmd(msprof_export_cmd, self._time_out)
|
|
177
|
+
|
|
183
178
|
else:
|
|
184
179
|
msprof_export_cmd = self._msprof_command_generator(self.prof_root_dir)
|
|
185
180
|
AscendMsprofExporter.run_cmd(msprof_export_cmd, self._time_out)
|
|
@@ -192,22 +187,6 @@ class AscendMsprofExporter:
|
|
|
192
187
|
|
|
193
188
|
return flag
|
|
194
189
|
|
|
195
|
-
def _run_msprof_export_cmd(self, prof_root_dir, model_id, iter_list):
|
|
196
|
-
"""run msprof.py export cmd"""
|
|
197
|
-
script_path = AscendMsprofExporter.get_msprof_py_script_path()
|
|
198
|
-
if not script_path:
|
|
199
|
-
raise FileNotFoundError("Can not find msprof.py path, please check the cann environment.")
|
|
200
|
-
export_cmd = ['python', script_path]
|
|
201
|
-
iter_param = []
|
|
202
|
-
if isinstance(model_id, int) and model_id >= 0:
|
|
203
|
-
iter_param.extend(["--model-id", str(model_id)])
|
|
204
|
-
if iter_list and isinstance(iter_list, list):
|
|
205
|
-
iter_list.sort()
|
|
206
|
-
iter_param.extend(["--iteration-id", str(iter_list[0]), "--iteration-count", str(len(iter_list))])
|
|
207
|
-
for export_type in ("timeline", "summary"):
|
|
208
|
-
cmd = export_cmd + ["export", export_type, "-dir", prof_root_dir] + iter_param
|
|
209
|
-
AscendMsprofExporter.run_cmd(cmd, self._time_out)
|
|
210
|
-
|
|
211
190
|
def _msprof_command_generator_old(self, output, model_id=None, iter_id=None):
|
|
212
191
|
"""msprof export helper"""
|
|
213
192
|
export_cmd = [self._msprof_cmd, "--export=on", "--output={}".format(output)]
|
|
@@ -37,8 +37,7 @@ class AscendTimelineGenerator(BaseTimelineGenerator):
|
|
|
37
37
|
scope_index = 1
|
|
38
38
|
cpu_index = 2
|
|
39
39
|
|
|
40
|
-
def __init__(self, profiling_dir, source_path, mindstudio_profiler_output, rank_id, rank_size, mode
|
|
41
|
-
step_list=None):
|
|
40
|
+
def __init__(self, profiling_dir, source_path, mindstudio_profiler_output, rank_id, rank_size, mode):
|
|
42
41
|
super().__init__(DeviceTarget.ASCEND.value, mode)
|
|
43
42
|
self._profiling_dir = profiling_dir
|
|
44
43
|
self._source_path = source_path
|
|
@@ -48,7 +47,6 @@ class AscendTimelineGenerator(BaseTimelineGenerator):
|
|
|
48
47
|
self._timeline_display_filename = self._timeline_display_filename.format(rank_id)
|
|
49
48
|
self._timeline_summary_filename = self._timeline_summary_filename.format(rank_id)
|
|
50
49
|
self._timeline_data = []
|
|
51
|
-
self._step_list = step_list
|
|
52
50
|
|
|
53
51
|
self.step_time_list_df = np.dtype(
|
|
54
52
|
[('Iteration ID', object), ('Steps', object), ('Iteration Start', float), ('Iteration Time', float)])
|
|
@@ -150,7 +148,8 @@ class AscendTimelineGenerator(BaseTimelineGenerator):
|
|
|
150
148
|
logger.info("Start parse timeline data...")
|
|
151
149
|
self._pretty = pretty
|
|
152
150
|
timeline_data = []
|
|
153
|
-
|
|
151
|
+
|
|
152
|
+
all_scope_data = [] # 所有带scope的算子
|
|
154
153
|
|
|
155
154
|
# get msprof data
|
|
156
155
|
msprof_file_name = fr'{self._mindstudio_profiler_output}/msprof_*.json'
|
|
@@ -160,6 +159,7 @@ class AscendTimelineGenerator(BaseTimelineGenerator):
|
|
|
160
159
|
logger.error('Could not find msprof_*.json file in %s', self._mindstudio_profiler_output)
|
|
161
160
|
else:
|
|
162
161
|
msprof_timeline = self._parse_msprof_data(get_newest_file(file_list_msprof))
|
|
162
|
+
timeline_data.extend(msprof_timeline)
|
|
163
163
|
|
|
164
164
|
# get Ascend Hardware for scope
|
|
165
165
|
scope_data = self._parse_ascend_hardware_scope(msprof_timeline)
|
|
@@ -186,8 +186,6 @@ class AscendTimelineGenerator(BaseTimelineGenerator):
|
|
|
186
186
|
result = self._parse_fwk_device_data(msprof_timeline)
|
|
187
187
|
timeline_data.extend(result.get("trace_data", []))
|
|
188
188
|
self._kernel_events = result.get("kernels", [])
|
|
189
|
-
else:
|
|
190
|
-
timeline_data.extend(msprof_timeline)
|
|
191
189
|
|
|
192
190
|
logger.info("All timeline data parse complete.")
|
|
193
191
|
self._timeline_data = timeline_data
|
|
@@ -258,7 +256,7 @@ class AscendTimelineGenerator(BaseTimelineGenerator):
|
|
|
258
256
|
"""
|
|
259
257
|
Get framework op range trace data, flow events and hardware kernel events
|
|
260
258
|
"""
|
|
261
|
-
fwkcann_parser = FwkCANNParser(self._source_path, cann_kernel_data, self._rank_id
|
|
259
|
+
fwkcann_parser = FwkCANNParser(self._source_path, cann_kernel_data, self._rank_id)
|
|
262
260
|
fwk_link_data = fwkcann_parser.generate_trace_data()
|
|
263
261
|
kernels = fwkcann_parser.kernels
|
|
264
262
|
result = {"trace_data": fwk_link_data, "kernels": kernels}
|
|
@@ -14,8 +14,6 @@
|
|
|
14
14
|
# ============================================================================
|
|
15
15
|
"""Minddata aicpu parser."""
|
|
16
16
|
import os
|
|
17
|
-
import glob
|
|
18
|
-
import csv
|
|
19
17
|
|
|
20
18
|
from mindspore.profiler.common.util import get_file_join_name, fwrite_format
|
|
21
19
|
from mindspore import log as logger
|
|
@@ -88,80 +86,13 @@ class MinddataParser:
|
|
|
88
86
|
return result
|
|
89
87
|
|
|
90
88
|
@staticmethod
|
|
91
|
-
def execute(source_path, output_path,
|
|
89
|
+
def execute(source_path, output_path, device_id):
|
|
92
90
|
"""
|
|
93
91
|
Execute the parser.
|
|
94
92
|
|
|
95
93
|
Args:
|
|
96
|
-
source_path (str): the source file path
|
|
97
|
-
output_path (str): the output file path
|
|
98
|
-
job_id (str): the job id, eg: PROF_XXX/device_*
|
|
99
|
-
device_id (str): the device id.
|
|
100
|
-
"""
|
|
101
|
-
if MinddataParser._is_legacy_aicpu_data(source_path, job_id):
|
|
102
|
-
logger.warning("The aicpu data is legacy, which will be deprecated in the future, please update your "
|
|
103
|
-
"CANN and driver version.")
|
|
104
|
-
MinddataParser._execute_legacy(os.path.join(source_path, job_id), output_path, device_id)
|
|
105
|
-
return
|
|
106
|
-
|
|
107
|
-
MinddataParser._execute(source_path, output_path, job_id, device_id)
|
|
108
|
-
|
|
109
|
-
@staticmethod
|
|
110
|
-
def _is_legacy_aicpu_data(source_path, job_id) -> bool:
|
|
111
|
-
"""
|
|
112
|
-
Check whether the aicpu data is legacy.
|
|
113
|
-
|
|
114
|
-
Args:
|
|
115
|
-
source_path (str): the source file path, eg: profiler.
|
|
116
|
-
job_id (str): the job id, eg: PROF_XXX/device_*
|
|
117
|
-
Returns:
|
|
118
|
-
bool, True if the aicpu data is legacy, False otherwise.
|
|
119
|
-
"""
|
|
120
|
-
legacy_files = glob.glob(os.path.join(source_path, job_id, "data", "DATA_PREPROCESS.*"))
|
|
121
|
-
return len(legacy_files) > 0
|
|
122
|
-
|
|
123
|
-
@staticmethod
|
|
124
|
-
def _execute(source_path, output_path, job_id, device_id):
|
|
125
|
-
"""
|
|
126
|
-
Execute the parser when using newest CANN and driver version.
|
|
127
|
-
|
|
128
|
-
Args:
|
|
129
|
-
source_path (str): the source file path, eg: profiler.
|
|
130
|
-
output_path (str): the output file path, eg: profiler.
|
|
131
|
-
job_id (str): the job id, eg: PROF_XXX/device_*
|
|
132
|
-
device_id (str): the device id.
|
|
133
|
-
"""
|
|
134
|
-
minddata_aicpu_data = []
|
|
135
|
-
prof_path = job_id.split("/")[0]
|
|
136
|
-
if not prof_path:
|
|
137
|
-
logger.error("The job_id is invalid: %s", job_id)
|
|
138
|
-
return
|
|
139
|
-
|
|
140
|
-
prof_output_path = os.path.join(source_path, prof_path, "mindstudio_profiler_output")
|
|
141
|
-
aicpu_file = glob.glob(os.path.join(prof_output_path, "aicpu_mi_*.csv"))
|
|
142
|
-
if not aicpu_file:
|
|
143
|
-
return
|
|
144
|
-
|
|
145
|
-
# aicpu_file len is 1
|
|
146
|
-
for file_path in aicpu_file:
|
|
147
|
-
file_path = validate_and_normalize_path(file_path)
|
|
148
|
-
with open(file_path, "r", newline='') as f:
|
|
149
|
-
reader = csv.reader(f)
|
|
150
|
-
minddata_aicpu_data = [[line[1], line[2][:-2], line[3][:-2], line[4]] for line in reader]
|
|
151
|
-
|
|
152
|
-
if minddata_aicpu_data:
|
|
153
|
-
minddata_aicpu_output_path = os.path.join(output_path, "minddata_aicpu_" + str(device_id) + ".txt")
|
|
154
|
-
fwrite_format(minddata_aicpu_output_path, minddata_aicpu_data[1:], is_start=True)
|
|
155
|
-
logger.info("Minddata aicpu data has been saved to %s", minddata_aicpu_output_path)
|
|
156
|
-
|
|
157
|
-
@staticmethod
|
|
158
|
-
def _execute_legacy(source_path, output_path, device_id):
|
|
159
|
-
"""
|
|
160
|
-
Execute the parser when using legacy CANN and driver version.
|
|
161
|
-
|
|
162
|
-
Args:
|
|
163
|
-
source_path (str): the source file path, eg: profiler/PROF_XXX/device_*.
|
|
164
|
-
output_path (str): the output file path, eg: profiler.
|
|
94
|
+
source_path (str): the source file path.
|
|
95
|
+
output_path (str): the output file path.
|
|
165
96
|
device_id (str): the device id.
|
|
166
97
|
"""
|
|
167
98
|
col_names = ["node_name", "start_time", "end_time", "queue_size"]
|